@@ -12,14 +12,18 @@ version: 2.1
12
12
# Variables
13
13
14
14
# # 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.
16
16
# 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.
17
18
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
18
19
var_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
21
25
at : .
22
- var_4 : &ignore_pull_requests
26
+ var_5 : &ignore_pull_requests
23
27
filters :
24
28
branches :
25
29
ignore :
@@ -60,24 +64,13 @@ executors:
60
64
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
61
65
commands :
62
66
setup_windows :
63
- steps :
64
- - checkout
67
+ steps :
65
68
- 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.
68
70
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
78
72
- run : node --version
79
73
- run : yarn --version
80
- - run : yarn install --frozen-lockfile
81
74
82
75
setup_bazel_rbe :
83
76
parameters :
@@ -108,7 +101,7 @@ commands:
108
101
109
102
# Job definitions
110
103
jobs :
111
- install :
104
+ setup :
112
105
executor : action-executor
113
106
steps :
114
107
- checkout
@@ -127,8 +120,7 @@ jobs:
127
120
- restore_cache :
128
121
keys :
129
122
- *cache_key
130
- # This fallback should be the cache_key without variables.
131
- - angular_devkit-0.11.0-
123
+ - *cache_key_fallback
132
124
- run : yarn install --frozen-lockfile
133
125
- persist_to_workspace :
134
126
root : .
@@ -294,45 +286,60 @@ jobs:
294
286
# Windows jobs
295
287
# CircleCI support for Windows jobs is still in preview.
296
288
# 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
+
297
312
test-win :
298
313
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)
305
314
steps :
315
+ - attach_workspace : *attach_options
306
316
- 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
310
317
- run : yarn test --full
311
318
# 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} /**" }
313
320
314
321
e2e-cli-win :
315
322
executor : windows-executor
316
323
parallelism : 4
317
324
steps :
318
325
- setup_windows
319
- - run : yarn build
320
326
- run : node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
321
327
322
328
workflows :
323
329
version : 2
324
330
default_workflow :
325
331
jobs :
326
- - install
332
+ # Linux jobs
333
+ - setup
327
334
- lint :
328
335
requires :
329
- - install
336
+ - setup
330
337
- validate :
331
338
requires :
332
- - install
339
+ - setup
333
340
- build :
334
341
requires :
335
- - install
342
+ - setup
336
343
filters :
337
344
branches :
338
345
ignore :
@@ -343,9 +350,6 @@ workflows:
343
350
- test :
344
351
requires :
345
352
- build
346
- - test-win :
347
- requires :
348
- - test
349
353
- test-large :
350
354
requires :
351
355
- build
@@ -398,16 +402,33 @@ workflows:
398
402
<< : *ignore_pull_requests
399
403
requires :
400
404
- e2e-cli
401
- - e2e-cli-win :
402
- << : *ignore_pull_requests
403
- requires :
404
- - e2e-cli
405
405
- test-browsers :
406
406
requires :
407
407
- build
408
408
- flake-jail :
409
409
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
410
420
- 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
411
432
- snapshot_publish :
412
433
<< : *ignore_pull_requests
413
434
requires :
0 commit comments