Skip to content
Snippets Groups Projects

Feature/ci-integration

Merged Dennis Gläser requested to merge feature/test-dumux-trigger into master
22 files
+ 163
23
Compare changes
  • Side-by-side
  • Inline
Files
22
+ 109
0
default:
image: $IMAGE
stages:
- configure
- build
- test
workflow:
rules:
- if: $CI_PIPELINE_SOURCE=="parent_pipeline"
# variables that may be overwritten by the trigger
variables:
TRIGGER_SOURCE: "unknown"
MR_TARGET_BRANCH_NAME: "master"
DUMUX_PIPELINE_SOURCE: "unknown"
DUMUX_MR_SOURCE_BRANCH: "unknown"
DUMUX_MR_TARGET_BRANCH: "unknown"
select tests:
stage: configure
before_script:
- |
if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
echo "Cloning upstream merge request source/target branches ${DUMUX_MR_SOURCE_BRANCH}/${DUMUX_MR_TARGET_BRANCH}"
git clone -b ${DUMUX_MR_SOURCE_BRANCH} --depth=1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
pushd dumux
git fetch --depth=1 origin ${DUMUX_MR_TARGET_BRANCH}:${DUMUX_MR_TARGET_BRANCH}
popd
else
echo "Cloning into Dumux master"
git clone -b master --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
fi
- dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
script:
- dunecontrol --opts=$DUNE_OPTS_FILE --current all
- |
if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
CHECK_FOLDER="dumux"
SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH
TARGET_TREE=$DUMUX_MR_TARGET_BRANCH
elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
CHECK_FOLDER="."
SOURCE_TREE="HEAD"
TARGET_TREE=origin/$MR_TARGET_BRANCH_NAME
fi
- |
if [[ -n "$SOURCE_TREE" ]]; then
echo "Detecting tests affected by changes in folder $CHECK_FOLDER,"
echo "using source/target trees: $SOURCE_TREE / $TARGET_TREE"
python3 dumux/bin/testing/getchangedfiles.py --folder $CHECK_FOLDER \
--source-tree $SOURCE_TREE \
--target-tree $TARGET_TREE \
--outfile changedfiles.txt
python3 dumux/bin/testing/findtests.py --outfile affectedtests.json \
--file-list changedfiles.txt \
--build-dir build-cmake
else
echo "Received trigger source / dumux pipeline source: $TRIGGER_SOURCE / $DUMUX_PIPELINE_SOURCE"
echo "Skipping test selection, build/test stages will consider all tests!"
touch 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 [ -s ../affectedtests.json ]; 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:
- |
pushd build-cmake
if [ -s ../affectedtests.json ]; 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
artifacts:
reports:
junit: junit/dumux-lecture-cmake.xml
Loading