stages: - docker # create images that are needed by the rest of the build - build # create any outputs of the project (binaries, containers, charts…) - test # all quality checks - deploy # export the outputs (publish to an artifact registry, deploy on a server…) include: - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/version.gitlab-ci.yml - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/mirror.gitlab-ci.yml - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/gradle.gitlab-ci.yml - remote: https://gitlab.com/opensavvy/ci-templates/-/raw/main/docker.gitlab-ci.yml variables: # https://gitlab.com/opensavvy/automation/containers ci_containers: 0.8.11 workflow: rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'schedule' - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_TAG # region Kotlin Multiplatform .kotlin-jvm: extends: [ .os.gradle ] image: registry.gitlab.com/opensavvy/automation/containers/java:$ci_containers needs: [ os.version ] # endregion # region Publishing publish-maven:gitlab: extends: [ .kotlin-jvm ] needs: - os.version stage: deploy script: - > ./gradlew publishAllPublicationsToGitLabRepository -PappVersion=$project_version interruptible: false rules: - if: $PUBLISH_MAVEN == "no" || $PUBLISH_MAVEN_GITLAB == "no" when: never - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_TAG - when: manual allow_failure: true # Needed to avoid blocking the pipelines publish-maven:central:snapshots: extends: [ .kotlin-jvm ] needs: - os.version stage: deploy script: - > ./gradlew :publishAggregationToCentralPortalSnapshots -PappVersion="${project_version}-SNAPSHOT" interruptible: false rules: - if: $OSSRH_USERNAME == null || $OSSRH_PASSWORD == null when: never - if: $PUBLISH_MAVEN == "no" || $PUBLISH_MAVEN_CENTRAL == "no" when: never - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - when: manual allow_failure: true # Needed to avoid blocking the pipelines publish-maven:central: extends: [ .kotlin-jvm ] needs: - os.version stage: deploy script: - export SIGNING_KEY_RING=$(mktemp) - <"$SIGNING_KEY_RING_B64" base64 -d >"$SIGNING_KEY_RING" - > ./gradlew publishAggregationToCentralPortal -PappVersion=$project_version interruptible: false rules: - if: $OSSRH_USERNAME == null || $OSSRH_PASSWORD == null when: never - if: $PUBLISH_MAVEN == "no" || $PUBLISH_MAVEN_CENTRAL == "no" when: never - if: $CI_COMMIT_TAG # endregion # region Qodana qodana[jvm]: needs: [ ] image: name: jetbrains/qodana-jvm-community entrypoint: [ "" ] script: - qodana artifacts: paths: - qodana rules: - if: $QODANA_TOKEN == null when: never - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH allow_failure: true - if: $CI_COMMIT_TAG allow_failure: true - when: manual allow_failure: true # endregion # region Automatically mirror the previous layer of the playground mirror-playground: stage: deploy extends: [ .os.mirror ] needs: [ ] variables: url: "$playground_parent" name: "$playground_parent_name" key: "$playground_mirroring_key" key_public: "$playground_mirroring_key_public" rules: - if: $playground_parent == null || $playground_parent_name == null when: never - if: $playground_mirroring_key == null || $playground_mirroring_key_public == null when: never - if: $CI_PIPELINE_SOURCE == 'schedule' - when: manual allow_failure: true # endregion # region Kotlin pipeline gitlab-ci.main.kts compile: stage: .pre image: registry.gitlab.com/opensavvy/automation/containers/kotlin:$ci_containers needs: [] variables: GIT_DEPTH: 1 script: - ./.gitlab-ci.main.kts >kotlin-ci.yml artifacts: paths: - kotlin-ci.yml interruptible: true gitlab-ci.main.kts run: stage: .pre needs: [ "gitlab-ci.main.kts compile", "os.version" ] trigger: include: - artifact: kotlin-ci.yml job: "gitlab-ci.main.kts compile" strategy: depend rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'schedule' - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_TAG # endregion