2017-05-25 22:37:24 +02:00
|
|
|
#!/bin/bash
|
2016-01-08 15:42:23 -08:00
|
|
|
|
2017-07-10 20:38:09 +02:00
|
|
|
# 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.
|
|
|
|
|
|
2017-06-29 19:32:00 +02:00
|
|
|
# The script should immediately exit if any command in the script fails.
|
2017-05-25 22:37:24 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Building sources and running tests. Running mode: ${MODE}"
|
|
|
|
|
echo ""
|
2016-01-08 15:42:23 -08:00
|
|
|
|
|
|
|
|
# Go to project dir
|
2016-01-29 14:01:19 -08:00
|
|
|
cd $(dirname $0)/../..
|
2016-01-08 15:42:23 -08:00
|
|
|
|
2016-01-29 14:01:19 -08:00
|
|
|
# Include sources.
|
|
|
|
|
source scripts/ci/sources/mode.sh
|
|
|
|
|
source scripts/ci/sources/tunnel.sh
|
2016-01-14 11:29:50 -08:00
|
|
|
|
2018-02-13 16:52:19 +01:00
|
|
|
# Get the commit diff and skip the build if only .md files have changed.
|
|
|
|
|
# Should not apply to master builds.
|
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then
|
2017-05-23 13:54:55 -07:00
|
|
|
fileDiff=$(git diff --name-only $TRAVIS_BRANCH...HEAD)
|
|
|
|
|
|
2018-02-13 16:52:19 +01:00
|
|
|
if [[ ${fileDiff} =~ ^(.*\.md\s*)*$ ]]; then
|
|
|
|
|
echo "Skipping tests because only markdown files changed."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2017-05-23 13:54:55 -07:00
|
|
|
fi
|
|
|
|
|
|
2016-01-14 11:29:50 -08:00
|
|
|
start_tunnel
|
2016-01-29 14:01:19 -08:00
|
|
|
wait_for_tunnel
|
2017-03-09 03:09:57 +01:00
|
|
|
|
2016-04-03 14:23:17 -07:00
|
|
|
if is_lint; then
|
2016-08-19 10:59:45 -07:00
|
|
|
$(npm bin)/gulp ci:lint
|
2016-04-03 14:23:17 -07:00
|
|
|
elif is_e2e; then
|
2018-08-16 22:54:59 +02:00
|
|
|
# Run e2e tests inside of Xvfb because we need to test the HTML Fullscreen API's that cannot
|
|
|
|
|
# be tested within Chrome headless.
|
|
|
|
|
xvfb-run -a --server-args='-screen 0, 1024x768x16' $(npm bin)/gulp ci:e2e
|
2017-01-03 18:27:24 +01:00
|
|
|
elif is_aot; then
|
|
|
|
|
$(npm bin)/gulp ci:aot
|
2017-05-23 13:54:55 -07:00
|
|
|
elif is_unit; then
|
2016-08-19 10:59:45 -07:00
|
|
|
$(npm bin)/gulp ci:test
|
2017-05-25 16:51:11 -07:00
|
|
|
elif is_prerender; then
|
2017-05-30 18:22:18 +02:00
|
|
|
$(npm bin)/gulp ci:prerender
|
2016-01-29 14:01:19 -08:00
|
|
|
fi
|
2017-03-09 03:09:57 +01:00
|
|
|
|
2016-01-14 11:29:50 -08:00
|
|
|
teardown_tunnel
|