From: Tim Date: Sat, 15 Oct 2016 15:59:23 +0000 (+0200) Subject: Travis: Only trigger a compile, when C/C++ related files were touched (#4284) X-Git-Tag: 0.4.15~173 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=adad6e0a1c2bb6cd5e56db26d660fa9342cf0d0e;p=oweals%2Fminetest.git Travis: Only trigger a compile, when C/C++ related files were touched (#4284) --- diff --git a/util/travis/before_install.sh b/util/travis/before_install.sh index d25614edb..891371984 100755 --- a/util/travis/before_install.sh +++ b/util/travis/before_install.sh @@ -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 index 000000000..16c7db324 --- /dev/null +++ b/util/travis/common.sh @@ -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)" +} diff --git a/util/travis/script.sh b/util/travis/script.sh index 4f37d8f5a..1bafb26cd 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -1,4 +1,7 @@ #!/bin/bash -e +. util/travis/common.sh + +needs_compile || exit 0 if [[ $PLATFORM == "Unix" ]]; then mkdir -p travisbuild