build(ci): skip tests on CI when only markdown files have changed (#4452)

Skip e2e and unit tests for Push/PR build
This commit is contained in:
Zhoucheng Li
2017-05-23 13:54:55 -07:00
committed by tinayuangao
parent 13524c14d1
commit aee42aebb7
2 changed files with 19 additions and 2 deletions
+14 -1
View File
@@ -10,6 +10,19 @@ cd $(dirname $0)/../..
source scripts/ci/sources/mode.sh
source scripts/ci/sources/tunnel.sh
# Get commit diff
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
fileDiff=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
else
fileDiff=$(git diff --name-only $TRAVIS_BRANCH...HEAD)
fi
# Check if tests can be skipped
if [[ ${fileDiff} =~ ^(.*\.md\s*)*$ ]] && (is_e2e || is_unit); then
echo "Skipping e2e and unit tests since only markdown files changed"
exit 0
fi
start_tunnel
wait_for_tunnel
@@ -23,7 +36,7 @@ elif is_payload; then
$(npm bin)/gulp ci:payload
elif is_closure_compiler; then
./scripts/closure-compiler/build-devapp-bundle.sh
else
elif is_unit; then
$(npm bin)/gulp ci:test
fi
+5 -1
View File
@@ -19,4 +19,8 @@ is_closure_compiler() {
is_payload() {
[[ "$MODE" = payload ]]
}
}
is_unit() {
[[ "$MODE" = saucelabs_required || "$MODE" = browserstack_required ]]
}