Commit b70775ff authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ci] add rules when to trigger pipelines

parent 11a7320f
Pipeline #2529 passed with stages
in 16 minutes and 19 seconds
image: git.iws.uni-stuttgart.de:4567/emmert/dumux-ci:latest
stages:
- build
- test
# Variables common to both build and test stages. We define the module
# name, module folder and build directory name. Here, we would actually
# only need the module name (module folder and build dir default to module
# name and "build", respectively), but we specify all variables in order for
# them to be used. Module folder is necessary when it does not match the
# module name (should rarely happen). Build folder name can be useful when
# several configurations (e.g. compilers) are built in parallel in different
# jobs, each defining a different build folder name as artifacts, which can
# then be passed selectively to subsequent (dependent) test jobs
.lecturecommon:
image: git.iws.uni-stuttgart.de:4567/emmert/dumux-ci:latest
# Variables common to both build and test stages. We define the module
# name, module folder and build directory name. Here, we would actually
# only need the module name (module folder and build dir default to module
# name and "build", respectively), but we specify all variables in order for
# their existance & usage to be shown here. Module folder is necessary when
# the folder name does not match the module name (should rarely happen). Build
# folder name can be useful when several configurations (e.g. compilers) are
# built in parallel in different jobs, each defining a different build folder
# name as artifacts, which can then be passed selectively to subsequent
# (dependent) test jobs
variables:
DUMUX_MODULE_NAME: dumux-lecture
DUMUX_MODULE_FOLDER: dumux-lecture
DUMUX_MODULE_BUILDDIR: build
# Notes on the used 'rules': we want the pipeline to be automatically started only
# if commits to master happen, or if it was triggered externally. For merge
# requests, the pipeline has to be triggered manually. Inheritance of arrays does
# not work, so in order to add the "manual" keyword to the build step, we must
# state the rules in both jobs (build&test). It is important that 'build tests'
# and 'run tests' jobs are created in the same situations. So, when editing the
# rules of one of them, make sure to edit the other as well!
build tests:
extends: .lecturecommon
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE=="pipeline"
- if: $CI_MERGE_REQUEST_IID
when: manual
stage: build
script: build_module.sh
artifacts:
......@@ -30,6 +42,10 @@ build tests:
run tests:
extends: .lecturecommon
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE=="pipeline"
- if: $CI_MERGE_REQUEST_IID
stage: test
script: test_module.sh
needs:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment