@@ -35,19 +35,27 @@ var_3_all_major: &all_nodeversion_major ['14', '16']
35
35
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
36
36
var_4 : &workspace_location .
37
37
# Filter to only release branches on a given job.
38
- var_5 : &only_release_branches
38
+ var_5_only_releases : &only_release_branches
39
39
filters :
40
40
branches :
41
41
only :
42
42
- main
43
43
- /\d+\.\d+\.x/
44
+ var_5_only_snapshots : &only_snapshot_branches
45
+ filters :
46
+ branches :
47
+ only :
48
+ - main
49
+ # This is needed to run this steps on Renovate PRs that amend the snapshots package.json
50
+ - /^pull\/.*/
44
51
45
52
var_6 : &only_pull_requests
46
53
filters :
47
54
branches :
48
55
only :
49
56
- /pull\/\d+/
50
57
58
+ # All e2e test suites
51
59
var_7 : &all_e2e_subsets ['npm', 'esbuild', 'yarn']
52
60
53
61
# Executor Definitions
@@ -63,10 +71,20 @@ executors:
63
71
working_directory : ~/ng
64
72
resource_class : small
65
73
74
+ bazel-executor :
75
+ parameters :
76
+ nodeversion :
77
+ type : string
78
+ default : *default_nodeversion
79
+ docker :
80
+ - image : cimg/node:<< parameters.nodeversion >>-browsers
81
+ working_directory : ~/ng
82
+ resource_class : xlarge
83
+
66
84
windows-executor :
67
85
# Same as https://circleci.com/orbs/registry/orb/circleci/windows, but named.
68
86
working_directory : ~/ng
69
- resource_class : windows.medium
87
+ resource_class : windows.large
70
88
shell : powershell.exe -ExecutionPolicy Bypass
71
89
machine :
72
90
# Contents of this image:
@@ -116,7 +134,7 @@ commands:
116
134
- initialize_env
117
135
- run : nvm install 16.13
118
136
- run : nvm use 16.13
119
- - run : npm install -g yarn@1.22.10
137
+ - run : npm install -g yarn@1.22.10 @bazel/bazelisk@${BAZELISK_VERSION}
120
138
- run : node --version
121
139
- run : yarn --version
122
140
@@ -126,6 +144,7 @@ commands:
126
144
type : env_var_name
127
145
default : CIRCLE_PROJECT_REPONAME
128
146
steps :
147
+ - run : sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
129
148
- devinfra/setup-bazel-remote-exec :
130
149
bazelrc : ./.bazelrc.user
131
150
@@ -269,23 +288,24 @@ jobs:
269
288
paths :
270
289
- dist/_*.tgz
271
290
272
- build-bazel-e2e :
273
- executor : action-executor
274
- resource_class : medium
291
+ bazel-build :
292
+ executor : bazel-executor
275
293
steps :
276
294
- custom_attach_workspace
277
- - run : yarn bazel build //tests/legacy-cli/...
295
+ - setup_bazel_rbe
296
+ - run :
297
+ name : Bazel Build Packages
298
+ command : yarn bazel build //...
299
+ - fail_fast
278
300
279
- unit-test :
280
- executor : action-executor
281
- resource_class : xlarge
301
+ bazel-test :
302
+ executor : bazel-executor
282
303
parameters :
283
304
nodeversion :
284
305
type : string
285
306
default : *default_nodeversion_major
286
307
steps :
287
308
- custom_attach_workspace
288
- - browser-tools/install-chrome
289
309
- setup_bazel_rbe
290
310
- run : sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
291
311
- when :
@@ -311,6 +331,58 @@ jobs:
311
331
no_output_timeout : 40m
312
332
- fail_fast
313
333
334
+ bazel-e2e-tests :
335
+ executor : bazel-executor
336
+ parallelism : 8
337
+ parameters :
338
+ snapshots :
339
+ type : boolean
340
+ default : false
341
+ subset :
342
+ type : enum
343
+ enum : *all_e2e_subsets
344
+ default : ' npm'
345
+ steps :
346
+ - custom_attach_workspace
347
+ - initialize_env
348
+ - setup_bazel_rbe
349
+ - run : mkdir /mnt/ramdisk/e2e
350
+ - run :
351
+ name : Execute CLI E2E Tests with << parameters.subset >>
352
+ 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 >>
353
+ no_output_timeout : 40m
354
+ - store_artifacts :
355
+ path : dist/testlogs/tests/legacy-cli/e2e.<< parameters.subset >>
356
+ - store_test_results :
357
+ path : dist/testlogs/tests/legacy-cli/e2e.<< parameters.subset >>
358
+ - fail_fast
359
+
360
+ bazel-test-browsers :
361
+ executor : bazel-executor
362
+ steps :
363
+ - custom_attach_workspace
364
+ - initialize_env
365
+ - setup_bazel_rbe
366
+ - run :
367
+ name : Initialize Saucelabs
368
+ command : setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
369
+ - run :
370
+ name : Start Saucelabs Tunnel
371
+ command : ./scripts/saucelabs/start-tunnel.sh
372
+ background : true
373
+ # Waits for the Saucelabs tunnel to be ready. This ensures that we don't run tests
374
+ # too early without Saucelabs not being ready.
375
+ - run : ./scripts/saucelabs/wait-for-tunnel.sh
376
+ - run :
377
+ name : E2E Saucelabs Tests
378
+ command : yarn bazel test --config=saucelabs //tests/legacy-cli:e2e.saucelabs
379
+ - run : ./scripts/saucelabs/stop-tunnel.sh
380
+ - store_artifacts :
381
+ path : dist/testlogs/tests/legacy-cli/e2e.saucelabs
382
+ - store_test_results :
383
+ path : dist/testlogs/tests/legacy-cli/e2e.saucelabs
384
+ - fail_fast
385
+
314
386
snapshot_publish :
315
387
executor : action-executor
316
388
resource_class : medium
@@ -375,6 +447,48 @@ jobs:
375
447
node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX --tmpdir=X:/ramdisk/e2e-main --ignore="tests/misc/browsers.ts"
376
448
- fail_fast
377
449
450
+ bazel-e2e-cli-win :
451
+ executor : windows-executor
452
+ parallelism : 12
453
+ steps :
454
+ - checkout
455
+ - rebase_pr_win
456
+ - setup_windows
457
+ - restore_cache :
458
+ keys :
459
+ - *cache_key_win
460
+ - run :
461
+ # We use Arsenal Image Mounter (AIM) instead of ImDisk because of: https://github.com/nodejs/node/issues/6861
462
+ # Useful resources for AIM: http://reboot.pro/index.php?showtopic=22068
463
+ name : ' Arsenal Image Mounter (RAM Disk)'
464
+ command : |
465
+ pwsh ./.circleci/win-ram-disk.ps1
466
+ - run : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
467
+ - save_cache :
468
+ key : *cache_key_win
469
+ paths :
470
+ - ~/.cache/yarn
471
+ # Path where Arsenal Image Mounter files are downloaded.
472
+ # Must match path in .circleci/win-ram-disk.ps1
473
+ - ./aim
474
+ - run :
475
+ name : Execute E2E Tests
476
+ environment :
477
+ # Required by `yarn ng-dev`
478
+ # See https://github.com/angular/angular/issues/46858
479
+ PWD : .
480
+ command : |
481
+ mkdir X:/ramdisk/e2e
482
+ 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
483
+ # This timeout provides time for the actual tests to timeout and report status
484
+ # instead of CircleCI stopping the job without test failure information.
485
+ no_output_timeout : 40m
486
+ - fail_fast
487
+ - store_artifacts :
488
+ path : dist/testlogs/tests/legacy-cli/e2e.npm
489
+ - store_test_results :
490
+ path : dist/testlogs/tests/legacy-cli/e2e.npm
491
+
378
492
workflows :
379
493
version : 2
380
494
default_workflow :
@@ -429,44 +543,73 @@ workflows:
429
543
snapshots : true
430
544
pre-steps :
431
545
- when :
546
+ # Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
432
547
condition :
433
548
and :
434
549
- not :
435
550
equal : [main, << pipeline.git.branch >>]
436
551
- not : << pipeline.parameters.snapshot_changed >>
437
552
steps :
438
- # Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
439
553
- run : circleci-agent step halt
440
554
requires :
441
555
- build
442
- filters :
443
- branches :
444
- only :
445
- - main
446
- # This is needed to run this steps on Renovate PRs that amend the snapshots package.json
447
- - /^pull\/.*/
556
+ << : *only_snapshot_branches
448
557
449
558
# Bazel jobs
450
559
# These jobs only really depend on Setup, but the build job is very quick to run (~35s) and
451
560
# will catch any build errors before proceeding to the more lengthy and resource intensive
452
561
# Bazel jobs.
453
- - unit -test :
562
+ - bazel -test :
454
563
name : test-node<< matrix.nodeversion >>
455
564
matrix :
456
565
parameters :
457
566
nodeversion : *all_nodeversion_major
458
567
requires :
459
- - build
460
-
461
- # Compile the e2e tests with bazel to ensure the non-runtime typescript
462
- # compilation completes succesfully.
463
- - build-bazel-e2e :
464
- requires :
465
- - build
568
+ - bazel-build
466
569
467
570
# Windows jobs
468
571
- e2e-cli-win
469
572
573
+ - bazel-e2e-cli-win
574
+
575
+ # Bazel jobs
576
+ - bazel-build :
577
+ requires :
578
+ - setup
579
+
580
+ - bazel-e2e-tests :
581
+ name : bazel-e2e-cli-<< matrix.subset >>
582
+ matrix :
583
+ parameters :
584
+ subset : *all_e2e_subsets
585
+ snapshots : false
586
+ requires :
587
+ - bazel-build
588
+
589
+ - bazel-e2e-tests :
590
+ name : bazel-e2e-snapshots-<< matrix.subset >>
591
+ matrix :
592
+ parameters :
593
+ subset : *all_e2e_subsets
594
+ snapshots : true
595
+ pre-steps :
596
+ - when :
597
+ # Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
598
+ condition :
599
+ and :
600
+ - not :
601
+ equal : [main, << pipeline.git.branch >>]
602
+ - not : << pipeline.parameters.snapshot_changed >>
603
+ steps :
604
+ - run : circleci-agent step halt
605
+ requires :
606
+ - bazel-build
607
+ << : *only_snapshot_branches
608
+
609
+ - bazel-test-browsers :
610
+ requires :
611
+ - bazel-build
612
+
470
613
# Publish jobs
471
614
- snapshot_publish :
472
615
<< : *only_release_branches
0 commit comments