Skip to content

Commit

Permalink
ci: migrate snapshot test to Github Actions
Browse files Browse the repository at this point in the history
Move snapshot test from CircleCI to Github Actions, additionally runs the tests every 4 hours instead of once per hour.

(cherry picked from commit cddd036)
  • Loading branch information
josephperrott committed Oct 19, 2023
1 parent 91476e0 commit 07f0fda
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 75 deletions.
75 changes: 0 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,72 +309,6 @@ jobs:
- run: ./scripts/circleci/publish-snapshots.sh
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs the browser tests against the Angular Github snapshots
# ----------------------------------------------------------------------------
snapshot_tests_browsers:
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- checkout_and_rebase
- *restore_cache
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *setup_snapshot_builds
- *yarn_install_loose_lockfile
- *setup_bazel_binary

- run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs both AOT and JIT linker tests against Angular snapshot builds.
# ----------------------------------------------------------------------------
snapshot_linker_tests:
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- checkout_and_rebase
- *restore_cache
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *setup_snapshot_builds
- *yarn_install_loose_lockfile
- *setup_bazel_binary

- run: yarn test-linker-aot
- run: yarn test-linker-jit
- *slack_notify_on_failure

# ----------------------------------------------------------------------------
# Job that runs all Bazel tests against material-components-web@canary
# ----------------------------------------------------------------------------
mdc_snapshot_test_cronjob:
<<: *job_defaults
resource_class: xlarge
environment:
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
steps:
- checkout_and_rebase
- *restore_cache
- *yarn_install_loose_lockfile
- *setup_bazel_binary
- *setup_bazel_ci_config
- *setup_bazel_remote_execution
- *yarn_install

# Install the latest canary version of the "material-components-web".
- run: node ./scripts/circleci/setup-mdc-canary.js

# Setup the components repository to use the MDC snapshot builds.
# Run project tests with the MDC canary builds.
- run: bazel test --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
- *slack_notify_on_failure

# ----------------------------------------------------------------------------------------
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
# one job depends on another.
Expand Down Expand Up @@ -410,15 +344,6 @@ workflows:
# This workflow runs various jobs against the Angular snapshot builds from Github.
snapshot_tests:
jobs:
# Note that we need additional jobs for the cronjob snapshot tests because there
# is no easy way to detect whether a job runs inside of a cronjob or specific
# workflow. See: https://circleci.com/ideas/?idea=CCI-I-295
- snapshot_tests_browsers:
filters: *only_main_branch_filter
- mdc_snapshot_test_cronjob:
filters: *only_main_branch_filter
- snapshot_linker_tests:
filters: *only_main_branch_filter
- monitor_docs_site:
filters: *only_main_branch_filter

Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/scheduled-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Scheduled CI

on:
schedule:
- cron: '0 0/4 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

defaults:
run:
shell: bash

jobs:
test_browsers:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@fb30926790c6225d553b91a4818cab2fdde4fb4e
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setting up Angular snapshot builds
# Angular snapshots must be set up first so that the yarn install properly
# updates the yarn.lock as expected with the changes
run: node ./scripts/circleci/setup-angular-snapshots.js main
- name: Install node modules
run: yarn install
- name: Run Browser tests
run: yarn bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
- name: Notify about failed test
if: ${{ failure() }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0
with:
channel-id: 'C015EBF2XB6'
slack-message: 'Browser snapshot test job failed for ${{ github.base_ref }} branch failed on build ${{ github.event.after }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
env:
SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }}

linker_tests:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@fb30926790c6225d553b91a4818cab2fdde4fb4e
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setting up Angular snapshot builds
# Angular snapshots must be set up first so that the yarn install properly
# updates the yarn.lock as expected with the changes
run: node ./scripts/circleci/setup-angular-snapshots.js main
- name: Install node modules
run: yarn install
- name: Run linker tests using AOT
run: yarn test-linker-aot
- name: Run linker tests using JIT
run: yarn test-linker-jit
- name: Notify about failed test
if: ${{ failure() }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0
with:
channel-id: 'C015EBF2XB6'
slack-message: 'Snapshot linker test job failed for ${{ github.base_ref }} branch failed on build ${{ github.event.after }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
env:
SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }}

mdc_snapshot_test:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@fb30926790c6225d553b91a4818cab2fdde4fb4e
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@fb30926790c6225d553b91a4818cab2fdde4fb4e
- name: Setting up Angular snapshot builds
# Angular snapshots must be set up first so that the yarn install properly
# updates the yarn.lock as expected with the changes
run: node ./scripts/circleci/setup-angular-snapshots.js main
- name: Install MDC Canary
run: node ./scripts/circleci/setup-mdc-canary.js
- name: Install node modules
run: yarn install
- name: Run browser tests using MDC Canary
run: bazel test --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
- name: Notify about failed test
if: ${{ failure() }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0
with:
channel-id: 'C015EBF2XB6'
slack-message: 'MDC snapshot test job failed for ${{ github.base_ref }} branch failed on build ${{ github.event.after }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
env:
SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }}

0 comments on commit 07f0fda

Please sign in to comment.