Travis: Only trigger a compile, when C/C++ related files were touched (#4284)
authorTim <t4im@users.noreply.github.com>
Sat, 15 Oct 2016 15:59:23 +0000 (17:59 +0200)
committerest31 <est31@users.noreply.github.com>
Sat, 15 Oct 2016 15:59:23 +0000 (17:59 +0200)
util/travis/before_install.sh
util/travis/common.sh [new file with mode: 0644]
util/travis/script.sh

index d25614edb2f4a2f9d3b3bf794b251fdb7722e7fb..89137198451ff493bf2a15f37b50efaadd731d18 100755 (executable)
@@ -1,4 +1,8 @@
 #!/bin/bash -e
+echo "Preparing for $TRAVIS_COMMIT_RANGE"
+. util/travis/common.sh
+
+needs_compile || exit 0
 
 if [[ $TRAVIS_OS_NAME == "linux" ]]; then
        sudo apt-get update
diff --git a/util/travis/common.sh b/util/travis/common.sh
new file mode 100644 (file)
index 0000000..16c7db3
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# Relative to git-repository root:
+TRIGGER_COMPILE_PATHS="src/|CMakeLists.txt|cmake/Modules/|util/travis/|util/buildbot/"
+
+needs_compile() {
+       git diff --name-only $TRAVIS_COMMIT_RANGE | egrep -q "^($TRIGGER_COMPILE_PATHS)"
+}
index 4f37d8f5aec94c97c4f62ff58f195a53b290327f..1bafb26cdab56478bdf81f64c547cb32d74e28b3 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash -e
+. util/travis/common.sh
+
+needs_compile || exit 0
 
 if [[ $PLATFORM == "Unix" ]]; then
        mkdir -p travisbuild