From 202f1809ad14827a6ac6a125157c605d65e0b551 Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 25 Oct 2017 10:44:55 +0200 Subject: [PATCH] chore(travis): fix deploy conditions Closes #16296 --- .travis.yml | 31 ++++++++++++++++++++----------- scripts/travis/build.sh | 12 ++++++++---- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a39e7e244c2..6a4d3b139250 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,22 +54,31 @@ jobs: include: - stage: deploy # Don't deploy from PRs. - # The deployment logic for pushed branches is defined in scripts\travis\build.sh + # This is a Travis-specific boolean language: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions + # The deployment logic for pushed branches is further defined in scripts\travis\build.sh if: type != pull_request env: - JOB=deploy before_script: skip script: - - "./scripts/travis/build.sh" + # Export the variables into the current process + - . ./scripts/travis/build.sh + - "echo DEPLOY_DOCS: $DEPLOY_DOCS, DEPLOY_CODE: $DEPLOY_CODE" + after_script: skip # Work around the 10min Travis timeout so the code.angularjs firebase+gcs code deploy can complete + # Only run the keep_alive once (before_deploy is run for each provider) before_deploy: | - function keep_alive() { - while true; do - echo -en "\a" - sleep 5 - done - } - keep_alive & + if ! [ "$BEFORE_DEPLOY_RUN" ]; then + export BEFORE_DEPLOY_RUN=1; + + function keep_alive() { + while true; do + echo -en "\a" + sleep 10 + done + } + keep_alive & + fi deploy: - provider: firebase # the upload folder for firebase is configured in /firebase.json @@ -79,7 +88,7 @@ jobs: on: repo: angular/angular.js all_branches: true - condition: $DEPLOY_DOCS + condition: "$DEPLOY_DOCS == true" - provider: gcs skip_cleanup: true access_key_id: GOOGLDB7W2J3LFHICF3R @@ -91,5 +100,5 @@ jobs: on: repo: angular/angular.js all_branches: true - condition: $DEPLOY_CODE + condition: "$DEPLOY_CODE == true" diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index b4e0f4e29d46..f59711467e99 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -46,13 +46,13 @@ case "$JOB" in export USE_JQUERY=1 fi - export TARGET_SPECS="build/docs/ptore2e/**/default_test.js" - if [[ "$TEST_TARGET" == jquery* ]]; then TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js" + else + TARGET_SPECS="build/docs/ptore2e/**/default_test.js" fi - export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS" + TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS" grunt test:travis-protractor --specs="$TARGET_SPECS" ;; "deploy") @@ -64,6 +64,8 @@ case "$JOB" in # upload docs if the branch distTag from package.json is "latest" (i.e. stable branch) if [[ "$DIST_TAG" == latest ]]; then DEPLOY_DOCS=true + else + DEPLOY_DOCS=false fi # upload the build (code + docs) if ... @@ -72,9 +74,11 @@ case "$JOB" in # - or the branch distTag from package.json is "latest" (i.e. stable branch) if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then DEPLOY_CODE=true + else + DEPLOY_CODE=false fi - if [[ "$DEPLOY_DOCS" || "$DEPLOY_CODE" ]]; then + if [[ "$DEPLOY_DOCS" == true || "$DEPLOY_CODE" == true ]]; then grunt prepareFirebaseDeploy else echo "Skipping deployment build because conditions have not been met."