diff --git a/scripts/ci/build-and-test.sh b/scripts/ci/build-and-test.sh index 7f4cfff8b5d9..e5f343c42700 100755 --- a/scripts/ci/build-and-test.sh +++ b/scripts/ci/build-and-test.sh @@ -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 diff --git a/scripts/ci/sources/mode.sh b/scripts/ci/sources/mode.sh index 909877718251..d37725919d95 100644 --- a/scripts/ci/sources/mode.sh +++ b/scripts/ci/sources/mode.sh @@ -19,4 +19,8 @@ is_closure_compiler() { is_payload() { [[ "$MODE" = payload ]] -} \ No newline at end of file +} + +is_unit() { + [[ "$MODE" = saucelabs_required || "$MODE" = browserstack_required ]] +}