Commit 9e5b0739 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ci] avoid pipeline fail if dumux folder exists

parent cc78c503
Pipeline #7062 failed with stage
...@@ -13,6 +13,7 @@ workflow: ...@@ -13,6 +13,7 @@ workflow:
# variables that may be overwritten by the trigger # variables that may be overwritten by the trigger
variables: variables:
DUMUX_REPO: "https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git" DUMUX_REPO: "https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git"
DUMUX_FOLDER: "dumux"
MR_TARGET_BRANCH_NAME: "" MR_TARGET_BRANCH_NAME: ""
DUMUX_MR_SOURCE_BRANCH: "" DUMUX_MR_SOURCE_BRANCH: ""
DUMUX_MR_TARGET_BRANCH: "" DUMUX_MR_TARGET_BRANCH: ""
...@@ -23,20 +24,21 @@ select tests: ...@@ -23,20 +24,21 @@ select tests:
stage: configure stage: configure
before_script: before_script:
- | - |
if [ ! -d $DUMUX_FOLDER ]; then
git clone -b master --depth 1 $DUMUX_REPO $DUMUX_FOLDER
fi
if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then
echo "Fetching upstream branches related to merge request." echo "Fetching upstream branches related to merge request."
echo "Source branch: $DUMUX_MR_SOURCE_BRANCH" echo "Source branch: $DUMUX_MR_SOURCE_BRANCH"
echo "Target branch: $DUMUX_MR_TARGET_BRANCH" echo "Target branch: $DUMUX_MR_TARGET_BRANCH"
git clone -b ${DUMUX_MR_SOURCE_BRANCH} --depth 1 $DUMUX_REPO pushd $DUMUX_FOLDER
pushd dumux
git fetch --depth=1 origin ${DUMUX_MR_TARGET_BRANCH}:${DUMUX_MR_TARGET_BRANCH} git fetch --depth=1 origin ${DUMUX_MR_TARGET_BRANCH}:${DUMUX_MR_TARGET_BRANCH}
popd popd
else else
git clone -b master --depth 1 $DUMUX_REPO pushd $DUMUX_FOLDER
pushd dumux
if [[ -n "$DUMUX_TRIGGER_COMMIT_SHA" ]]; then if [[ -n "$DUMUX_TRIGGER_COMMIT_SHA" ]]; then
echo "Fetching upstream commit $DUMUX_TRIGGER_COMMIT_SHA" echo "Fetching upstream commit $DUMUX_TRIGGER_COMMIT_SHA"
git fetch --depth=1 origin ${DUMUX_TRIGGER_COMMIT_SHA} git fetch --depth=1 origin ${DUMUX_TRIGGER_COMMIT_SHA}
...@@ -54,11 +56,11 @@ select tests: ...@@ -54,11 +56,11 @@ select tests:
- dunecontrol --opts=$DUNE_OPTS_FILE --current all - dunecontrol --opts=$DUNE_OPTS_FILE --current all
- | - |
if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then
CHECK_FOLDER="dumux" CHECK_FOLDER=$DUMUX_FOLDER
SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH
TARGET_TREE=$DUMUX_MR_TARGET_BRANCH TARGET_TREE=$DUMUX_MR_TARGET_BRANCH
elif [[ -n "$DUMUX_TRIGGER_REF_SHA" ]]; then elif [[ -n "$DUMUX_TRIGGER_REF_SHA" ]]; then
CHECK_FOLDER="dumux" CHECK_FOLDER=$DUMUX_FOLDER
SOURCE_TREE=$DUMUX_TRIGGER_COMMIT_SHA SOURCE_TREE=$DUMUX_TRIGGER_COMMIT_SHA
TARGET_TREE=$DUMUX_TRIGGER_REF_SHA TARGET_TREE=$DUMUX_TRIGGER_REF_SHA
elif [[ -n "$MR_TARGET_BRANCH_NAME" ]]; then elif [[ -n "$MR_TARGET_BRANCH_NAME" ]]; then
...@@ -70,20 +72,20 @@ select tests: ...@@ -70,20 +72,20 @@ select tests:
if [[ -n "$SOURCE_TREE" ]]; then if [[ -n "$SOURCE_TREE" ]]; then
echo "Detecting tests affected by changes in folder $CHECK_FOLDER," echo "Detecting tests affected by changes in folder $CHECK_FOLDER,"
echo "using source/target trees: $SOURCE_TREE / $TARGET_TREE" echo "using source/target trees: $SOURCE_TREE / $TARGET_TREE"
python3 dumux/bin/testing/getchangedfiles.py --folder $CHECK_FOLDER \ python3 $DUMUX_FOLDER/bin/testing/getchangedfiles.py --folder $CHECK_FOLDER \
--source-tree $SOURCE_TREE \ --source-tree $SOURCE_TREE \
--target-tree $TARGET_TREE \ --target-tree $TARGET_TREE \
--outfile changedfiles.txt --outfile changedfiles.txt
python3 dumux/bin/testing/findtests.py --outfile affectedtests.json \ python3 $DUMUX_FOLDER/bin/testing/findtests.py --outfile affectedtests.json \
--file-list changedfiles.txt \ --file-list changedfiles.txt \
--build-dir build-cmake --build-dir build-cmake
else else
echo "Skipping test selection, build/test stages will consider all tests!" echo "Skipping test selection, build/test stages will consider all tests!"
touch affectedtests.json touch affectedtests.json
fi fi
artifacts: artifacts:
paths: paths:
- dumux - $DUMUX_FOLDER
- build-cmake - build-cmake
- affectedtests.json - affectedtests.json
expire_in: 3 hours expire_in: 3 hours
...@@ -95,15 +97,15 @@ build lecture: ...@@ -95,15 +97,15 @@ build lecture:
pushd build-cmake pushd build-cmake
make clean make clean
if [ -s ../affectedtests.json ]; then if [ -s ../affectedtests.json ]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -b python3 ../$DUMUX_FOLDER/bin/testing/runselectedtests.py -c ../affectedtests.json -b
else else
python3 ../dumux/bin/testing/runselectedtests.py --all -b python3 ../$DUMUX_FOLDER/bin/testing/runselectedtests.py --all -b
fi fi
popd popd
artifacts: artifacts:
paths: paths:
- build-cmake - build-cmake
- dumux - $DUMUX_FOLDER
- affectedtests.json - affectedtests.json
expire_in: 3 hours expire_in: 3 hours
...@@ -116,9 +118,9 @@ test lecture: ...@@ -116,9 +118,9 @@ test lecture:
- | - |
pushd build-cmake pushd build-cmake
if [ -s ../affectedtests.json ]; then if [ -s ../affectedtests.json ]; then
python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -t python3 ../$DUMUX_FOLDER/bin/testing/runselectedtests.py -c ../affectedtests.json -t
else else
python3 ../dumux/bin/testing/runselectedtests.py --all -t python3 ../$DUMUX_FOLDER/bin/testing/runselectedtests.py --all -t
fi fi
popd popd
needs: needs:
......
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