Skip to content

Commit 150e530

Browse files
alan-agius4angular-robot[bot]
authored andcommitted
ci: enable E2E tests on multiple node versions
This commit sets ups Node 18 tool chain and also configures E2E tests to use multiple tools chains to retain the same behaviour prior to switching the e2e tests to Bazel.
1 parent f30a69f commit 150e530

File tree

5 files changed

+64
-20
lines changed

5 files changed

+64
-20
lines changed

.circleci/dynamic_config.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var_3: &default_nodeversion '14.20'
2929
var_3_major: &default_nodeversion_major '14'
3030
# The major version of node toolchains. See tools/toolchain_info.bzl
3131
# NOTE: entries in this array may be repeated elsewhere in the file, find them before adding more
32-
var_3_all_major: &all_nodeversion_major ['14', '16']
32+
var_3_all_major: &all_nodeversion_major ['14', '16', '18']
3333
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
3434
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
3535
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
@@ -236,7 +236,7 @@ jobs:
236236
equal: [*default_nodeversion_major, << parameters.nodeversion >>]
237237
steps:
238238
- run:
239-
command: yarn bazel test --test_tag_filters=-node16,-node<< parameters.nodeversion >>-broken //packages/...
239+
command: yarn bazel test --test_tag_filters=-node16,-node18,-node<< parameters.nodeversion >>-broken //packages/...
240240
# This timeout provides time for the actual tests to timeout and report status
241241
# instead of CircleCI stopping the job without test failure information.
242242
no_output_timeout: 40m
@@ -257,6 +257,9 @@ jobs:
257257
executor: bazel-executor
258258
parallelism: 8
259259
parameters:
260+
nodeversion:
261+
type: string
262+
default: *default_nodeversion
260263
snapshots:
261264
type: boolean
262265
default: false
@@ -271,12 +274,12 @@ jobs:
271274
- run: mkdir /mnt/ramdisk/e2e
272275
- run:
273276
name: Execute CLI E2E Tests with << parameters.subset >>
274-
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 >>
277+
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 >>
275278
no_output_timeout: 40m
276279
- store_artifacts:
277-
path: dist/testlogs/tests/legacy-cli/e2e.<< parameters.subset >>
280+
path: dist/testlogs/tests/legacy-cli/e2e.<<parameters.nodeversion>>.<< parameters.subset >>
278281
- store_test_results:
279-
path: dist/testlogs/tests/legacy-cli/e2e.<< parameters.subset >>
282+
path: dist/testlogs/tests/legacy-cli/e2e.<<parameters.nodeversion>>.<< parameters.subset >>
280283
- fail_fast
281284

282285
test-browsers:
@@ -367,7 +370,7 @@ jobs:
367370
PWD: .
368371
command: |
369372
mkdir X:/ramdisk/e2e
370-
bazel test --define=E2E_TEMP=X:/ramdisk/e2e --define=E2E_SHARD_TOTAL=$env:CIRCLE_NODE_TOTAL --define=E2E_SHARD_INDEX=$env:CIRCLE_NODE_INDEX --config=e2e //tests/legacy-cli:e2e.npm
373+
bazel test --define=E2E_TEMP=X:/ramdisk/e2e --define=E2E_SHARD_TOTAL=$env:CIRCLE_NODE_TOTAL --define=E2E_SHARD_INDEX=$env:CIRCLE_NODE_INDEX --config=e2e //tests/legacy-cli:e2e.npm_node16
371374
# This timeout provides time for the actual tests to timeout and report status
372375
# instead of CircleCI stopping the job without test failure information.
373376
no_output_timeout: 40m
@@ -396,7 +399,10 @@ workflows:
396399
name: test-node<< matrix.nodeversion >>
397400
matrix:
398401
parameters:
399-
nodeversion: *all_nodeversion_major
402+
# Disable running this on Node.js 18 for now. This causes failures when using RBE.
403+
# Example: `GLIBC_2.28' not found.
404+
# Likely this is caused by outdated Ubuntu image https://github.com/angular/dev-infra/blob/main/bazel/remote-execution/BUILD.bazel#L21
405+
nodeversion: ['14', '16']
400406
requires:
401407
- build
402408

@@ -405,18 +411,34 @@ workflows:
405411
requires:
406412
- setup
407413

414+
- e2e-tests:
415+
name: e2e-cli-<< matrix.subset >>
416+
nodeversion: *default_nodeversion_major
417+
matrix:
418+
parameters:
419+
subset: *all_e2e_subsets
420+
filters:
421+
branches:
422+
ignore:
423+
- main
424+
- /\d+\.\d+\.x/
425+
requires:
426+
- build
427+
408428
- e2e-tests:
409429
name: e2e-cli-node-<<matrix.nodeversion>>-<< matrix.subset >>
410430
matrix:
411431
alias: e2e-cli
412432
parameters:
433+
nodeversion: *all_nodeversion_major
413434
subset: *all_e2e_subsets
414-
snapshots: false
415435
requires:
416436
- build
437+
<<: *only_release_branches
417438

418439
- e2e-tests:
419440
name: e2e-snapshots-<< matrix.subset >>
441+
nodeversion: *default_nodeversion_major
420442
matrix:
421443
parameters:
422444
subset: *all_e2e_subsets

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ nodejs_register_toolchains(
9999
node_version = "16.13.1",
100100
)
101101

