mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-25 10:44:59 +06:00
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'
This commit is contained in:
parent
b60413af60
commit
50fce7f255
@ -21,7 +21,7 @@ before_script:
|
|||||||
- avr-gcc --version
|
- avr-gcc --version
|
||||||
script:
|
script:
|
||||||
- git rev-parse --short HEAD
|
- git rev-parse --short HEAD
|
||||||
- make test:all
|
- bash util/travis_test.sh
|
||||||
- bash util/travis_build.sh
|
- bash util/travis_build.sh
|
||||||
- bash util/travis_docs.sh
|
- bash util/travis_docs.sh
|
||||||
addons:
|
addons:
|
||||||
|
22
util/travis_test.sh
Normal file
22
util/travis_test.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user