From 1614e25eadde708d4911ec2d5c36551d9bf7d441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Mon, 6 May 2024 13:17:39 +0200 Subject: [PATCH] Refactor CI/CD pipeline --- .gitlab-ci.yml | 117 +++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 46f15eb8b..7a7cb63f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,8 +19,8 @@ image: git.gfz-potsdam.de:5000/naaice/poet:ci stages: # List of stages for jobs, and their order of execution - - build - release + - build - test variables: @@ -31,13 +31,16 @@ variables: build-poet: # This job runs in the build stage, which runs first. stage: build script: - - mkdir build && cd build + - mkdir -p build && cd build - cmake -DPOET_ENABLE_TESTING=ON .. - make -j$(nproc) + cache: + key: build-$CI_COMMIT_BRANCH + paths: + - build artifacts: paths: - build - expire_in: 1 day test-poet: stage: test @@ -47,59 +50,6 @@ test-poet: - cd build - make -j$(nproc) check -archive-sources: # This job runs in the build stage, which runs first. - image: python:3 - stage: release - - before_script: - - pip install git-archive-all - - echo ARCHIVE_JOB_ID=${CI_JOB_ID} >> archives.env - script: - - git-archive-all ${SOURCE_ARCHIVE_NAME} - artifacts: - paths: - - ${SOURCE_ARCHIVE_NAME} - expire_in: never - reports: - dotenv: archives.env - rules: - - if: $CI_COMMIT_TAG - -release-description: - image: golang:bullseye - stage: release - rules: - - if: $CI_COMMIT_TAG - before_script: - - go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.2 - script: - - git-chglog -o ${CHANGELOG_FILE} ${CI_COMMIT_TAG} - artifacts: - paths: - - ${CHANGELOG_FILE} - - -release-create: - stage: release - image: registry.gitlab.com/gitlab-org/release-cli:latest - rules: - - if: $CI_COMMIT_TAG - script: - - echo "Running release job" - needs: - - job: archive-sources - artifacts: true - - job: release-description - artifacts: true - release: - tag_name: $CI_COMMIT_TAG - name: 'POET $CI_COMMIT_TAG' - description: ${CHANGELOG_FILE} - assets: - links: - - name: '${SOURCE_ARCHIVE_NAME}' - url: 'https://git.gfz-potsdam.de/naaice/poet/-/jobs/${ARCHIVE_JOB_ID}/artifacts/file/${SOURCE_ARCHIVE_NAME}' - pages: stage: release before_script: @@ -113,4 +63,57 @@ pages: paths: - public rules: - - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG + +#archive-sources: # This job runs in the build stage, which runs first. +# image: python:3 +# stage: release +# +# before_script: +# - pip install git-archive-all +# - echo ARCHIVE_JOB_ID=${CI_JOB_ID} >> archives.env +# script: +# - git-archive-all ${SOURCE_ARCHIVE_NAME} +# artifacts: +# paths: +# - ${SOURCE_ARCHIVE_NAME} +# expire_in: never +# reports: +# dotenv: archives.env +# rules: +# - if: $CI_COMMIT_TAG + +#release-description: +# image: golang:bullseye +# stage: release +# rules: +# - if: $CI_COMMIT_TAG +# before_script: +# - go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.2 +# script: +# - git-chglog -o ${CHANGELOG_FILE} ${CI_COMMIT_TAG} +# artifacts: +# paths: +# - ${CHANGELOG_FILE} +# +# +#release-create: +# stage: release +# image: registry.gitlab.com/gitlab-org/release-cli:latest +# rules: +# - if: $CI_COMMIT_TAG +# script: +# - echo "Running release job" +# needs: +# - job: archive-sources +# artifacts: true +# - job: release-description +# artifacts: true +# release: +# tag_name: $CI_COMMIT_TAG +# name: 'POET $CI_COMMIT_TAG' +# description: ${CHANGELOG_FILE} +# assets: +# links: +# - name: '${SOURCE_ARCHIVE_NAME}' +# url: 'https://git.gfz-potsdam.de/naaice/poet/-/jobs/${ARCHIVE_JOB_ID}/artifacts/file/${SOURCE_ARCHIVE_NAME}'