mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-15 12:28:22 +01:00
122 lines
3.4 KiB
YAML
122 lines
3.4 KiB
YAML
# This file is a template, and might need editing before it works on your project.
|
|
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
|
|
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
|
|
# it uses echo commands to simulate the pipeline execution.
|
|
#
|
|
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
|
|
# Stages run in sequential order, but jobs within stages run in parallel.
|
|
#
|
|
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
|
|
#
|
|
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
|
|
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
|
|
#
|
|
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
# This specific template is located at:
|
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
|
|
|
|
image: git.gfz-potsdam.de:5000/naaice/poet:ci
|
|
|
|
stages: # List of stages for jobs, and their order of execution
|
|
- build
|
|
- release
|
|
- test
|
|
|
|
variables:
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
SOURCE_ARCHIVE_NAME: 'poet_${CI_COMMIT_TAG}_sources.tar.gz'
|
|
CHANGELOG_FILE: 'commit_changelog.md'
|
|
|
|
build-poet: # This job runs in the build stage, which runs first.
|
|
stage: build
|
|
script:
|
|
- mkdir build && cd build
|
|
- cmake -DPOET_ENABLE_TESTING=ON ..
|
|
- make -j$(nproc)
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
artifacts:
|
|
paths:
|
|
- build
|
|
|
|
test-poet:
|
|
stage: test
|
|
dependencies:
|
|
- build-poet
|
|
script:
|
|
- cd build
|
|
- make -j$(nproc) check
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
|
|
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
|
|
dependencies:
|
|
- build-poet
|
|
before_script:
|
|
- apt-get update && apt-get install -y doxygen graphviz
|
|
- mkdir public
|
|
script:
|
|
- pushd build
|
|
- make doxygen
|
|
- popd && mv build/docs/html/* public/
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
rules:
|
|
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|