build: use subshells when changing directories
This prevents being left in the wrong directory in case of error.
This commit is contained in:
parent
21d213dfc7
commit
06264645fd
|
@ -5,7 +5,8 @@ set -eux -o pipefail
|
||||||
source "`dirname $0`/_env.sh"
|
source "`dirname $0`/_env.sh"
|
||||||
|
|
||||||
# Test `scripts-js/`
|
# Test `scripts-js/`
|
||||||
|
(
|
||||||
cd "$SCRIPTS_JS_DIR"
|
cd "$SCRIPTS_JS_DIR"
|
||||||
yarn install
|
yarn install
|
||||||
yarn test
|
yarn test
|
||||||
cd -
|
)
|
||||||
|
|
|
@ -5,10 +5,11 @@ set -eux -o pipefail
|
||||||
source "`dirname $0`/_env.sh"
|
source "`dirname $0`/_env.sh"
|
||||||
|
|
||||||
# Build `scripts-js/`
|
# Build `scripts-js/`
|
||||||
|
(
|
||||||
cd "$SCRIPTS_JS_DIR"
|
cd "$SCRIPTS_JS_DIR"
|
||||||
yarn install
|
yarn install
|
||||||
yarn build
|
yarn build
|
||||||
cd -
|
)
|
||||||
|
|
||||||
# Preverify PR
|
# Preverify PR
|
||||||
AIO_GITHUB_ORGANIZATION="angular" \
|
AIO_GITHUB_ORGANIZATION="angular" \
|
||||||
|
|
|
@ -15,6 +15,7 @@ readonly PREVERIFY_SCRIPT=aio-builds-setup/scripts/travis-preverify-pr.sh
|
||||||
readonly skipBuild=$([[ "$1" == "--skip-build" ]] && echo "true" || echo "");
|
readonly skipBuild=$([[ "$1" == "--skip-build" ]] && echo "true" || echo "");
|
||||||
readonly relevantChangedFilesCount=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -P "^(?:aio|packages)/(?!.*[._]spec\.[jt]s$)" | wc -l)
|
readonly relevantChangedFilesCount=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -P "^(?:aio|packages)/(?!.*[._]spec\.[jt]s$)" | wc -l)
|
||||||
|
|
||||||
|
(
|
||||||
cd "`dirname $0`/.."
|
cd "`dirname $0`/.."
|
||||||
|
|
||||||
# Do not deploy unless this PR has touched relevant files: `aio/` or `packages/` (except for spec files)
|
# Do not deploy unless this PR has touched relevant files: `aio/` or `packages/` (except for spec files)
|
||||||
|
@ -69,5 +70,4 @@ fi
|
||||||
|
|
||||||
# Run PWA-score tests
|
# Run PWA-score tests
|
||||||
yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE"
|
yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE"
|
||||||
|
)
|
||||||
cd -
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ set +x -eu -o pipefail
|
||||||
FIREBASE_PROJECT_ID=aio-staging
|
FIREBASE_PROJECT_ID=aio-staging
|
||||||
DEPLOYED_URL=https://$FIREBASE_PROJECT_ID.firebaseapp.com
|
DEPLOYED_URL=https://$FIREBASE_PROJECT_ID.firebaseapp.com
|
||||||
|
|
||||||
|
(
|
||||||
cd "`dirname $0`/.."
|
cd "`dirname $0`/.."
|
||||||
|
|
||||||
# Build the app
|
# Build the app
|
||||||
|
@ -20,5 +21,4 @@ firebase deploy --message "Commit: $TRAVIS_COMMIT" --non-interactive --token "$F
|
||||||
# TODO(gkalpak): Figure out why this fails and re-enable.
|
# TODO(gkalpak): Figure out why this fails and re-enable.
|
||||||
sleep 10
|
sleep 10
|
||||||
yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE" || true
|
yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE" || true
|
||||||
|
)
|
||||||
cd -
|
|
||||||
|
|
6
build.sh
6
build.sh
|
@ -362,6 +362,7 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
|
||||||
travisFoldStart "copy e2e files" "no-xtrace"
|
travisFoldStart "copy e2e files" "no-xtrace"
|
||||||
mkdir -p ./dist/all/
|
mkdir -p ./dist/all/
|
||||||
|
|
||||||
|
(
|
||||||
echo "====== Copying files needed for e2e tests ====="
|
echo "====== Copying files needed for e2e tests ====="
|
||||||
cp -r ./modules/playground ./dist/all/
|
cp -r ./modules/playground ./dist/all/
|
||||||
cp -r ./modules/playground/favicon.ico ./dist/
|
cp -r ./modules/playground/favicon.ico ./dist/
|
||||||
|
@ -377,8 +378,9 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
|
||||||
ln -s ../../../../node_modules/rxjs .
|
ln -s ../../../../node_modules/rxjs .
|
||||||
ln -s ../../../../node_modules/angular/angular.js .
|
ln -s ../../../../node_modules/angular/angular.js .
|
||||||
ln -s ../../../../node_modules/hammerjs/hammer.js .
|
ln -s ../../../../node_modules/hammerjs/hammer.js .
|
||||||
cd -
|
)
|
||||||
|
|
||||||
|
(
|
||||||
echo "====== Copying files needed for benchmarks ====="
|
echo "====== Copying files needed for benchmarks ====="
|
||||||
cp -r ./modules/benchmarks ./dist/all/
|
cp -r ./modules/benchmarks ./dist/all/
|
||||||
cp -r ./modules/benchmarks/favicon.ico ./dist/
|
cp -r ./modules/benchmarks/favicon.ico ./dist/
|
||||||
|
@ -393,7 +395,7 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then
|
||||||
ln -s ../../../../node_modules/angular/angular.js .
|
ln -s ../../../../node_modules/angular/angular.js .
|
||||||
ln -s ../../../../bower_components/polymer .
|
ln -s ../../../../bower_components/polymer .
|
||||||
ln -s ../../../../node_modules/incremental-dom/dist/incremental-dom-cjs.js
|
ln -s ../../../../node_modules/incremental-dom/dist/incremental-dom-cjs.js
|
||||||
cd -
|
)
|
||||||
travisFoldEnd "copy e2e files"
|
travisFoldEnd "copy e2e files"
|
||||||
|
|
||||||
TSCONFIG="packages/tsconfig.json"
|
TSCONFIG="packages/tsconfig.json"
|
||||||
|
|
|
@ -40,6 +40,7 @@ travisFoldEnd "tsc a bunch of useless stuff"
|
||||||
# Build angular.io
|
# Build angular.io
|
||||||
if [[ ${CI_MODE:-} == "aio" ]]; then
|
if [[ ${CI_MODE:-} == "aio" ]]; then
|
||||||
travisFoldStart "build.aio"
|
travisFoldStart "build.aio"
|
||||||
|
(
|
||||||
cd "`dirname $0`/../../aio"
|
cd "`dirname $0`/../../aio"
|
||||||
yarn build
|
yarn build
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ if [[ ${CI_MODE:-} == "aio" ]]; then
|
||||||
yarn deploy-preview -- --skip-build
|
yarn deploy-preview -- --skip-build
|
||||||
travisFoldEnd "deploy.aio.pr-preview"
|
travisFoldEnd "deploy.aio.pr-preview"
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
cd -
|
|
||||||
travisFoldEnd "build.aio"
|
travisFoldEnd "build.aio"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -30,11 +30,12 @@ function prepare {
|
||||||
|
|
||||||
|
|
||||||
if [ -d "$REPO_DIR" ]; then
|
if [ -d "$REPO_DIR" ]; then
|
||||||
|
(
|
||||||
cd $REPO_DIR
|
cd $REPO_DIR
|
||||||
git fetch --update-shallow origin
|
git fetch --update-shallow origin
|
||||||
git checkout master
|
git checkout master
|
||||||
git merge --ff-only origin/master
|
git merge --ff-only origin/master
|
||||||
cd -
|
)
|
||||||
else
|
else
|
||||||
echo "-- Cloning code.angularjs.org into $REPO_DIR"
|
echo "-- Cloning code.angularjs.org into $REPO_DIR"
|
||||||
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
|
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
|
||||||
|
|
Loading…
Reference in New Issue