ci: clean up CI logging, folding, add build time logging, and improve error handling (#14425)

This commit is contained in:
Igor Minar 2017-03-02 00:22:24 -08:00 committed by GitHub
parent 207298cd3a
commit a24e652f2b
24 changed files with 636 additions and 431 deletions

View File

@ -53,14 +53,18 @@ matrix:
- env: "CI_MODE=saucelabs_optional"
- env: "CI_MODE=browserstack_optional"
before_install:
- ./scripts/ci-lite/env.sh print
install:
- ./scripts/ci-lite/install.sh
script:
- ./scripts/ci-lite/build.sh && ./scripts/ci-lite/test.sh
after_success:
- ./scripts/ci-lite/deploy_aio_staging.sh
after_script:
- ./scripts/ci-lite/build.sh
- ./scripts/ci-lite/test.sh
# deploy is part of 'script' and not 'after_success' so that we fail the build if the deployment fails
- ./scripts/ci-lite/deploy.sh
- ./scripts/ci-lite/angular.sh
# all the scripts under this line will not quickly abort in case ${TRAVIS_TEST_RESULT} is 1 (job failure)
- ./scripts/ci-lite/cleanup.sh
- ./scripts/ci-lite/print-logs.sh

124
build.sh
View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -e -o pipefail
set -u -e -o pipefail
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
cd `dirname $0`
@ -76,66 +78,75 @@ VERSION="${VERSION_PREFIX}${VERSION_SUFFIX}"
ROUTER_VERSION="${ROUTER_VERSION_PREFIX}${VERSION_SUFFIX}"
echo "====== BUILDING: Version ${VERSION} (Router ${ROUTER_VERSION})"
export NODE_PATH=${NODE_PATH}:$(pwd)/dist/all:$(pwd)/dist/tools
TSC="node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main"
UGLIFYJS=`pwd`/node_modules/.bin/uglifyjs
BABELJS=`pwd`/node_modules/.bin/babel
BABILI=`pwd`/node_modules/.bin/babili
TSCONFIG=./tools/tsconfig.json
echo "====== (tools)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} ====="
rm -rf ./dist/tools/
mkdir -p ./dist/tools/
$(npm bin)/tsc -p ${TSCONFIG}
cp ./tools/@angular/tsc-wrapped/package.json ./dist/tools/@angular/tsc-wrapped
travisFoldStart "build tools"
echo "====== (tools)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} ====="
rm -rf ./dist/tools/
mkdir -p ./dist/tools/
$(npm bin)/tsc -p ${TSCONFIG}
cp ./tools/@angular/tsc-wrapped/package.json ./dist/tools/@angular/tsc-wrapped
travisFoldEnd "build tools"
if [[ ${BUILD_ALL} == true ]]; then
rm -rf ./dist/all/
mkdir -p ./dist/all/
travisFoldStart "clean dist"
rm -rf ./dist/all/
rm -rf ./dist/packages-dist
travisFoldEnd "clean dist"
echo "====== Copying files needed for e2e tests ====="
cp -r ./modules/playground ./dist/all/
cp -r ./modules/playground/favicon.ico ./dist/
#rsync -aP ./modules/playground/* ./dist/all/playground/
mkdir ./dist/all/playground/vendor
cd ./dist/all/playground/vendor
ln -s ../../../../node_modules/core-js/client/core.js .
ln -s ../../../../node_modules/zone.js/dist/zone.js .
ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/base64-js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs .
ln -s ../../../../node_modules/angular/angular.js .
ln -s ../../../../node_modules/hammerjs/hammer.js .
cd -
travisFoldStart "copy e2e files"
mkdir -p ./dist/all/
echo "====== Copying files needed for benchmarks ====="
cp -r ./modules/benchmarks ./dist/all/
cp -r ./modules/benchmarks/favicon.ico ./dist/
mkdir ./dist/all/benchmarks/vendor
cd ./dist/all/benchmarks/vendor
ln -s ../../../../node_modules/core-js/client/core.js .
ln -s ../../../../node_modules/zone.js/dist/zone.js .
ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs .
ln -s ../../../../node_modules/angular/angular.js .
ln -s ../../../../bower_components/polymer .
ln -s ../../../../node_modules/incremental-dom/dist/incremental-dom-cjs.js
cd -
echo "====== Copying files needed for e2e tests ====="
cp -r ./modules/playground ./dist/all/
cp -r ./modules/playground/favicon.ico ./dist/
#rsync -aP ./modules/playground/* ./dist/all/playground/
mkdir ./dist/all/playground/vendor
cd ./dist/all/playground/vendor
ln -s ../../../../node_modules/core-js/client/core.js .
ln -s ../../../../node_modules/zone.js/dist/zone.js .
ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/base64-js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs .
ln -s ../../../../node_modules/angular/angular.js .
ln -s ../../../../node_modules/hammerjs/hammer.js .
cd -
TSCONFIG=./modules/tsconfig.json
echo "====== (all)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} ====="
# compile ts code
$TSC -p modules/tsconfig.json
echo "====== Copying files needed for benchmarks ====="
cp -r ./modules/benchmarks ./dist/all/
cp -r ./modules/benchmarks/favicon.ico ./dist/
mkdir ./dist/all/benchmarks/vendor
cd ./dist/all/benchmarks/vendor
ln -s ../../../../node_modules/core-js/client/core.js .
ln -s ../../../../node_modules/zone.js/dist/zone.js .
ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs .
ln -s ../../../../node_modules/angular/angular.js .
ln -s ../../../../bower_components/polymer .
ln -s ../../../../node_modules/incremental-dom/dist/incremental-dom-cjs.js
cd -
travisFoldEnd "copy e2e files"
rm -rf ./dist/packages-dist
TSCONFIG=modules/tsconfig.json
travisFoldStart "tsc -p ${TSCONFIG}"
$TSC -p ${TSCONFIG}
travisFoldEnd "tsc -p ${TSCONFIG}"
fi
for PACKAGE in ${PACKAGES[@]}
do
travisFoldStart "build package: ${PACKAGE}"
PWD=`pwd`
ROOTDIR=${PWD}/modules/@angular
SRCDIR=${PWD}/modules/@angular/${PACKAGE}
@ -290,7 +301,7 @@ do
$UGLIFYJS -c --screw-ie8 --comments -o ${UMD_ES5_MIN_PATH} ${UMD_ES5_PATH}
fi
rm -f ${DISTDIR}/.babelrc
rm -f ${DESTDIR}/.babelrc
if [[ -d ${DEST_MODULE} ]]; then
echo "====== Downleveling ES2015 to ESM/ES5"
downlevelES2015 ${DESTDIR} ${JS_PATH} ${JS_PATH_ES5}
@ -443,16 +454,25 @@ do
echo "====== EXECUTE: perl -p -i -e \"s/0\.0\.0\-ROUTERPLACEHOLDER/${ROUTER_VERSION}/g\" $""(grep -ril 0\.0\.0\-ROUTERPLACEHOLDER .)"
perl -p -i -e "s/0\.0\.0\-ROUTERPLACEHOLDER/${ROUTER_VERSION}/g" $(grep -ril 0\.0\.0\-ROUTERPLACEHOLDER .) < /dev/null 2> /dev/null
)
travisFoldEnd "build package: ${PACKAGE}"
done
if [[ ${BUILD_EXAMPLES} == true ]]; then
echo ""
echo "====== Building examples: ./modules/@angular/examples/build.sh ====="
./modules/@angular/examples/build.sh
travisFoldStart "build examples"
echo "====== Building examples: ./modules/@angular/examples/build.sh ====="
./modules/@angular/examples/build.sh
travisFoldEnd "build examples"
fi
if [[ ${REMOVE_BENCHPRESS} == true ]]; then
echo ""
echo "==== Removing benchpress from publication"
rm -r dist/packages-dist/benchpress
travisFoldStart "remove benchpress"
echo ""
echo "==== Removing benchpress from publication"
rm -r dist/packages-dist/benchpress
travisFoldEnd "remove benchpress"
fi
# Print return arrows as a log separator
travisFoldReturnArrows

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e -o pipefail
set -u -e -o pipefail
#
# This script is used to compile and copy the contents for each of

View File

@ -56,3 +56,13 @@ tunnel.start(function(error) {
tunnel.on('error', function(error) {
console.error(error);
});
// TODO(i): we should properly stop the tunnel when tests are done.
// tunnel.stop(function(error) {
// if (error) {
// console.log(error);
// } else {
// console.log('browserStack tunnel has stopped');
// }
//});

View File

@ -1,3 +1,7 @@
#!/bin/bash
set +x +v -u -e -o pipefail
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
node ./scripts/browserstack/start_tunnel.js &

View File

@ -1,8 +1,7 @@
#!/bin/bash
set -e -o pipefail
set -u -e -o pipefail
echo "Shutting down Browserstack tunnel"
echo "TODO: implement me"
exit 1
echo "TODO: implement me, see start_tunnel.js for info on how to stop the tunnel"

View File

@ -0,0 +1,74 @@
# private variable to track folds within this script
travisFoldStack=()
function travisFoldStart() {
local foldName="${0#./} ${1}"
# get current time as nanoseconds since the beginning of the epoch
foldStartTime=$(date +%s%N)
# convert all non alphanum chars except for "-" and "." to "--"
local sanitizedFoldName=${foldName//[^[:alnum:]\-\.]/--}
# strip trailing "-"
sanitizedFoldName=${sanitizedFoldName%-}
# push the foldName onto the stack
travisFoldStack+=("${sanitizedFoldName}|${foldStartTime}")
echo ""
echo "travis_fold:start:${sanitizedFoldName}"
echo "travis_time:start:${sanitizedFoldName}"
local enterArrow="===> ${foldName} ==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>==>"
# keep all messages consistently wide 80chars regardless of the foldName
echo ${enterArrow:0:100}
# turn on verbose mode so that we have better visibility into what's going on
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html#table_02_01
set -x
}
function travisFoldEnd() {
set +x
local foldName="${0#./} ${1}"
# convert all non alphanum chars except for "-" and "." to "--"
local sanitizedFoldName=${foldName//[^[:alnum:]\-\.]/--}
# strip trailing "-"
sanitizedFoldName=${sanitizedFoldName%-}
# consult and update travisFoldStack
local lastFoldIndex=$(expr ${#travisFoldStack[@]} - 1)
local lastFoldString=${travisFoldStack[$lastFoldIndex]}
# split the string by | and then turn that into an array
local lastFoldArray=(${lastFoldString//\|/ })
local lastSanitizedFoldName=${lastFoldArray[0]}
local lastFoldStartTime=${lastFoldArray[1]}
local foldFinishTime=$(date +%s%N)
local foldDuration=$(expr ${foldFinishTime} - ${lastFoldStartTime})
# write into build-perf.log file
local logIndent=$(expr ${lastFoldIndex} \* 2)
printf "%6ss%${logIndent}s: %s\n" $(expr ${foldDuration} / 1000000000) " " "${foldName}" >> ${LOGS_DIR}/build-perf.log
# pop
travisFoldStack=(${travisFoldStack[@]:0:lastFoldIndex})
# check for misalignment
if [[ ${lastSanitizedFoldName} != ${sanitizedFoldName} ]]; then
echo "Travis fold mis-alignment detected! travisFoldEnd expected sanitized fold name '${lastSanitizedFoldName}', but received '${sanitizedFoldName}' (after sanitization)"
exit 1
fi
local returnArrow="<=== ${foldName} <==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<=="
# keep all messages consistently wide 80chars regardless of the foldName
echo ${returnArrow:0:100}
echo ""
echo "travis_time:end:${sanitizedFoldName}:start=${lastFoldStartTime},finish=${foldFinishTime},duration=${foldDuration}"
echo "travis_fold:end:${sanitizedFoldName}"
}
function travisFoldReturnArrows() {
# print out return arrows so that it's easy to see the end of the script in the log
echo ""
returnArrow="<=== ${0#./} <==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<=="
# keep all messages consistently wide 80chars regardless of the foldName
echo ${returnArrow:0:100}
echo "<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==<==="
echo ""
}

46
scripts/ci-lite/angular.sh Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# created based on the official Angular logo from https://angular.io/presskit.html
# converted using http://www.text-image.com/convert/
# colors added based on http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
# If the previous commands in the `script` section of .travis.yaml failed, then abort.
if [[ ${TRAVIS_TEST_RESULT} == 1 ]]; then
exit 1;
fi
RED='\033[0;31m'
LRED='\033[1;31m'
WHITE='\033[1;37m'
echo -e ${LRED}' ``'${RED}'`` '
echo -e ${LRED}' `.--://'${RED}':::--.`'
echo -e ${LRED}' `..-:////////'${RED}':::::::::-.``'
echo -e ${LRED}' `.-::////////////'${WHITE}'oo'${RED}'::::::::::::::-.`'
echo -e ${LRED}' `--://///////////////'${WHITE}'+NN+'${RED}'::::::::::::::::::-.`'
echo -e ${LRED}' `///////////////////'${WHITE}'+NMMN/'${RED}':::::::::::::::::::`'
echo -e ${LRED}' ///////////////////'${WHITE}'mMMMMm/'${RED}'::::::::::::::::::'
echo -e ${LRED}' ://///////////////'${WHITE}'dMMMMMMd/'${RED}':::::::::::::::::'
echo -e ${LRED}' -////////////////'${WHITE}'dMMMNNMMMh/'${RED}':::::::::::::::-'
echo -e ${LRED}' .///////////////'${WHITE}'hMMMM++MMMMh'${RED}':::::::::::::::.'
echo -e ${LRED}' `//////////////'${WHITE}'yMMMMs'${LRED}'/'${RED}':'${WHITE}'sMMMMy'${RED}'::::::::::::::`'
echo -e ${LRED}' :////////////'${WHITE}'sMMMMy'${LRED}'//'${RED}'::'${WHITE}'yMMMMs'${RED}':::::::::::::'
echo -e ${LRED}' -///////////'${WHITE}'oMMMMd'${LRED}'///'${RED}'::'${WHITE}'/dMMMMo'${RED}':::::::::::-'
echo -e ${LRED}' .//////////'${WHITE}'+NMMMMddddddddMMMMN+'${RED}'::::::::::.'
echo -e ${LRED}' `/////////'${WHITE}'+NMMMMMMMMMMMMMMMMMMN+'${RED}':::::::::`'
echo -e ${LRED}' :////////'${WHITE}'mMMMMyyyyyyyyyyyyMMMMm/'${RED}'::::::::'
echo -e ${LRED}' -///////'${WHITE}'mMMMMs'${LRED}'//////'${RED}'::::::'${WHITE}'sMMMMm/'${RED}'::::::-'
echo -e ${LRED}' .//////'${WHITE}'dMMMMy'${LRED}'///////'${RED}':::::::'${WHITE}'yMMMMd/'${RED}':::::.'
echo -e ${LRED}' `/////'${WHITE}'hMMMMd'${LRED}'////////'${RED}':::::::'${WHITE}'/dMMMMh'${RED}':::::`'
echo -e ${LRED}' -://///////////////'${RED}'::::::::::::::::::-'
echo -e ${LRED}' `.://////////////'${RED}'::::::::::::::-.`'
echo -e ${LRED}' `-://////////'${RED}':::::::::::-`'
echo -e ${LRED}' `.-://////'${RED}':::::::-.`'
echo -e ${LRED}' `.:///'${RED}'::::.`'
echo -e ${LRED}' .-'${RED}'-` '

View File

@ -1,44 +1,48 @@
#!/usr/bin/env bash
set -ex -o pipefail
echo 'travis_fold:start:BUILD'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
$(npm bin)/tsc -v
$(npm bin)/tsc -p tools
cp tools/@angular/tsc-wrapped/package.json dist/tools/@angular/tsc-wrapped
node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main -p modules
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/core/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/common/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/platform-browser/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/router/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/forms/tsconfig-build.json
travisFoldStart "tsc tools"
$(npm bin)/tsc -p tools
cp tools/@angular/tsc-wrapped/package.json dist/tools/@angular/tsc-wrapped
travisFoldEnd "tsc tools"
travisFoldStart "tsc all"
node --max-old-space-size=3000 dist/tools/@angular/tsc-wrapped/src/main -p modules
travisFoldEnd "tsc all"
# TODO(i): what are these compilations here for?
travisFoldStart "tsc a bunch of useless stuff"
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/core/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/common/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/platform-browser/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/router/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/forms/tsconfig-build.json
travisFoldEnd "tsc a bunch of useless stuff"
# Build integration tests
if [[ ${CI_MODE} == "e2e" ]]; then
echo 'travis_fold:start:BUILD.integration'
# Build integration
cd "`dirname $0`/../../integration"
./build_rxjs_es6.sh
cd -
echo 'travis_fold:end:BUILD.integration'
travisFoldStart "build.integration"
cd "`dirname $0`/../../integration"
./build_rxjs_es6.sh
cd -
travisFoldEnd "build.integration"
fi
# Build angular.io
if [[ ${CI_MODE} == "aio" ]]; then
echo 'travis_fold:start:BUILD.aio'
# Build angular.io
cd "`dirname $0`/../../aio"
yarn run build
cd -
echo 'travis_fold:end:BUILD.aio'
travisFoldStart "build.aio"
cd "`dirname $0`/../../aio"
yarn run build
cd -
travisFoldEnd "build.aio"
fi
echo 'travis_fold:end:BUILD'

View File

@ -1,39 +1,39 @@
#!/usr/bin/env bash
set -ex -o pipefail
set -u -e -o pipefail
echo 'travis_fold:start:CLEANUP'
# override test failure so that we perform this file regardless and not abort in env.sh
TRAVIS_TEST_RESULT=0
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
if [[ ${TRAVIS} ]]; then
case ${CI_MODE} in
js)
;;
saucelabs_required)
case ${CI_MODE} in
js)
;;
saucelabs_required)
travisFoldStart "teardown.sauceConnect"
./scripts/sauce/sauce_connect_teardown.sh
;;
browserstack_required)
travisFoldEnd "teardown.sauceConnect"
;;
browserstack_required)
travisFoldStart "teardown.browserStack"
./scripts/browserstack/teardown_tunnel.sh
;;
saucelabs_optional)
travisFoldEnd "teardown.browserStack"
;;
saucelabs_optional)
travisFoldStart "teardown.sauceConnect"
./scripts/sauce/sauce_connect_teardown.sh
;;
browserstack_optional)
travisFoldEnd "teardown.sauceConnect"
;;
browserstack_optional)
travisFoldStart "teardown.browserStack"
./scripts/browserstack/teardown_tunnel.sh
;;
esac
fi
travisFoldEnd "teardown.browserStack"
;;
esac
echo 'travis_fold:start:cleanup.printLogs'
./scripts/ci/print-logs.sh
echo 'travis_fold:end:cleanup.printLogs'
echo 'travis_fold:end:CLEANUP'
# Print return arrows as a log separator
travisFoldReturnArrows

39
scripts/ci-lite/deploy.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -u -e -o pipefail
# Setup environment
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
# Don't deploy if not running against angular/angular and not a PR
# TODO(i): because we don't let deploy to run outside of angular/angular folks can't use their
# private travis build to deploy anywhere. This is likely ok, but this means that @alexeagle's
# fancy setup to publish ES2015 packages to github -build repos no longer works. This is ok
# since with megamodules we'll have this feature built-in. We should still go and remove
# stuff that Alex put in for this from publish-build-artifacts.sh
if [[ ${TRAVIS_REPO_SLUG} != "angular/angular" || ${TRAVIS_PULL_REQUEST} != "false" ]]; then
echo "Skipping deploy to staging because this is a PR build."
exit 0
fi
case ${CI_MODE} in
e2e)
travisFoldStart "deploy.packages"
./scripts/publish/publish-build-artifacts.sh
travisFoldEnd "deploy.packages"
;;
aio)
# aio deploy is setup only from master to aio-staging.firebaseapp.com for now
if [[ ${TRAVIS_BRANCH} == "master" ]]; then
travisFoldStart "deploy.aio"
(
cd ${TRAVIS_BUILD_DIR}/aio
yarn run deploy-staging
)
travisFoldEnd "deploy.aio"
fi
;;
esac

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
set -ex -o pipefail
# Only deploy if this Travis job is for the upstream master branch
if [[ ! ${TRAVIS} || ${CI_MODE} != "aio" || ${TRAVIS_PULL_REQUEST} || ${TRAVIS_BRANCH} != "master" ]]; then
echo 0;
fi
echo 'travis_fold:start:aio.deploy'
# Setup environment
cd `dirname $0`
source ./env.sh
echo 'travis_fold:start:aio.deploy.staging'
# Deploy angular.io to staging
cd ../../aio
yarn run deploy-staging
cd -
echo 'travis_fold:end:aio.deploy.staging'
echo 'travis_fold:end:aio.deploy'

162
scripts/ci-lite/env.sh Normal file → Executable file
View File

@ -1,82 +1,130 @@
#!/usr/bin/env bash
set -e -o pipefail
echo 'travis_fold:start:ENV'
NODE_VERSION=6.9.5
NPM_VERSION=3.10.7 # do not upgrade to >3.10.8 unless https://github.com/npm/npm/issues/14042 is resolved
YARN_VERSION=0.21.3
CHROMIUM_VERSION=433059 # Chrome 56 linux stable, see https://www.chromium.org/developers/calendar
SAUCE_CONNECT_VERSION=4.3.11
if [[ ${TRAVIS} ]]; then
# Token for tsd to increase github rate limit
# See https://github.com/DefinitelyTyped/tsd#tsdrc
# This does not use http://docs.travis-ci.com/user/environment-variables/#Secure-Variables
# because those are not visible for pull requests, and those should also be reliable.
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
# (password is in Valentine)
TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}'
case ${CI_MODE} in
js)
KARMA_JS_BROWSERS=ChromeNoSandbox
;;
saucelabs_required)
KARMA_JS_BROWSERS=`node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').sauceAliases.CI_REQUIRED.join(','))"`
;;
browserstack_required)
KARMA_JS_BROWSERS=`node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_REQUIRED.join(','))"`
;;
saucelabs_optional)
KARMA_JS_BROWSERS=`node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').sauceAliases.CI_OPTIONAL.join(','))"`
;;
browserstack_optional)
KARMA_JS_BROWSERS=`node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_OPTIONAL.join(','))"`
;;
esac
else
KARMA_JS_BROWSERS=Chrome
# If the previous commands in the `script` section of .travis.yaml failed, then abort.
# The variable is not set in early stages of the build, so we default to 0 there.
# https://docs.travis-ci.com/user/environment-variables/
if [[ ${TRAVIS_TEST_RESULT=0} == 1 ]]; then
exit 1;
fi
# set wasBashSetXOn using the current "set -x" mode state, so that we can restore it at the end
[[ "${-//[^x]/}" = "x" ]] && wasBashSetXOn=1 || wasBashSetXOn=0
# GLOBALS
# this script is extra noisy and used in many places during the build so we suppress the trace with +x to reduce the noise
set +x -u -e -o pipefail
# Prepend `~/.yarn/bin` to the PATH
export PATH=$HOME/.yarn/bin:$PATH
# sets and optionally prints environmental variable
# usage: setEnvVar variableName variableValue
function setEnvVar() {
local name=$1
local value=$2
# Append dist/all to the NODE_PATH so that cjs module resolver finds find the packages that use
# absolute module ids (e.g. @angular/core)
export NODE_PATH=${NODE_PATH}:$(pwd)/../../dist/all:$(pwd)/../../dist/tools
export LOGS_DIR=/tmp/angular-build/logs
if [[ ${print} == "print" ]]; then
echo ${name}=${value}
fi
export ${name}=${value}
}
if [[ ${TRAVIS} ]]; then
# strip leading "./"
currentFileName=${0#./}
currentWorkingDirectory=`pwd`
#cd ${currentWorkingDirectory%currentFileName}
readonly print=${1:-}
# TODO(i): this won't work locally
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
#######################
# CUSTOM GLOBALS #
#######################
setEnvVar NODE_VERSION 6.9.5
setEnvVar NPM_VERSION 3.10.7 # do not upgrade to >3.10.8 unless https://github.com/npm/npm/issues/14042 is resolved
setEnvVar YARN_VERSION 0.21.3
setEnvVar CHROMIUM_VERSION 433059 # Chrome 53 linux stable, see https://www.chromium.org/developers/calendar
setEnvVar SAUCE_CONNECT_VERSION 4.3.11
# TODO(i): this won't work locally
setEnvVar PROJECT_ROOT ${TRAVIS_BUILD_DIR} # all source includes above for helper files in this env.sh script (e.g. _travis_fold.sh) duplicate this setting, update those if you change it here
if [[ ${TRAVIS:-} ]]; then
case ${CI_MODE} in
js)
setEnvVar KARMA_JS_BROWSERS ChromeNoSandbox
;;
saucelabs_required)
setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').sauceAliases.CI_REQUIRED.join(','))"`
;;
browserstack_required)
setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_REQUIRED.join(','))"`
;;
saucelabs_optional)
setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').sauceAliases.CI_OPTIONAL.join(','))"`
;;
browserstack_optional)
setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_OPTIONAL.join(','))"`
;;
esac
else
setEnvVar KARMA_JS_BROWSERS Chrome
fi
if [[ ${TRAVIS:-} ]]; then
# used by xvfb that is used by Chromium
export DISPLAY=:99.0
setEnvVar DISPLAY :99.0
# Use newer verison of GCC to that is required to compile native npm modules for Node v4+ on Ubuntu Precise
# Use newer version of GCC to that is required to compile native npm modules for Node v4+ on Ubuntu Precise
# more info: https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements
export CXX=g++-4.8
setEnvVar CXX g++-4.8
# Used by karma and karma-chrome-launcher
# In order to have a meaningful SauceLabs badge on the repo page,
# the angular2-ci account is used only when pushing commits to master;
# in all other cases, the regular angular-ci account is used.
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then
export SAUCE_USERNAME=angular2-ci
setEnvVar SAUCE_USERNAME angular2-ci
# don't print the key
export SAUCE_ACCESS_KEY=693ebc16208a-0b5b-1614-8d66-a2662f4e
else
export SAUCE_USERNAME=angular-ci
setEnvVar SAUCE_USERNAME angular-ci
# don't print the key
export SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
fi
export BROWSER_STACK_USERNAME=angularteam1
setEnvVar BROWSER_STACK_USERNAME angularteam1
export BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB
export CHROME_BIN=${HOME}/.chrome/chromium/chrome-linux/chrome
setEnvVar CHROME_BIN ${HOME}/.chrome/chromium/chrome-linux/chrome
setEnvVar BROWSER_PROVIDER_READY_FILE /tmp/angular-build/browser-provider-tunnel-init.lock
fi
echo 'travis_fold:end:ENV'
#######################
# PREEXISTING GLOBALS #
#######################
# Prepend `~/.yarn/bin` to the PATH
setEnvVar PATH $HOME/.yarn/bin:$PATH
# Append dist/all to the NODE_PATH so that cjs module resolver finds find the packages that use
# absolute module ids (e.g. @angular/core)
setEnvVar NODE_PATH ${NODE_PATH:-}:${PROJECT_ROOT}/dist/all:${PROJECT_ROOT}/dist/tools
setEnvVar LOGS_DIR /tmp/angular-build/logs
# strip leading "/home/travis/build/angular/angular/" or "./" path. Could this be done in one shot?
CURRENT_SHELL_SOURCE_FILE=${BASH_SOURCE#${PROJECT_ROOT}/}
export CURRENT_SHELL_SOURCE_FILE=${CURRENT_SHELL_SOURCE_FILE#./}
# Prefix xtrace output with file name/line and optionally function name
# http://wiki.bash-hackers.org/scripting/debuggingtips#making_xtrace_more_useful
# TODO(i): I couldn't figure out how to set this via `setEnvVar` so I just set it manually
export PS4='+(${CURRENT_SHELL_SOURCE_FILE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
if [[ ${print} == "print" ]]; then
echo PS4=${PS4}
fi
# restore set -x mode
if [[ wasBashSetXOn == 1 ]]; then
set -x
fi

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -ex -o pipefail
set -u -e -o pipefail
echo 'travis_fold:start:INSTALL'
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
# Setup environment
cd `dirname $0`
@ -21,63 +21,70 @@ mkdir -p ${LOGS_DIR}
# Install version of npm that we are locked against
echo 'travis_fold:start:install.npm'
npm install -g npm@${NPM_VERSION}
echo 'travis_fold:end:install.npm'
travisFoldStart "install-npm"
npm install -g npm@${NPM_VERSION}
travisFoldEnd "install-npm"
# Install all npm dependencies according to shrinkwrap.json
echo 'travis_fold:start:install.node_modules'
node tools/npm/check-node-modules --purge || npm install
echo 'travis_fold:end:install.node_modules'
travisFoldStart "npm-install"
node tools/npm/check-node-modules --purge || npm install
travisFoldEnd "npm-install"
if [[ ${TRAVIS} && (${CI_MODE} == "e2e" || ${CI_MODE} == "aio" || ${CI_MODE} == "docs_test") ]]; then
# Install version of yarn that we are locked against
echo 'travis_fold:start:install.yarn'
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "${YARN_VERSION}"
echo 'travis_fold:end:install.yarn'
travisFoldStart "install-yarn"
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "${YARN_VERSION}"
travisFoldEnd "install-yarn"
fi
if [[ ${TRAVIS} && (${CI_MODE} == "aio" || ${CI_MODE} == "docs_test") ]]; then
# angular.io: Install all yarn dependencies according to angular.io/yarn.lock
echo 'travis_fold:start:install.aio.node_modules'
cd "`dirname $0`/../../aio"
yarn install
cd -
echo 'travis_fold:end:install.aio.node_modules'
travisFoldStart "yarn-install.aio"
cd "`dirname $0`/../../aio"
yarn install
cd -
travisFoldEnd "yarn-install.aio"
fi
# Install Chromium
echo 'travis_fold:start:install.chromium'
if [[ ${CI_MODE} == "js" || ${CI_MODE} == "e2e" || ${CI_MODE} == "aio" ]]; then
./scripts/ci/install_chromium.sh
travisFoldStart "install-chromium"
./scripts/ci/install_chromium.sh
travisFoldEnd "install-chromium"
fi
echo 'travis_fold:end:install.chromium'
# Install Sauce Connect
echo 'travis_fold:start:install.sauceConnect'
if [[ ${TRAVIS}] && (${CI_MODE} == "saucelabs_required" || ${CI_MODE} == "saucelabs_optional") ]]; then
./scripts/sauce/sauce_connect_setup.sh
travisFoldStart "install-sauceConnect"
./scripts/sauce/sauce_connect_setup.sh
travisFoldEnd "install-sauceConnect"
fi
echo 'travis_fold:end:install.sauceConnect'
# Install BrowserStack Tunnel
echo 'travis_fold:start:install.browserstack'
if [[ ${TRAVIS} && (${CI_MODE} == "browserstack_required" || ${CI_MODE} == "browserstack_optional") ]]; then
./scripts/browserstack/start_tunnel.sh
travisFoldStart "install-browserstack"
./scripts/browserstack/start_tunnel.sh
travisFoldEnd "install-browserstack"
fi
echo 'travis_fold:end:install.browserstack'
# node tools/chromedriverpatch.js
$(npm bin)/webdriver-manager update
# Install Selenium WebDriver
travisFoldStart "webdriver-manager-update"
$(npm bin)/webdriver-manager update
travisFoldEnd "webdriver-manager-update"
# install bower packages
$(npm bin)/bower install
echo 'travis_fold:end:INSTALL'
# Install bower packages
travisFoldStart "bower-install"
$(npm bin)/bower install
travisFoldEnd "bower-install"
# Print return arrows as a log separator
travisFoldReturnArrows

21
scripts/ci-lite/print-logs.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -u -e -o pipefail
# override test failure so that we perform this file regardless and not abort in env.sh
TRAVIS_TEST_RESULT=0
# Setup environment
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
for FILE in ${LOGS_DIR}/*; do
travisFoldStart "print log file: ${FILE}"
cat $FILE
travisFoldEnd "print log file: ${FILE}"
done
# Print return arrows as a log separator
travisFoldReturnArrows

View File

@ -1,19 +1,35 @@
#!/usr/bin/env bash
set -ex -o pipefail
echo 'travis_fold:start:TEST'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
./scripts/ci-lite/test_js.sh
./scripts/ci-lite/test_e2e.sh
./scripts/ci-lite/test_saucelabs.sh
./scripts/ci-lite/test_browserstack.sh
./scripts/ci-lite/test_docs.sh
./scripts/ci-lite/test_aio.sh
echo 'travis_fold:end:TEST'
case ${CI_MODE} in
js)
./scripts/ci-lite/test_js.sh
;;
e2e)
./scripts/ci-lite/test_e2e.sh
;;
saucelabs_required)
./scripts/ci-lite/test_saucelabs.sh
;;
browserstack_required)
./scripts/ci-lite/test_browserstack.sh
;;
saucelabs_optional)
./scripts/ci-lite/test_saucelabs.sh
;;
browserstack_optional)
./scripts/ci-lite/test_browserstack.sh
;;
docs_test)
./scripts/ci-lite/test_docs.sh
;;
aio)
./scripts/ci-lite/test_aio.sh
;;
esac

View File

@ -1,57 +1,38 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "aio" ]]; then
exit 0;
fi
echo 'travis_fold:start:test.aio'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
cd ${PROJECT_ROOT}/aio
echo 'travis_fold:start:test.aio.lint'
# Lint the code
cd ../../aio
yarn run lint
cd -
echo 'travis_fold:end:test.aio.lint'
travisFoldStart "test.aio.lint"
yarn run lint
travisFoldEnd "test.aio.lint"
# Generate docs files
# TODO(i): why is this in 'test' phase and not in the 'build' phase?
travisFoldStart "test.aio.doc-gen"
$(npm bin)/gulp docs
travisFoldEnd "test.aio.doc-gen"
echo 'travis_fold:start:test.aio.doc-gen'
# Lint the code
cd ../../aio
$(npm bin)/gulp docs
cd -
echo 'travis_fold:end:test.aio.doc-gen'
echo 'travis_fold:start:test.aio.localChromeSetup'
# Start local Chrome
# Start xvfb for local Chrome used for testing
if [[ ${TRAVIS} ]]; then
sh -e /etc/init.d/xvfb start
travisFoldStart "test.aio.xvfb-start"
sh -e /etc/init.d/xvfb start
travisFoldEnd "test.aio.xvfb-start"
fi
echo 'travis_fold:end:test.aio.localChromeSetup'
echo 'travis_fold:start:test.aio.unit'
# Run unit tests
cd ../../aio
yarn test -- --single-run
cd -
echo 'travis_fold:end:test.aio.unit'
travisFoldStart "test.aio.unit"
yarn test -- --single-run
travisFoldEnd "test.aio.unit"
echo 'travis_fold:start:test.aio.e2e'
# Run e2e tests
cd ../../aio
yarn run e2e
cd -
echo 'travis_fold:end:test.aio.e2e'
echo 'travis_fold:end:test.aio'
travisFoldStart "test.aio.e2e"
yarn run e2e
travisFoldEnd "test.aio.e2e"

View File

@ -1,22 +1,14 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "browserstack_required" && ${CI_MODE} != "browserstack_optional" ]]; then
exit 0;
fi
echo 'travis_fold:start:test_browserstack'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
./scripts/browserstack/waitfor_tunnel.sh
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
echo 'travis_fold:end:test_browserstack'
travisFoldStart "test.unit.browserstack"
./scripts/browserstack/waitfor_tunnel.sh
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
travisFoldEnd "test.unit.browserstack"

View File

@ -1,20 +1,13 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "docs_test" ]]; then
exit 0;
fi
echo 'travis_fold:start:test_docs'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
cd ../../aio
$(npm bin)/gulp docs-test
cd -
echo 'travis_fold:end:test_docs'
travisFoldStart "test.docs"
cd ${PROJECT_ROOT}/aio
$(npm bin)/gulp docs-test
travisFoldEnd "test.docs"

View File

@ -1,58 +1,58 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "e2e" ]]; then
exit 0;
fi
echo 'travis_fold:start:test.e2e'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
echo 'travis_fold:start:test.e2e.buildPackages'
./build.sh
echo 'travis_fold:end:test.e2e.buildPackages'
travisFoldStart "test.e2e.buildPackages"
./build.sh
travisFoldEnd "test.e2e.buildPackages"
if [[ ${TRAVIS} ]]; then
echo 'travis_fold:start:test.e2e.localChrome'
sh -e /etc/init.d/xvfb start
echo 'travis_fold:end:test.e2e.localChrome'
travisFoldStart "test.e2e.xvfb-start"
sh -e /etc/init.d/xvfb start
travisFoldEnd "test.e2e.xvfb-start"
fi
echo 'travis_fold:start:test.e2e.integration'
./integration/run_tests.sh
#TODO(alexeagle): move offline_compiler_test to integration/
./scripts/ci-lite/offline_compiler_test.sh
echo 'travis_fold:end:test.e2e.integration'
travisFoldStart "test.e2e.integration"
./integration/run_tests.sh
travisFoldEnd "test.e2e.integration"
echo 'travis_fold:start:test.e2e.apiAndCircularDeps'
$(npm bin)/gulp public-api:enforce
$(npm bin)/gulp check-cycle
echo 'travis_fold:end:test.e2e.apiAndCircularDeps'
travisFoldStart "test.e2e.offlineCompiler"
#TODO(alexeagle): move offline_compiler_test to integration/
./scripts/ci-lite/offline_compiler_test.sh
travisFoldEnd "test.e2e.offlineCompiler"
echo 'travis_fold:start:test.e2e.protractor'
cd dist/
$(npm bin)/gulp serve &
$(npm bin)/gulp serve-examples &
cd ..
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-e2e.conf.js --bundles=true
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-examples-e2e.conf.js --bundles=true
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-perf.conf.js --bundles=true --dryrun
echo 'travis_fold:end:test.e2e.protractor'
echo 'travis_fold:end:test.e2e'
travisFoldStart "test.e2e.publicApi"
$(npm bin)/gulp public-api:enforce
travisFoldEnd "test.e2e.publicApi"
if [[ ${TRAVIS} ]]; then
./scripts/publish/publish-build-artifacts.sh
fi
travisFoldStart "test.e2e.check-cycle"
$(npm bin)/gulp check-cycle
travisFoldEnd "test.e2e.check-cycle"
# Serve files for e2e tests
(
cd dist/
$(npm bin)/gulp serve &
$(npm bin)/gulp serve-examples &
)
travisFoldStart "test.e2e.protractor-e2e"
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-e2e.conf.js --bundles=true
travisFoldEnd "test.e2e.protractor-e2e"
travisFoldStart "test.e2e.protractor-examples-e2e"
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-examples-e2e.conf.js --bundles=true
travisFoldEnd "test.e2e.protractor-examples-e2e"
travisFoldStart "test.e2e.protractor-perf"
NODE_PATH=$NODE_PATH:./dist/all $(npm bin)/protractor ./protractor-perf.conf.js --bundles=true --dryrun
travisFoldEnd "test.e2e.protractor-perf"

View File

@ -1,56 +1,51 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "js" ]]; then
exit 0;
fi
echo 'travis_fold:start:test.js'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
echo 'travis_fold:start:test.unit.tools'
# Run unit tests for our tools/ directory
travisFoldStart "test.unit.tools"
node ./dist/tools/tsc-watch/ tools runCmdsOnly
# Run unit tests in tools
node ./dist/tools/tsc-watch/ tools runCmdsOnly
# TODO(i) could this be rolled into the tools tests above? why is it separate?
travisFoldStart "test.unit.validate-commit-message"
(
cd tools/validate-commit-message
$(npm bin)/jasmine
)
travisFoldEnd "test.unit.validate-commit-message"
travisFoldEnd "test.unit.tools"
cd tools/validate-commit-message
$(npm bin)/jasmine
cd -
echo 'travis_fold:end:test.unit.tools'
echo 'travis_fold:start:test.unit.node'
# Run unit tests in node
node ./dist/tools/tsc-watch/ node runCmdsOnly
travisFoldStart "test.unit.node"
node ./dist/tools/tsc-watch/ node runCmdsOnly
travisFoldEnd "test.unit.node"
echo 'travis_fold:end:test.unit.node'
echo 'travis_fold:start:test.unit.localChrome'
# rebuild to revert files in @angular/compiler/test
# TODO(tbosch): remove this and teach karma to serve the right files
node dist/tools/@angular/tsc-wrapped/src/main -p modules/tsconfig.json
travisFoldStart "test.unit.rebuildHack"
node dist/tools/@angular/tsc-wrapped/src/main -p modules/tsconfig.json
travisFoldStart "test.unit.rebuildHack"
# Run unit tests in local chrome
if [[ ${TRAVIS} ]]; then
sh -e /etc/init.d/xvfb start
travisFoldStart "test.unit.xvfb-start"
sh -e /etc/init.d/xvfb start
travisFoldEnd "test.unit.xvfb-start"
fi
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
$(npm bin)/karma start ./modules/@angular/router/karma.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
echo 'travis_fold:end:test.unit.localChrome'
travisFoldStart "test.unit.localChrome"
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
travisFoldEnd "test.unit.localChrome"
echo 'travis_fold:end:test.js'
travisFoldStart "test.unit.localChrome.router"
$(npm bin)/karma start ./modules/@angular/router/karma.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
travisFoldEnd "test.unit.localChrome.router"

View File

@ -1,22 +1,14 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "saucelabs_required" && ${CI_MODE} != "saucelabs_optional" ]]; then
exit 0;
fi
echo 'travis_fold:start:test_saucelabs'
set -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
./scripts/sauce/sauce_connect_block.sh
SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS} --reporters internal-angular,saucelabs
echo 'travis_fold:end:test_saucelabs'
travisFoldStart "test.unit.saucelabs"
./scripts/sauce/sauce_connect_block.sh
SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
$(npm bin)/karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS} --reporters internal-angular,saucelabs
travisFoldEnd "test.unit.saucelabs"

View File

@ -1,14 +0,0 @@
#!/bin/bash
LOG_FILES=$LOGS_DIR/*
for FILE in $LOG_FILES; do
echo -e "\n\n\n"
echo "================================================================================"
echo 'travis_fold:start:cleanup.printfile'
echo " $FILE"
echo "================================================================================"
cat $FILE
echo 'travis_fold:end:cleanup.printfile'
done

View File

@ -1,10 +1,11 @@
#!/bin/bash
set -e -o pipefail
set +x -u -e -o pipefail
# Setup environment
cd `dirname $0`
source ../ci-lite/env.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/_travis_fold.sh
source ${TRAVIS_BUILD_DIR}/scripts/ci-lite/env.sh
@ -46,10 +47,11 @@ if [ ! -z "$BROWSER_PROVIDER_READY_FILE" ]; then
ARGS="$ARGS --readyfile $BROWSER_PROVIDER_READY_FILE"
fi
set -v
echo "Starting Sauce Connect in the background, logging into:"
echo " $CONNECT_LOG"
echo " $CONNECT_STDOUT"
echo " $CONNECT_STDERR"
sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS \
--logfile $CONNECT_LOG 2> $CONNECT_STDERR 1> $CONNECT_STDOUT &
set +v