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

Merge branch 'feature/test-dumux-trigger' into 'master'

Feature/ci-integration

Closes #26

See merge request !146
parents 41abd4ab d1b0957b
Pipeline #4846 passed with stage
stages:
- trigger pipelines
variables:
IMAGE_REGISTRY_URL: $CI_REGISTRY/dumux-repositories/dumux-docker-ci
# rules for the default 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 may receive merge-request-related variables
.default-trigger:
stage: trigger pipelines
trigger:
include:
- local: .gitlab-ci/default.yml
strategy: depend
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
variables:
TRIGGER_SOURCE: $CI_PIPELINE_SOURCE
MR_TARGET_BRANCH_NAME: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
DUMUX_PIPELINE_SOURCE: $DUMUX_PIPELINE_SOURCE
DUMUX_MR_SOURCE_BRANCH: $DUMUX_MERGE_REQUEST_SOURCE_BRANCH
DUMUX_MR_TARGET_BRANCH: $DUMUX_MERGE_REQUEST_TARGET_BRANCH
full-dune-2.7-gcc:
extends: .default-trigger
variables:
IMAGE: $IMAGE_REGISTRY_URL/full:dune-2.7-gcc-ubuntu-20.04
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
add_input_file_links()
dune_add_test(NAME lens2pexercise3
dumux_add_test(NAME lens2pexercise3
SOURCES lens2pexercise3.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......@@ -8,7 +8,7 @@ dune_add_test(NAME lens2pexercise3
${CMAKE_CURRENT_BINARY_DIR}/lens-2p-00011.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/lens2pexercise3 -ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/exercise3.input -Problem.Name lens-2p")
dune_add_test(NAME lens2p2cexercise3
dumux_add_test(NAME lens2p2cexercise3
SOURCES lens2p2cexercise3.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......@@ -16,7 +16,7 @@ dune_add_test(NAME lens2p2cexercise3
${CMAKE_CURRENT_BINARY_DIR}/lens-2p2c-00011.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/lens2p2cexercise3 -ParameterFile ${CMAKE_CURRENT_SOURCE_DIR}/exercise3.input -Problem.Name lens-2p2c")
dune_add_test(NAME lens1p2cexercise3
dumux_add_test(NAME lens1p2cexercise3
SOURCES lens1p2cexercise3.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME lens1p2cexercise1
dumux_add_test(NAME lens1p2cexercise1
SOURCES lens1p2cexercise1.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......@@ -9,7 +9,7 @@ dune_add_test(NAME lens1p2cexercise1
--command "${CMAKE_CURRENT_BINARY_DIR}/lens1p2cexercise1 ${CMAKE_CURRENT_SOURCE_DIR}/exercise1.input -Problem.Name lens-1p2c"
--zeroThreshold {"x^N2_liq":1e-18,"X^N2_liq":1e-18})
dune_add_test(NAME lens2pexercise1
dumux_add_test(NAME lens2pexercise1
SOURCES lens2pexercise1.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME lens2pexercise2
dumux_add_test(NAME lens2pexercise2
SOURCES lens2pexercise2.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME groundwater
dumux_add_test(NAME groundwater
SOURCES groundwater.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME buckleyleverettexercise
dumux_add_test(NAME buckleyleverettexercise
SOURCES buckleyleverettexercise.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME co2plumeshapeexercise
dumux_add_test(NAME co2plumeshapeexercise
SOURCES co2plumeshapeexercise.cc
COMPILE_DEFINITIONS TYPETAG=PlumeShapeBoxTypeTag
TIMEOUT 1800
......
add_input_file_links()
dune_symlink_to_source_files(FILES grids)
dune_add_test(NAME columnxyleneexercise
dumux_add_test(NAME columnxyleneexercise
SOURCES columnxyleneexercise.cc
COMPILE_DEFINITIONS TYPETAG=ColumnProblemBoxTypeTag
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
......
add_input_file_links()
dune_add_test(COMPILE_ONLY # the test produces different results due to the fingers on different machines
dumux_add_test(COMPILE_ONLY # the test produces different results due to the fingers on different machines
NAME convmixexercise
SOURCES convmixexercise.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
......
dune_symlink_to_source_files(FILES "grids" "fracture_exercise.input" "plot.p")
# test for the exercise
dune_add_test(NAME fracture_exercise
dumux_add_test(NAME fracture_exercise
CMAKE_GUARD "( dune-foamgrid_FOUND AND dune-alugrid_FOUND )"
SOURCES fractures.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
......
add_input_file_links()
dune_add_test(NAME fuelcell
dumux_add_test(NAME fuelcell
TIMEOUT 1800
SOURCES fuelcell.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
......
add_input_file_links()
dune_symlink_to_source_files(FILES grids)
dune_add_test(NAME heatpipe
dumux_add_test(NAME heatpipe
SOURCES heatpipe.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME sagd
dumux_add_test(NAME sagd
SOURCES sagd.cc
TIMEOUT 1800
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/sagd
......
add_input_file_links()
dune_add_test(NAME sagd_cyclic
dumux_add_test(NAME sagd_cyclic
SOURCES sagd_cyclic.cc
TIMEOUT 1800
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic
......
add_input_file_links()
dune_add_test(NAME sagd_cyclic_hyst
dumux_add_test(NAME sagd_cyclic_hyst
SOURCES sagd_cyclic_hyst.cc
TIMEOUT 1800
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic_hyst
......
add_input_file_links()
dune_symlink_to_source_files(FILES grids)
dune_add_test(NAME henry1p2c
dumux_add_test(NAME henry1p2c
SOURCES henry1p2c.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_symlink_to_source_files(FILES grids)
dune_add_test(NAME henry2p
dumux_add_test(NAME henry2p
SOURCES henry2p.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
dune_add_test(NAME mcwhorterexercise
dumux_add_test(NAME mcwhorterexercise
SOURCES mcwhorterexercise.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
add_input_file_links()
# for the test only simulate one week
dune_add_test(NAME naplinfiltration3p
dumux_add_test(NAME naplinfiltration3p
SOURCES naplinfiltration3p.cc
COMMAND ${dumux_INCLUDE_DIRS}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
......
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