Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux-lecture
Commits
8f2b4fe9
Commit
8f2b4fe9
authored
May 20, 2021
by
Dennis Gläser
Committed by
Dennis
May 25, 2021
Browse files
[ci] receive dumux mr info from upstream
parent
49ccd33c
Changes
2
Show whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
8f2b4fe9
...
...
@@ -7,7 +7,7 @@ variables:
# 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
accept the variable DUMUX_MERGE_REQUEST_BRANCH
# - if the pipeline was triggered externally (from dumux), we
may receive merge-request-related variables
.default-trigger
:
stage
:
trigger pipelines
trigger
:
...
...
@@ -15,14 +15,15 @@ variables:
-
local
:
.gitlab-ci/default.yml
strategy
:
depend
rules
:
-
if
:
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
-
if
:
$CI_PIPELINE_SOURCE == "pipeline"
-
if
:
$CI_PIPELINE_SOURCE == "merge_request_event"
when
:
manual
variables
:
DUMUX_MR_BRANCH
:
$DUMUX_MERGE_REQUEST_BRANCH
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
...
...
.gitlab-ci/default.yml
View file @
8f2b4fe9
...
...
@@ -10,36 +10,54 @@ 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
:
-
|
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}"
if [[ -n "${DUMUX_MR_
SOURCE_
BRANCH}" ]]; then
DUMUX_CLONE_BRANCH=${DUMUX_MR_
SOURCE_
BRANCH}
echo "Received upstream merge request branch ${DUMUX_MR_
SOURCE_
BRANCH}"
fi
-
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 all
if [[
-n
"$
{
DUMUX_
MR_BRANCH}
" ]]; then
echo "Detecting test affected by changes in D
umux"
python3 dumux/bin/testing/getchangedfiles.py -f dumux -o changedfiles.txt -t
origin/$DUMUX_MR_BRANCH
python3 dumux/bin/testing/findtests.py -o affectedtests.json --file-list changedfiles.txt --build-dir build-cmake
echo "Check if tests affected by changes have to be identified"
if [[ "$DUMUX_
PIPELINE_SOURCE" == "merge_request_event
" ]]; then
CHECK_FOLDER="d
umux"
SOURCE_TREE=
origin/$DUMUX_MR_
SOURCE_
BRANCH
TARGET_TREE=origin/$DUMUX_MR_TARGET_BRANCH
elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
echo "Detecting test affected by changes in this merge request, using target branch $MR_TARGET_BRANCH_NAME"
python3 dumux/bin/testing/getchangedfiles.py -o changedfiles.txt -t origin/$MR_TARGET_BRANCH_NAME
python3 dumux/bin/testing/findtests.py -o affectedtests.json --file-list changedfiles.txt --build-dir build-cmake
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!"
echo "{}" >>
affectedtests.json
touch
affectedtests.json
fi
artifacts
:
paths
:
...
...
@@ -54,7 +72,7 @@ build lecture:
-
|
pushd build-cmake
make clean
if [
[
-
n "${DUMUX_MR_BRANCH}" ]
]; then
if [ -
s ../affectedtests.json
]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -b
else
python3 ../dumux/bin/testing/runselectedtests.py --all -b
...
...
@@ -75,7 +93,7 @@ test lecture:
script
:
-
|
pushd build-cmake
if [
[
-
n "${DUMUX_MR_BRANCH}" ]
]; then
if [ -
s ../affectedtests.json
]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -t
else
python3 ../dumux/bin/testing/runselectedtests.py --all -t
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment