diff options
author | zvecr <git@zvecr.com> | 2019-04-19 22:20:02 +0200 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-04-19 22:20:02 +0200 |
commit | 50fce7f255fa39c90239c6406f9c6b3ca2050114 (patch) | |
tree | ffaf9a082cb2f8003e4d8e72a1fa912857c298cf | |
parent | b60413af60896a7b9d344f9f3dc61904015cb7ca (diff) | |
download | qmk_firmware-50fce7f255fa39c90239c6406f9c6b3ca2050114.tar.gz qmk_firmware-50fce7f255fa39c90239c6406f9c6b3ca2050114.tar.xz |
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'
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | util/travis_test.sh | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index 261e21dc7..a50b205ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: - avr-gcc --version script: - git rev-parse --short HEAD -- make test:all +- bash util/travis_test.sh - bash util/travis_build.sh - bash util/travis_docs.sh addons: diff --git a/util/travis_test.sh b/util/travis_test.sh new file mode 100644 index 000000000..6c48f898c --- /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 |