ci: Skip cppyy job if no source code is changed
This commit is contained in:
@@ -2,6 +2,8 @@ cppyy-22.04:
|
||||
stage: test
|
||||
image: ubuntu:22.04 # python 3.10
|
||||
dependencies: []
|
||||
variables:
|
||||
FILES_CHANGED: git-diff-name-only.txt
|
||||
before_script:
|
||||
- apt update
|
||||
- DEBIAN_FRONTEND=noninteractive apt install -y
|
||||
@@ -11,6 +13,22 @@ cppyy-22.04:
|
||||
git wget
|
||||
- pip install cppyy==3.1.2 matplotlib numpy
|
||||
script:
|
||||
- if (git remote | grep -qw upstream) ; then
|
||||
git remote remove upstream ;
|
||||
fi
|
||||
- git remote add -t $CI_DEFAULT_BRANCH --no-tags -f upstream https://gitlab.com/nsnam/ns-3-dev.git
|
||||
- git diff --name-only upstream/$CI_DEFAULT_BRANCH | tee $FILES_CHANGED
|
||||
|
||||
# Run this job in the following cases: 1) default branch, 2) changes to source code, 3) changes to configurations.
|
||||
# Skip this job in the opposite cases.
|
||||
# File paths generated by git diff are relative to the working tree.
|
||||
- |
|
||||
if [[ $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH ]] &&
|
||||
!(grep -qE ".*\.(cc|h)|CMakeLists.txt|bindings/|build-support/|ns3|utils/tests/.*\.(yaml|yml)" $FILES_CHANGED) ; then
|
||||
echo "No source code or configurations changes found in this MR. Skipping this job.";
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
- ./ns3 configure -G Ninja --enable-python-bindings
|
||||
- ./ns3 build
|
||||
- ./ns3 run first.py
|
||||
|
||||
Reference in New Issue
Block a user