Skip to content

Commit d84612e

Browse files
devversionjelbourn
authored andcommitted
build: conditional travis build stages (#9949)
No longer runs the build artifacts, docs-content, dashboard, screenshot deployment tasks on Pull Requests. This means that there aren't any noop jobs running anymore
1 parent 4c3e385 commit d84612e

File tree

4 files changed

+19
-45
lines changed

4 files changed

+19
-45
lines changed

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ jobs:
2626
- env: "MODE=aot"
2727
- env: "MODE=payload"
2828
- env: "MODE=prerender"
29-
# Closure Compiler CI check is temporarily disabled until a new version of
30-
# the tool is released with https://github.com/google/closure-compiler/pull/2600
31-
# - env: "MODE=closure-compiler"
3229
- env: "MODE=e2e"
3330
- env: "MODE=saucelabs_required"
3431
- env: "MODE=browserstack_required"
3532
- env: "MODE=travis_required"
3633
- env: "DEPLOY_MODE=build-artifacts"
34+
if: type = push
3735
- env: "DEPLOY_MODE=docs-content"
36+
if: type = push
3837
- env: "DEPLOY_MODE=screenshot-tool"
38+
if: type = cron
3939
- env: "DEPLOY_MODE=dashboard"
40+
if: type = cron
41+
# Closure Compiler CI check is temporarily disabled until a new version of
42+
# the tool is released with https://github.com/google/closure-compiler/pull/2600
43+
# - env: "MODE=closure-compiler"
4044
env:
4145
global:
4246
- LOGS_DIR=/tmp/angular-material2-build/logs

scripts/ci/travis-deploy.sh

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,19 @@ cd $(dirname $0)/../..
1212
# Load the retry-call utility function.
1313
source scripts/retry-call.sh
1414

15-
# If the current Travis job is triggered by a pull request skip the deployment.
16-
# This check is necessary because Travis still tries to run the deploy build-stage for
17-
# pull requests.
18-
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
19-
echo "Build artifacts and docs content will only be deployed in Travis push builds."
20-
exit 0;
21-
fi
22-
2315
# Variable the specifies how often the deploy script should be invoked if it fails.
2416
DEPLOY_RETRIES=1
2517

2618
echo ""
2719
echo "Starting the deployment script. Running mode: ${DEPLOY_MODE}"
2820
echo ""
2921

30-
# Deployment of the screenshot tool or dashboard should happen inside of a Cronjob.
31-
# For example, always deploying the screenshot functions on a per-commit base might cause problems
32-
# with the screenshot tests, because the functions can be non-responsive for a few seconds.
33-
if [[ "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then
34-
if [[ "${DEPLOY_MODE}" == "screenshot-tool" ]]; then
35-
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-screenshot-tool.sh
36-
elif [[ "${DEPLOY_MODE}" == "dashboard" ]]; then
37-
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-dashboard.sh
38-
else
39-
echo "Docs content and build artifacts won't be published in Travis cronjobs."
40-
fi
41-
42-
# Deployment of the build artifacts and docs-content should only happen on a per-commit base.
43-
# The target is to provide build artifacts in the GitHub repository for every commit.
44-
else
45-
if [[ "${DEPLOY_MODE}" == "build-artifacts" ]]; then
46-
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-build-artifacts.sh
47-
elif [[ "${DEPLOY_MODE}" == "docs-content" ]]; then
48-
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-docs-content.sh
49-
else
50-
echo "The dashboard and screenshot-tool will only be deployed in Travis cronjobs."
51-
fi
22+
if [[ "${DEPLOY_MODE}" == "screenshot-tool" ]]; then
23+
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-screenshot-tool.sh
24+
elif [[ "${DEPLOY_MODE}" == "dashboard" ]]; then
25+
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-dashboard.sh
26+
elif [[ "${DEPLOY_MODE}" == "build-artifacts" ]]; then
27+
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-build-artifacts.sh
28+
elif [[ "${DEPLOY_MODE}" == "docs-content" ]]; then
29+
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-docs-content.sh
5230
fi

scripts/ci/travis-env.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/bin/bash
22

3-
if [[ -z "${TRAVIS}" ]]; then
4-
echo "This script can only setup the environment inside of Travis builds"
5-
exit 0
6-
fi
7-
8-
# If FIREBASE_ACCESS_TOKEN not set yet, export the FIREBASE_ACCESS_TOKEN using the JWT token that Travis generated and exported for SAUCE_ACCESS_KEY.
3+
# If FIREBASE_ACCESS_TOKEN not set yet, export the FIREBASE_ACCESS_TOKEN using the JWT token that
4+
# Travis generated and exported for SAUCE_ACCESS_KEY.
95
# This is a workaround for travis-ci/travis-ci#7223
106
# WARNING: FIREBASE_ACCESS_TOKEN should NOT be printed
117
export FIREBASE_ACCESS_TOKEN=${FIREBASE_ACCESS_TOKEN:-$SAUCE_ACCESS_KEY}
128

13-
# - we overwrite the value set by Travis JWT addon here to work around travis-ci/travis-ci#7223 for FIREBASE_ACCESS_TOKEN
9+
# - we overwrite the value set by Travis JWT addon here to work around travis-ci/travis-ci#7223
10+
# for FIREBASE_ACCESS_TOKEN
1411
export SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987

scripts/ci/travis-script.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ set -e
99
# Go to project directory
1010
cd $(dirname $0)/../..
1111

12-
if [[ -z "$TRAVIS" ]]; then
13-
echo "This script can only run inside of Travis build jobs."
14-
exit 1
15-
fi
16-
1712
if [[ "${MODE}" ]]; then
1813
./scripts/ci/travis-testing.sh
1914
elif [[ "${DEPLOY_MODE}" ]]; then

0 commit comments

Comments
 (0)