@@ -35,19 +35,27 @@ var_3_all_major: &all_nodeversion_major ['14', '16']
3535# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
3636var_4 : &workspace_location .
3737# Filter to only release branches on a given job.
38- var_5 : &only_release_branches
38+ var_5_only_releases : &only_release_branches
3939 filters :
4040 branches :
4141 only :
4242 - main
4343 - /\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\/.*/
4451
4552var_6 : &only_pull_requests
4653 filters :
4754 branches :
4855 only :
4956 - /pull\/\d+/
5057
58+ # All e2e test suites
5159var_7 : &all_e2e_subsets ['npm', 'esbuild', 'yarn']
5260
5361# Executor Definitions
@@ -63,10 +71,20 @@ executors:
6371 working_directory : ~/ng
6472 resource_class : small
6573
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+
6684 windows-executor :
6785 # Same as https://circleci.com/orbs/registry/orb/circleci/windows, but named.
6886 working_directory : ~/ng
69- resource_class : windows.medium
87+ resource_class : windows.large
7088 shell : powershell.exe -ExecutionPolicy Bypass
7189 machine :
7290 # Contents of this image:
@@ -116,7 +134,7 @@ commands:
116134 - initialize_env
117135 - run : nvm install 16.13
118136 - run : nvm use 16.13
119- -
run :
npm install -g [email protected] 137+ -
run :
npm install -g [email protected] @bazel/bazelisk@${BAZELISK_VERSION} 120138 - run : node --version
121139 - run : yarn --version
122140
@@ -126,6 +144,7 @@ commands:
126144 type : env_var_name
127145 default : CIRCLE_PROJECT_REPONAME
128146 steps :
147+ - run : sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
129148 - devinfra/setup-bazel-remote-exec :
130149 bazelrc : ./.bazelrc.user
131150
@@ -269,23 +288,24 @@ jobs:
269288 paths :
270289 - dist/_*.tgz
271290
272- build-bazel-e2e :
273- executor : action-executor
274- resource_class : medium
291+ bazel-build :
292+ executor : bazel-executor
275293 steps :
276294 - 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
278300
279- unit-test :
280- executor : action-executor
281- resource_class : xlarge
301+ bazel-test :
302+ executor : bazel-executor
282303 parameters :
283304 nodeversion :
284305 type : string
285306 default : *default_nodeversion_major
286307 steps :
287308 - custom_attach_workspace
288- - browser-tools/install-chrome
289309 - setup_bazel_rbe
290310 - run : sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
291311 - when :
@@ -311,6 +331,58 @@ jobs:
311331 no_output_timeout : 40m
312332 - fail_fast
313333
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+
314386 snapshot_publish :
315387 executor : action-executor
316388 resource_class : medium
@@ -375,6 +447,48 @@ jobs:
375447 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"
376448 - fail_fast
377449
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+
378492workflows :
379493 version : 2
380494 default_workflow :
@@ -429,44 +543,73 @@ workflows:
429543 snapshots : true
430544 pre-steps :
431545 - when :
546+ # Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
432547 condition :
433548 and :
434549 - not :
435550 equal : [main, << pipeline.git.branch >>]
436551 - not : << pipeline.parameters.snapshot_changed >>
437552 steps :
438- # Don't run snapshot E2E's unless it's on the main branch or the snapshots file has been updated.
439553 - run : circleci-agent step halt
440554 requires :
441555 - 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
448557
449558 # Bazel jobs
450559 # These jobs only really depend on Setup, but the build job is very quick to run (~35s) and
451560 # will catch any build errors before proceeding to the more lengthy and resource intensive
452561 # Bazel jobs.
453- - unit -test :
562+ - bazel -test :
454563 name : test-node<< matrix.nodeversion >>
455564 matrix :
456565 parameters :
457566 nodeversion : *all_nodeversion_major
458567 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
466569
467570 # Windows jobs
468571 - e2e-cli-win
469572
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+
470613 # Publish jobs
471614 - snapshot_publish :
472615 << : *only_release_branches
0 commit comments