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:
IMAGE_REGISTRY_URL: $CI_REGISTRY/dumux-repositories/dumux-docker-ci
# 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
# - if the pipeline was triggered externally (from dumux), we expect the variable DUMUX_MERGE_REQUEST_BRANCH
# and pass it to this project's test pipeline as DUMUX_BRANCH variable
# - if the pipeline was triggered externally (from dumux), we accept the variable DUMUX_MERGE_REQUEST_BRANCH
.default-trigger:
stage: trigger pipelines
trigger:
......@@ -21,7 +20,7 @@ variables:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
variables:
DUMUX_BRANCH: $DUMUX_MERGE_REQUEST_BRANCH
DUMUX_MR_BRANCH: $DUMUX_MERGE_REQUEST_BRANCH
full-dune-2.7-gcc:
extends: .default-trigger
......
......@@ -2,6 +2,7 @@ default:
image: $IMAGE
stages:
- configure
- build
- test
......@@ -9,31 +10,68 @@ workflow:
rules:
- if: $CI_PIPELINE_SOURCE=="parent_pipeline"
build lecture:
stage: build
select tests:
stage: configure
before_script:
- |
if [ ! "${DUMUX_BRANCH}" ]; then
DUMUX_BRANCH=master;
else
echo "Received branch name ${DUMUX_BRANCH} from upstream"
DUMUX_CLONE_BRANCH=master
if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
DUMUX_CLONE_BRANCH=${DUMUX_MR_BRANCH}
echo "Received upstream merge request branch ${DUMUX_MR_BRANCH}"
fi
- echo "Checking out branch ${DUMUX_BRANCH} in dumux"
- git clone -b ${DUMUX_BRANCH} --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
- echo "Checking out branch ${DUMUX_CLONE_BRANCH} in dumux"
- 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
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:
paths:
- build-cmake
- dumux
- affectedtests.json
expire_in: 3 hours
test lecture:
stage: test
variables:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
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:
- job: build lecture
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