From 808bd4af41bbd5452490748b7a70fc8361c61bea Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Mon, 19 Jun 2017 01:17:10 +0300 Subject: [PATCH] ci(aio): deploy previews for all PRs PRs that could not be automatically verified will not be publicly accessible, until manually verified. --- aio/scripts/deploy-preview.sh | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/aio/scripts/deploy-preview.sh b/aio/scripts/deploy-preview.sh index b1ff1e7617..c5e6bb6478 100755 --- a/aio/scripts/deploy-preview.sh +++ b/aio/scripts/deploy-preview.sh @@ -10,7 +10,6 @@ readonly OUTPUT_FILE=/tmp/snapshot.tar.gz readonly AIO_BUILDS_DOMAIN=ngbuilds.io readonly UPLOAD_URL=https://$AIO_BUILDS_DOMAIN/create-build/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA readonly DEPLOYED_URL=https://pr$TRAVIS_PULL_REQUEST-$TRAVIS_PULL_REQUEST_SHA.$AIO_BUILDS_DOMAIN -readonly PREVERIFY_SCRIPT=aio-builds-setup/scripts/travis-preverify-pr.sh 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) @@ -24,28 +23,6 @@ readonly relevantChangedFilesCount=$(git diff --name-only $TRAVIS_COMMIT_RANGE | exit 0 fi - # Do not deploy unless this PR meets certain preconditions. - readonly preverifyExitCode=$($PREVERIFY_SCRIPT > /dev/fd/3 && echo 0 || echo $?) - case $preverifyExitCode in - 0) - # Preconditions met: Deploy - ;; - 1) - # An error occurred: Fail the script - exit 1 - ;; - 2) - # Preconditions not met: Skip deploy - echo "Skipping deploy because this PR did not meet the preconditions." - exit 0 - ;; - *) - # Unexpected exit code: Fail the script - echo "Unexpected pre-verification exit code: $preverifyExitCode" - exit 1 - ;; - esac - # Build the app if [ "$skipBuild" != "true" ]; then yarn build @@ -68,6 +45,9 @@ readonly relevantChangedFilesCount=$(git diff --name-only $TRAVIS_COMMIT_RANGE | exit 1 fi - # Run PWA-score tests - yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE" "$PWA_RESULTS_LOG" + # Run PWA-score tests (unless the deployment is not public yet; + # i.e. it could not be automatically verified). + if [ $httpCode -ne 202 ]; then + yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE" "$PWA_RESULTS_LOG" + fi )