From 1b1c8ee5455f7fdb88aaa93179f65769ab13407d Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Fri, 5 Oct 2018 11:05:47 +0300 Subject: [PATCH] ci(docs-infra): run tests against local Angular packages too (#26202) PR Close #26202 --- .travis.yml | 1 + scripts/ci/build.sh | 30 +++++++++++++++++------------- scripts/ci/install.sh | 2 ++ scripts/ci/test-aio-local.sh | 30 ++++++++++++++++++++++++++++++ scripts/ci/test.sh | 3 +++ 5 files changed, 53 insertions(+), 13 deletions(-) create mode 100755 scripts/ci/test-aio-local.sh diff --git a/.travis.yml b/.travis.yml index bb944e67cf..86ed8d2ba2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,7 @@ env: - CI_MODE=browserstack_optional - CI_MODE=aio_tools_test - CI_MODE=aio + - CI_MODE=aio_local - CI_MODE=aio_e2e AIO_SHARD=0 - CI_MODE=aio_e2e AIO_SHARD=1 diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 2a6b738cdf..706967d3a2 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -19,27 +19,31 @@ if [[ ${CI_MODE:-} == "bazel" || ${CI_MODE:-} == "docs_test" ]]; then exit 0; fi -# Build angular.io, then exit (no Angular build required) -if [[ ${CI_MODE:-} == "aio" ]]; then +# Build the Angular packages +if [[ ${CI_MODE:-} == "aio_local" || ${CI_MODE:-} == "aio_e2e" || ${CI_MODE:-} == "aio_tools_test" ]]; then + travisFoldStart "build.packages.$CI_MODE" + ( + ./build.sh --examples=false + ) + travisFoldEnd "build.packages.$CI_MODE" + + # Exit if no further build required + if [[ ${CI_MODE:-} == "aio_e2e" || ${CI_MODE:-} == "aio_tools_test" ]]; then + exit 0; + fi +fi + +# Build angular.io, then exit (no further build required) +if [[ ${CI_MODE:-} == "aio" || ${CI_MODE:-} == "aio_local" ]]; then travisFoldStart "build.aio" ( cd "`dirname $0`/../../aio" - yarn build + yarn $([[ ${CI_MODE} == "aio" ]] && echo "build" || echo "build-local") ) travisFoldEnd "build.aio" exit 0; fi -# Build the Angular packages then exit (no further build required) -if [[ ${CI_MODE:-} == "aio_e2e" || ${CI_MODE:-} == "aio_tools_test" ]]; then - travisFoldStart "build.$CI_MODE" - ( - ./build.sh - ) - travisFoldEnd "build.$CI_MODE" - exit 0; -fi - travisFoldStart "tsc tools" $(npm bin)/tsc -p tools $(npm bin)/tsc -p packages/compiler/tsconfig-tools.json diff --git a/scripts/ci/install.sh b/scripts/ci/install.sh index a57e73507c..f39801f544 100755 --- a/scripts/ci/install.sh +++ b/scripts/ci/install.sh @@ -49,6 +49,7 @@ travisFoldEnd "bower-install" if [[ ${TRAVIS} && ${CI_MODE} == "aio" || + ${CI_MODE} == "aio_local" || ${CI_MODE} == "aio_e2e" || ${CI_MODE} == "aio_tools_test" ]]; then @@ -67,6 +68,7 @@ if [[ ${TRAVIS} && ${CI_MODE} == "e2e" || ${CI_MODE} == "e2e_2" || ${CI_MODE} == "aio" || + ${CI_MODE} == "aio_local" || ${CI_MODE} == "aio_e2e" ]]; then travisFoldStart "install-chromium" diff --git a/scripts/ci/test-aio-local.sh b/scripts/ci/test-aio-local.sh new file mode 100755 index 0000000000..7b68bad9df --- /dev/null +++ b/scripts/ci/test-aio-local.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -u -e -o pipefail + +# Setup environment +readonly thisDir=$(cd $(dirname $0); pwd) +source ${thisDir}/_travis-fold.sh + + +# run in subshell to avoid polluting cwd +( + cd ${PROJECT_ROOT}/aio + + + # Run PWA-score tests + # (Run before unit and e2e tests, which destroy the `dist/` directory.) + travisFoldStart "test.aio.pwaScore" + yarn test-pwa-score-localhost $AIO_MIN_PWA_SCORE + travisFoldEnd "test.aio.pwaScore" + + # Run unit tests + travisFoldStart "test.aio.unit" + yarn test --watch=false + travisFoldEnd "test.aio.unit" + + # Run e2e tests + travisFoldStart "test.aio.e2e" + yarn e2e + travisFoldEnd "test.aio.e2e" +) diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index 201616b6e8..6b201de23b 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -40,6 +40,9 @@ case ${CI_MODE} in aio) ${thisDir}/test-aio.sh ;; + aio_local) + ${thisDir}/test-aio-local.sh + ;; aio_e2e) ${thisDir}/test-aio-e2e.sh ;;