Merge branch 'ml/ci' into 'main'

Refactor CI/CD pipeline

See merge request naaice/poet!28
This commit is contained in:
Max Lübke 2024-05-06 13:17:40 +02:00
commit 22458b41f4

View File

@ -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}'