Commit 34294ef2 authored by Dennis Gläser's avatar Dennis Gläser Committed by Dennis
Browse files

[ci] add test selection stage

parent 5d7eff39
...@@ -5,10 +5,9 @@ variables: ...@@ -5,10 +5,9 @@ variables:
IMAGE_REGISTRY_URL: $CI_REGISTRY/dumux-repositories/dumux-docker-ci IMAGE_REGISTRY_URL: $CI_REGISTRY/dumux-repositories/dumux-docker-ci
# rules for the default triggers: # rules for the default triggers:
# - pipelines are triggered for commits to master, tags, merge requests, external triggers # - pipelines are triggered for merge requests and external triggers (e.g. nightly build in dumux)
# - Within merge requests, we require to start the pipeline manually by clicking play for the trigger # - Within merge requests, we require to start the pipeline manually by clicking play for the trigger
# - if the pipeline was triggered externally (from dumux), we expect the variable DUMUX_MERGE_REQUEST_BRANCH # - if the pipeline was triggered externally (from dumux), we accept the variable DUMUX_MERGE_REQUEST_BRANCH
# and pass it to this project's test pipeline as DUMUX_BRANCH variable
.default-trigger: .default-trigger:
stage: trigger pipelines stage: trigger pipelines
trigger: trigger:
...@@ -21,7 +20,7 @@ variables: ...@@ -21,7 +20,7 @@ variables:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual when: manual
variables: variables:
DUMUX_BRANCH: $DUMUX_MERGE_REQUEST_BRANCH DUMUX_MR_BRANCH: $DUMUX_MERGE_REQUEST_BRANCH
full-dune-2.7-gcc: full-dune-2.7-gcc:
extends: .default-trigger extends: .default-trigger
......
...@@ -2,6 +2,7 @@ default: ...@@ -2,6 +2,7 @@ default:
image: $IMAGE image: $IMAGE
stages: stages:
- configure
- build - build
- test - test
...@@ -9,31 +10,68 @@ workflow: ...@@ -9,31 +10,68 @@ workflow:
rules: rules:
- if: $CI_PIPELINE_SOURCE=="parent_pipeline" - if: $CI_PIPELINE_SOURCE=="parent_pipeline"
build lecture: select tests:
stage: build stage: configure
before_script: before_script:
- | - |
if [ ! "${DUMUX_BRANCH}" ]; then DUMUX_CLONE_BRANCH=master
DUMUX_BRANCH=master; if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
else DUMUX_CLONE_BRANCH=${DUMUX_MR_BRANCH}
echo "Received branch name ${DUMUX_BRANCH} from upstream" echo "Received upstream merge request branch ${DUMUX_MR_BRANCH}"
fi fi
- echo "Checking out branch ${DUMUX_BRANCH} in dumux" - echo "Checking out branch ${DUMUX_CLONE_BRANCH} in dumux"
- git clone -b ${DUMUX_BRANCH} --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git - git clone -b ${DUMUX_CLONE_BRANCH} --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
- dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all - dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
script: script:
- dunecontrol --opts=$DUNE_OPTS_FILE --current all - |
- dunecontrol --opts=$DUNE_OPTS_FILE --current bexec make -k -j4 build_tests dunecontrol --opts=$DUNE_OPTS_FILE --current all
if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
python3 dumux/bin/testing/getchangedfiles.py -o changedfiles.txt -t origin/$DUMUX_MR_BRANCH
python3 dumux/bin/testing/findtests.py -o affectedtests.json --file-list changedfiles.txt
else
echo "Skipping test selection, build/test stages will consider all tests!"
echo "{}" >> affectedtests.json
fi
artifacts:
paths:
- dumux
- build-cmake
- affectedtests.json
expire_in: 3 hours
build lecture:
stage: build
script:
- |
pushd build-cmake
make clean
if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -b
else
python3 ../dumux/bin/testing/runselectedtests.py --all -b
fi
popd
artifacts: artifacts:
paths: paths:
- build-cmake - build-cmake
- dumux - dumux
- affectedtests.json
expire_in: 3 hours expire_in: 3 hours
test lecture: test lecture:
stage: test stage: test
variables:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
script: script:
- dunecontrol --opts=$DUNE_OPTS_FILE --current bexec dune-ctest -j4 --output-on-failure - |
pushd build-cmake
if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -t
else
python3 ../dumux/bin/testing/runselectedtests.py --all -t
fi
popd
needs: needs:
- job: build lecture - job: build lecture
artifacts: true artifacts: true
......
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