@@ -12,14 +12,18 @@ version: 2.1
1212# Variables
1313
1414# # IMPORTANT
15- # If you change the cache key prefix, also sync the restore_cache fallback to match.
15+ # If you change the cache key prefix, also sync the fallback_cache_key fallback to match.
1616# Keep the static part of the cache key as prefix to enable correct fallbacks.
17+ # Windows needs its own cache key because binaries in node_modules are different.
1718# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
1819var_1 : &cache_key angular_devkit-0.11.0-{{ checksum "yarn.lock" }}
19- var_2 : &default_nodeversion "12.9"
20- var_3 : &attach_options
20+ var_2 : &cache_key_fallback angular_devkit-0.11.0
21+ var_1_win : &cache_key_win angular_devkit-win-0.11.0-{{ checksum "yarn.lock" }}
22+ var_2_win : &cache_key_fallback_win angular_devkit-win-0.11.0
23+ var_3 : &default_nodeversion "12.9"
24+ var_4 : &attach_options
2125 at : .
22- var_4 : &ignore_pull_requests
26+ var_5 : &ignore_pull_requests
2327 filters :
2428 branches :
2529 ignore :
@@ -60,24 +64,13 @@ executors:
6064# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
6165commands :
6266 setup_windows :
63- steps :
64- - checkout
67+ steps :
6568 - run :
66- # Need to install node and yarn before, as the base windows image doesn't have anything.
67- # TODO: remove when CircleCI provides preconfigured node images/VMs.
69+ # Need to install node and yarn before to ensure correct versions.
6870 name : Setup windows node environment
69- command : ./.circleci/windows-env.ps1
70- # TODO: remove commands other than the e2e runner when workspaces on windows are well supported.
71- - run :
72- name : Rebase PR on target branch
73- command : >
74- if (Test-Path env:CIRCLE_PR_NUMBER) {
75- git config user.name "angular-ci"
76- git config user.email "angular-ci"
77- node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER }
71+ command : ./.circleci/windows-env.ps1
7872 - run : node --version
7973 - run : yarn --version
80- - run : yarn install --frozen-lockfile
8174
8275 setup_bazel_rbe :
8376 parameters :
@@ -108,7 +101,7 @@ commands:
108101
109102# Job definitions
110103jobs :
111- install :
104+ setup :
112105 executor : action-executor
113106 steps :
114107 - checkout
@@ -127,8 +120,7 @@ jobs:
127120 - restore_cache :
128121 keys :
129122 - *cache_key
130- # This fallback should be the cache_key without variables.
131- - angular_devkit-0.11.0-
123+ - *cache_key_fallback
132124 - run : yarn install --frozen-lockfile
133125 - persist_to_workspace :
134126 root : .
@@ -294,45 +286,60 @@ jobs:
294286 # Windows jobs
295287 # CircleCI support for Windows jobs is still in preview.
296288 # Docs: https://github.com/CircleCI-Public/windows-preview-docs
289+ setup-and-build-win :
290+ executor : windows-executor
291+ steps :
292+ - attach_workspace : *attach_options
293+ - setup_windows
294+ - restore_cache :
295+ keys :
296+ - *cache_key_win
297+ - *cache_key_fallback_win
298+ - run : yarn install --frozen-lockfile
299+ - run : yarn build
300+ - save_cache :
301+ key : *cache_key_win
302+ paths :
303+ # Get cache dir on windows via `yarn cache dir`
304+ - C:\Users\circleci\AppData\Local\Yarn\Cache\v4
305+ # Only jobs downstream from this one will see the updated workspace
306+ # https://circleci.com/blog/deep-diving-into-circleci-workspaces/
307+ - persist_to_workspace :
308+ root : .
309+ paths :
310+ - ./*
311+
297312 test-win :
298313 executor : windows-executor
299- # Skipping cache and workspace for now because it takes 10x longer than on linux.
300- # TODO: when/if CircleCI makes them faster, use cache and workspaces fully.
301- # Notes:
302- # - windows needs its own cache key because binaries in node_modules are different.
303- # - windows might need its own workspace for the same reason.
304- # - get cache dir on windows via `yarn cache dir` (was `C:\Users\circleci\AppData\Local\Yarn\Cache\v4` last time)
305314 steps :
315+ - attach_workspace : *attach_options
306316 - setup_windows
307- # Build and test should be on their own jobs, but restoring workspaces is too slow
308- # so we do it here.
309- - run : yarn build
310317 - run : yarn test --full
311318 # Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.
312- - run : if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/basic/**" }
319+ - run : if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{ basic,ivy} /**" }
313320
314321 e2e-cli-win :
315322 executor : windows-executor
316323 parallelism : 4
317324 steps :
318325 - setup_windows
319- - run : yarn build
320326 - run : node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
321327
322328workflows :
323329 version : 2
324330 default_workflow :
325331 jobs :
326- - install
332+ # Linux jobs
333+ - setup
327334 - lint :
328335 requires :
329- - install
336+ - setup
330337 - validate :
331338 requires :
332- - install
339+ - setup
333340 - build :
334341 requires :
335- - install
342+ - setup
336343 filters :
337344 branches :
338345 ignore :
@@ -343,9 +350,6 @@ workflows:
343350 - test :
344351 requires :
345352 - build
346- - test-win :
347- requires :
348- - test
349353 - test-large :
350354 requires :
351355 - build
@@ -398,16 +402,33 @@ workflows:
398402 << : *ignore_pull_requests
399403 requires :
400404 - e2e-cli
401- - e2e-cli-win :
402- << : *ignore_pull_requests
403- requires :
404- - e2e-cli
405405 - test-browsers :
406406 requires :
407407 - build
408408 - flake-jail :
409409 requires :
410+ - build
411+
412+ # Windows jobs
413+ # These jobs only run after their non-windows counterparts finish successfully.
414+ # This isn't strictly necessary as there is no artifact dependency, but helps economize
415+ # CI resources by not attempting to build when we know it should fail.
416+ - setup-and-build-win :
417+ requires :
418+ # The Linux setup job also does checkout and rebase, which we get via the workspace.
419+ - setup
410420 - build
421+ - test-win :
422+ requires :
423+ - setup-and-build-win
424+ - test
425+ - e2e-cli-win :
426+ << : *ignore_pull_requests
427+ requires :
428+ - setup-and-build-win
429+ - e2e-cli
430+
431+ # Publish jobs
411432 - snapshot_publish :
412433 << : *ignore_pull_requests
413434 requires :
0 commit comments