Files
angular__angular/scripts/ci/travis-testing.sh
T
Paul Gschwendtner 34306ad0f9 ci: skip more tasks if only markdown files changed (#8096)
* No longer just skips the unit test and e2e tasks if only markdown files changed. Now everything will be skipped, since there is nothing that tests against the `.md` files.
* Prints messages for the deploy tasks that run inside of Pull Requests but end up in a NOOP.
2017-10-30 14:33:13 -07:00

58 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Script that runs in the testing build stage of Travis and is responsible for testing
# the project in different Travis jobs of the current build stage.
# The script should immediately exit if any command in the script fails.
set -e
echo ""
echo "Building sources and running tests. Running mode: ${MODE}"
echo ""
# Go to project dir
cd $(dirname $0)/../..
# Include sources.
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*)*$ ]]; then
echo "Skipping tests since only markdown files changed."
exit 0
fi
start_tunnel
wait_for_tunnel
if is_lint; then
$(npm bin)/gulp ci:lint
elif is_e2e; then
$(npm bin)/gulp ci:e2e
elif is_aot; then
$(npm bin)/gulp ci:aot
elif is_payload; then
$(npm bin)/gulp ci:payload
elif is_closure_compiler; then
./scripts/closure-compiler/build-devapp-bundle.sh
elif is_unit; then
$(npm bin)/gulp ci:test
elif is_prerender; then
$(npm bin)/gulp ci:prerender
fi
# Upload coverage results if those are present.
if [ -f dist/coverage/coverage-summary.json ]; then
$(npm bin)/gulp ci:coverage
fi
teardown_tunnel