Skip to content

Commit 27c9c33

Browse files
clydindgp1130
authored andcommitted
ci: move snapshot E2E tests to GHA
The E2E snapshot tests have now been migrated to use Github Actions instead of CircleCI. The CircleCI jobs and workflow configuration for the test execution have also been removed. The CircleCI dynamic configuration aspects are still present to minimize the changeset complexity and will be removed in a future change. The snapshot tests are guarded by a new analyze job which checks for a change to the `tests/legacy-cli/e2e/ng-snapshot/package.json` file which is used to store the snapshot commit SHAs for the relevant Angular packages used in tests. This job based guard approach allows the entire set of snapshot E2E jobs to be skipped when not required. Additionally, a single skipped PR status entry is created.
1 parent 89f21ac commit 27c9c33

File tree

2 files changed

+40
-77
lines changed

2 files changed

+40
-77
lines changed

.circleci/dynamic_config.yml

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,11 @@ parameters:
2424
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
2525
var_1: &cache_key v1-angular_devkit-16.14-{{ checksum "yarn.lock" }}
2626
var_3: &default_nodeversion '18.13'
27-
var_3_major: &default_nodeversion_major '18'
28-
# The major version of node toolchains. See tools/toolchain_info.bzl
29-
# NOTE: entries in this array may be repeated elsewhere in the file, find them before adding more
30-
var_3_all_major: &all_nodeversion_major ['18']
27+
3128
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
3229
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
3330
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
3431
var_4: &workspace_location .
35-
# Filter to only release branches on a given job.
36-
var_5_only_releases: &only_release_branches
37-
filters:
38-
branches:
39-
only:
40-
- main
41-
- /\d+\.\d+\.x/
42-
var_5_only_snapshots: &only_snapshot_branches
43-
filters:
44-
branches:
45-
only:
46-
- main
47-
# This is needed to run this steps on Renovate PRs that amend the snapshots package.json
48-
- /^pull\/.*/
49-
50-
var_6: &only_pull_requests
51-
filters:
52-
branches:
53-
only:
54-
- /pull\/\d+/
5532

5633
var_7: &only_builds_branches
5734
filters:
@@ -61,9 +38,6 @@ var_7: &only_builds_branches
6138
- /\d+\.\d+\.x/
6239
- ^feature\-.*
6340

64-
# All e2e test suites
65-
var_8: &all_e2e_subsets ['npm', 'esbuild', 'yarn']
66-
6741
# Executor Definitions
6842
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
6943
executors:
@@ -170,35 +144,6 @@ jobs:
170144
command: yarn bazel build //...
171145
- fail_fast
172146

173-
e2e-tests:
174-
executor: bazel-executor
175-
parallelism: 8
176-
parameters:
177-
nodeversion:
178-
type: string
179-
default: *default_nodeversion
180-
snapshots:
181-
type: boolean
182-
default: false
183-
subset:
184-
type: enum
185-
enum: *all_e2e_subsets
186-
default: 'npm'
187-
steps:
188-
- custom_attach_workspace
189-
- initialize_env
190-
- setup_bazel_rbe
191-
- run: mkdir /mnt/ramdisk/e2e
192-
- run:
193-
name: Execute CLI E2E Tests with << parameters.subset >>
194-
command: yarn bazel test --define=E2E_TEMP=/mnt/ramdisk/e2e --define=E2E_SHARD_TOTAL=${CIRCLE_NODE_TOTAL} --define=E2E_SHARD_INDEX=${CIRCLE_NODE_INDEX} --config=e2e //tests/legacy-cli:e2e<<# parameters.snapshots >>.snapshots<</ parameters.snapshots >>.<< parameters.subset >>_node<< parameters.nodeversion >>
195-
no_output_timeout: 40m
196-
- store_artifacts:
197-
path: dist/testlogs/tests/legacy-cli/e2e<<# parameters.snapshots >>.snapshots<</ parameters.snapshots >>.<< parameters.subset >>_node<< parameters.nodeversion >>
198-
- store_test_results:
199-
path: dist/testlogs/tests/legacy-cli/e2e<<# parameters.snapshots >>.snapshots<</ parameters.snapshots >>.<< parameters.subset >>_node<< parameters.nodeversion >>
200-
- fail_fast
201-
202147
test-browsers:
203148
executor: bazel-executor
204149
steps:
@@ -247,27 +192,6 @@ workflows:
247192
requires:
248193
- setup
249194

250-
- e2e-tests:
251-
name: e2e-snapshots-<< matrix.subset >>
252-
nodeversion: *default_nodeversion_major
253-
matrix:
254-
parameters:
255-
subset: *all_e2e_subsets
256-
snapshots: true
257-
pre-steps:
258-
- when:
259-
# Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
260-
condition:
261-
and:
262-
- not:
263-
equal: [main, << pipeline.git.branch >>]
264-
- not: << pipeline.parameters.snapshot_changed >>
265-
steps:
266-
- run: circleci-agent step halt
267-
requires:
268-
- build
269-
<<: *only_snapshot_branches
270-
271195
- test-browsers:
272196
requires:
273197
- build

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ defaults:
1919
shell: bash
2020

2121
jobs:
22+
analyze:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
snapshots: ${{ steps.filter.outputs.snapshots }}
26+
steps:
27+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
28+
with:
29+
persist-credentials: false
30+
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
31+
id: filter
32+
with:
33+
filters: |
34+
snapshots:
35+
- 'tests/legacy-cli/e2e/ng-snapshot/package.json'
36+
2237
lint:
2338
runs-on: ubuntu-latest
2439
steps:
@@ -130,3 +145,27 @@ jobs:
130145
uses: angular/dev-infra/github-actions/bazel/configure-remote@ad327ca5766ef5dbf071a37056cee034bee258cd
131146
- name: Run CLI E2E tests
132147
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
148+
149+
e2e-snapshots:
150+
needs: analyze
151+
if: needs.analyze.outputs.snapshots == 'true' || github.event_name == 'push'
152+
strategy:
153+
matrix:
154+
os: [ubuntu-latest]
155+
node: [18]
156+
subset: [npm, yarn, esbuild]
157+
shard: [0, 1, 2, 3, 4, 5]
158+
runs-on: ${{ matrix.os }}
159+
steps:
160+
- name: Initialize environment
161+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ad327ca5766ef5dbf071a37056cee034bee258cd
162+
with:
163+
fetch-depth: 1
164+
- name: Install node modules
165+
run: yarn install --frozen-lockfile
166+
- name: Setup Bazel
167+
uses: angular/dev-infra/github-actions/bazel/setup@ad327ca5766ef5dbf071a37056cee034bee258cd
168+
- name: Setup Bazel RBE
169+
uses: angular/dev-infra/github-actions/bazel/configure-remote@ad327ca5766ef5dbf071a37056cee034bee258cd
170+
- name: Run CLI E2E tests
171+
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}

0 commit comments

Comments
 (0)