102+
nodejs_register_toolchains(
103+
name = "node18",
104+
node_version = "18.10.0",
105+
)
106+
102107
register_toolchains(
103108
"@npm//@angular/build-tooling/bazel/git-toolchain:git_linux_toolchain",
104109
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_x86_toolchain",

docs/DEVELOPER.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ You can find more info about debugging [tests with Bazel in the docs.](https://g
8686
### End to end tests
8787

8888
- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//tests/...)"`
89-
- Run a subset of the tests: `yarn bazel test //tests/legacy-cli:e2e --test_filter="tests/i18n/ivy-localize-*"`
90-
- Use `bazel run` to debug failing tests debugging: `yarn bazel run //tests/legacy-cli:e2e --test_arg="--glob=tests/basic/aot.ts"`
89+
- Run a subset of the tests: `yarn bazel test //tests/legacy-cli:e2e_node16 --test_filter="tests/i18n/ivy-localize-*"`
90+
- Use `bazel run` to debug failing tests debugging: `yarn bazel run //tests/legacy-cli:e2e_node16 --test_arg="--glob=tests/basic/aot.ts"`
9191
- Provide additional `e2e_runner` using `--test_arg`: `--test_arg="--yarn"`
9292

9393
When running the debug commands, Node will stop and wait for a debugger to attach.

tests/legacy-cli/e2e.bzl

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
2+
load("//tools:toolchain_info.bzl", "TOOLCHAINS_NAMES", "TOOLCHAINS_VERSIONS")
23

34
# bazel query --output=label "kind('pkg_tar', //packages/...)"
45
TESTED_PACKAGES = [
@@ -54,14 +55,19 @@ def e2e_suites(name, runner, data):
5455
data: runtime deps such as tests and test data
5556
"""
5657

57-
# Default target meant to be run manually for debugging, customizing test cli via bazel
58-
_e2e_tests(name, runner = runner, data = data, tags = ["manual"])
59-
6058
# Pre-configured test suites
61-
# TODO: add node 14 + 16
62-
_e2e_suite(name, runner, "npm", data)
63-
_e2e_suite(name, runner, "yarn", data)
64-
_e2e_suite(name, runner, "esbuild", data)
59+
for toolchain_name, toolchain in zip(
60+
TOOLCHAINS_NAMES,
61+
TOOLCHAINS_VERSIONS,
62+
):
63+
# Default target meant to be run manually for debugging, customizing test cli via bazel
64+
_e2e_tests(name + "_" + toolchain_name, runner, data = data, toolchain = toolchain, tags = ["manual"])
65+
66+
_e2e_suite(name, runner, "npm", data, toolchain_name, toolchain)
67+
_e2e_suite(name, runner, "yarn", data, toolchain_name, toolchain)
68+
_e2e_suite(name, runner, "esbuild", data, toolchain_name, toolchain)
69+
70+
# Saucelabs tests are only run on the default toolchain
6571
_e2e_suite(name, runner, "saucelabs", data)
6672

6773
def _e2e_tests(name, runner, **kwargs):
@@ -107,14 +113,17 @@ def _e2e_tests(name, runner, **kwargs):
107113
**kwargs
108114
)
109115

110-
def _e2e_suite(name, runner, type, data):
116+
def _e2e_suite(name, runner, type, data, toolchain_name = "", toolchain = None):
111117
"""
112118
Setup a predefined test suite (yarn|esbuild|saucelabs|npm).
113119
"""
114120
args = []
115121
tests = None
116122
ignore = None
117123

124+
if toolchain_name:
125+
toolchain_name = "_" + toolchain_name
126+
118127
if type == "yarn":
119128
args.append("--yarn")
120129
tests = YARN_TESTS
@@ -132,10 +141,11 @@ def _e2e_suite(name, runner, type, data):
132141

133142
# Standard e2e tests
134143
_e2e_tests(
135-
name = "%s.%s" % (name, type),
144+
name = "%s.%s%s" % (name, type, toolchain_name),
136145
runner = runner,
137146
size = "enormous",
138147
data = data,
148+
toolchain = toolchain,
139149
shard_count = TEST_SHARD_COUNT,
140150
templated_args = [
141151
"--glob=%s" % _to_glob(tests) if tests else "",
@@ -145,10 +155,11 @@ def _e2e_suite(name, runner, type, data):
145155

146156
# e2e tests of snapshot builds
147157
_e2e_tests(
148-
name = "%s.snapshots.%s" % (name, type),
158+
name = "%s.snapshots.%s%s" % (name, type, toolchain_name),
149159
runner = runner,
150160
size = "enormous",
151161
data = data,
162+
toolchain = toolchain,
152163
shard_count = TEST_SHARD_COUNT,
153164
templated_args = [
154165
"--ng-snapshots",

tools/toolchain_info.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
TOOLCHAINS_NAMES = [
66
"node14",
77
"node16",
8+
"node18",
89
]
910

1011
# this is the list of toolchains that should be used and are registered with nodejs_register_toolchains in the WORKSPACE file
@@ -19,6 +20,11 @@ TOOLCHAINS_VERSIONS = [
1920
"@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain",
2021
"@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_toolchain",
2122
}),
23+
select({
24+
"@bazel_tools//src/conditions:linux_x86_64": "@node18_linux_amd64//:node_toolchain",
25+
"@bazel_tools//src/conditions:darwin": "@node18_darwin_amd64//:node_toolchain",
26+
"@bazel_tools//src/conditions:windows": "@node18_windows_amd64//:node_toolchain",
27+
}),
2228
]
2329

2430
# A default toolchain for use when only one is necessary

0 commit comments

Comments
 (0)