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 😉)

PR Close #30110
This commit is contained in:
George Kalpakas 2019-04-25 13:54:10 +03:00 committed by Andrew Kushnir
parent 214fef2ee4
commit 582ef2e7b4
2 changed files with 35 additions and 18 deletions

View File

@ -486,7 +486,7 @@ jobs:
command: 'openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials' command: 'openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials'
- run: ./scripts/ci/publish-build-artifacts.sh - run: ./scripts/ci/publish-build-artifacts.sh
aio_monitoring: aio_monitoring_stable:
<<: *job_defaults <<: *job_defaults
docker: docker:
# This job needs Chrome to be globally installed because the tests run with Protractor # This job needs Chrome to be globally installed because the tests run with Protractor
@ -496,8 +496,27 @@ jobs:
- *attach_workspace - *attach_workspace
- *init_environment - *init_environment
- run: - run:
name: Run tests against the deployed apps name: Run tests against https://angular.io/
command: ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE 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: - run:
name: Notify caretaker about failure name: Notify caretaker about failure
# `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings. # `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings.
@ -690,12 +709,15 @@ workflows:
aio_monitoring: aio_monitoring:
jobs: jobs:
- setup - setup
- aio_monitoring: - aio_monitoring_stable:
requires:
- setup
- aio_monitoring_next:
requires: requires:
- setup - setup
triggers: triggers:
- schedule: - schedule:
# Runs AIO monitoring job at 00:00AM every day. # Runs AIO monitoring jobs at 00:00AM every day.
cron: "0 0 * * *" cron: "0 0 * * *"
filters: filters:
branches: branches:

View File

@ -6,11 +6,8 @@ set +x -eu -o pipefail
readonly aioDir="$(realpath $thisDir/..)" readonly aioDir="$(realpath $thisDir/..)"
readonly protractorConf="$aioDir/tests/deployment/e2e/protractor.conf.js" readonly protractorConf="$aioDir/tests/deployment/e2e/protractor.conf.js"
readonly minPwaScore="$1" readonly targetUrl="$1"
readonly urls=( readonly minPwaScore="$2"
"https://angular.io/"
"https://next.angular.io/"
)
cd "$aioDir" cd "$aioDir"
@ -19,16 +16,14 @@ set +x -eu -o pipefail
yarn install --frozen-lockfile --non-interactive yarn install --frozen-lockfile --non-interactive
yarn update-webdriver yarn update-webdriver
# Run checks for all URLs. # Run checks for target URL.
for url in "${urls[@]}"; do echo -e "\nChecking '$targetUrl'...\n-----"
echo -e "\nChecking '$url'...\n-----"
# Run basic e2e and deployment config tests. # Run basic e2e and deployment config tests.
yarn protractor "$protractorConf" --baseUrl "$url" yarn protractor "$protractorConf" --baseUrl "$targetUrl"
# Run PWA-score tests. # Run PWA-score tests.
yarn test-pwa-score "$url" "$minPwaScore" yarn test-pwa-score "$targetUrl" "$minPwaScore"
done
echo -e "\nAll checks passed!" echo -e "\nAll checks passed!"
) )