From 582ef2e7b4ad9a1c76d9ea27b6836b46590327ea Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 25 Apr 2019 13:54:10 +0300 Subject: [PATCH] ci(docs-infra): split the `aio_monitoring` CircleCI job into two jobs (#30110) Previously, the `aio_monitoring` job was testing both the stable (https://angular.io/) and the @next (https://next.angular.io/) versions. This commit splits the tests into two separate jobs (still run as part of the same workflow). This speeds up the tests (since the two jobs can now run in parallel) and makes it easier to isolate failures (e.g. identify which branch is failing, disable one of the two, etc.). (Credits to @petebacondarwin :wink:) PR Close #30110 --- .circleci/config.yml | 32 +++++++++++++++++++++++++++----- aio/scripts/test-production.sh | 21 ++++++++------------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ceaa06fbdb..89cd859aad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -486,7 +486,7 @@ jobs: command: 'openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials' - run: ./scripts/ci/publish-build-artifacts.sh - aio_monitoring: + aio_monitoring_stable: <<: *job_defaults docker: # This job needs Chrome to be globally installed because the tests run with Protractor @@ -496,8 +496,27 @@ jobs: - *attach_workspace - *init_environment - run: - name: Run tests against the deployed apps - command: ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE + name: Run tests against https://angular.io/ + command: ./aio/scripts/test-production.sh https://angular.io/ $CI_AIO_MIN_PWA_SCORE + - run: + name: Notify caretaker about failure + # `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings. + # The URL comes from https://angular-team.slack.com/apps/A0F7VRE7N-circleci. + command: 'curl --request POST --header "Content-Type: application/json" --data "{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}" $SLACK_CARETAKER_WEBHOOK_URL' + when: on_fail + + aio_monitoring_next: + <<: *job_defaults + docker: + # This job needs Chrome to be globally installed because the tests run with Protractor + # which does not load the browser through the Bazel webtesting rules. + - image: *browsers_docker_image + steps: + - *attach_workspace + - *init_environment + - run: + name: Run tests against https://next.angular.io/ + command: ./aio/scripts/test-production.sh https://next.angular.io/ $CI_AIO_MIN_PWA_SCORE - run: name: Notify caretaker about failure # `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings. @@ -690,12 +709,15 @@ workflows: aio_monitoring: jobs: - setup - - aio_monitoring: + - aio_monitoring_stable: + requires: + - setup + - aio_monitoring_next: requires: - setup triggers: - schedule: - # Runs AIO monitoring job at 00:00AM every day. + # Runs AIO monitoring jobs at 00:00AM every day. cron: "0 0 * * *" filters: branches: diff --git a/aio/scripts/test-production.sh b/aio/scripts/test-production.sh index 1441ab72ff..a79ee210c9 100755 --- a/aio/scripts/test-production.sh +++ b/aio/scripts/test-production.sh @@ -6,11 +6,8 @@ set +x -eu -o pipefail readonly aioDir="$(realpath $thisDir/..)" readonly protractorConf="$aioDir/tests/deployment/e2e/protractor.conf.js" - readonly minPwaScore="$1" - readonly urls=( - "https://angular.io/" - "https://next.angular.io/" - ) + readonly targetUrl="$1" + readonly minPwaScore="$2" cd "$aioDir" @@ -19,16 +16,14 @@ set +x -eu -o pipefail yarn install --frozen-lockfile --non-interactive yarn update-webdriver - # Run checks for all URLs. - for url in "${urls[@]}"; do - echo -e "\nChecking '$url'...\n-----" + # Run checks for target URL. + echo -e "\nChecking '$targetUrl'...\n-----" - # Run basic e2e and deployment config tests. - yarn protractor "$protractorConf" --baseUrl "$url" + # Run basic e2e and deployment config tests. + yarn protractor "$protractorConf" --baseUrl "$targetUrl" - # Run PWA-score tests. - yarn test-pwa-score "$url" "$minPwaScore" - done + # Run PWA-score tests. + yarn test-pwa-score "$targetUrl" "$minPwaScore" echo -e "\nAll checks passed!" )