From 50fce7f255fa39c90239c6406f9c6b3ca2050114 Mon Sep 17 00:00:00 2001 From: zvecr Date: Fri, 19 Apr 2019 21:20:02 +0100 Subject: Travis CI - skip unit tests for documentation changes (#5267) * Add script to skip tests on non master branches with only docs changes * Review comments - Use 'grep -c' instead of 'wc -l' --- util/travis_test.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 util/travis_test.sh (limited to 'util') diff --git a/util/travis_test.sh b/util/travis_test.sh new file mode 100644 index 0000000000..6c48f898ce --- /dev/null +++ b/util/travis_test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" +TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" + +# test force push +#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" + +NUM_IMPACTING_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ecv '^(docs/)') +BRANCH=$(git rev-parse --abbrev-ref HEAD) + +if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then + echo "Skipping due to commit message" + exit 0 +fi + +if [ "$BRANCH" != "master" ] && [ "$NUM_IMPACTING_CHANGES" == "0" ]; then + echo "Skipping due to changes not impacting tests" + exit 0 +fi + +make test:all -- cgit v1.2.3