From a9389edcc65c8f431a1327f18072bf4dab92200c Mon Sep 17 00:00:00 2001 From: Timo Koch <timokoch@math.uio.no> Date: Thu, 26 Aug 2021 22:16:04 +0000 Subject: [PATCH] [ci] Add test selection for Python tests --- .gitlab-ci/default.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml index 4ae49f61a7..a01fd7dc4f 100644 --- a/.gitlab-ci/default.yml +++ b/.gitlab-ci/default.yml @@ -81,10 +81,12 @@ select tests: echo "No reference information given." echo "Skipping test selection, build/test stages will consider all tests!" touch affectedtests.json + touch changedfiles.txt fi artifacts: paths: - affectedtests.json + - changedfiles.txt expire_in: 3 hours needs: - job: configure @@ -145,9 +147,21 @@ test python: script: - source bin/testing/ci-setup-python-env.sh - | - pushd build-cmake - ctest --output-on-failure -L python - popd + if ([ ! -s changedfiles.txt ] || grep -q python "changedfiles.txt"); then + if [ ! -s changedfiles.txt ]; then + echo "Skipping test selection: considering all Python tests." + else + echo "Detected changes in the Python bindings/Python code: considering all Python tests." + fi + source bin/testing/ci-setup-python-env.sh + pushd build-cmake + ctest --output-on-failure -L python + popd + else + echo "No changes in the Python bindings/Python code detected: skipping tests." + fi needs: - job: configure artifacts: true + - job: select tests + artifacts: true -- GitLab