@@ -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.1"
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.1"
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 : .
@@ -292,19 +284,34 @@ jobs:
292
284
# Windows jobs
293
285
# CircleCI support for Windows jobs is still in preview.
294
286
# Docs: https://github.com/CircleCI-Public/windows-preview-docs
287
+ setup-and-build-win :
288
+ executor : windows-executor
289
+ steps :
290
+ - attach_workspace : *attach_options
291
+ - setup_windows
292
+ - restore_cache :
293
+ keys :
294
+ - *cache_key_win
295
+ - *cache_key_fallback_win
296
+ - run : yarn install --frozen-lockfile
297
+ - run : yarn build
298
+ - save_cache :
299
+ key : *cache_key_win
300
+ paths :
301
+ # Get cache dir on windows via `yarn cache dir`
302
+ - C:\Users\circleci\AppData\Local\Yarn\Cache\v4
303
+ # Only jobs downstream from this one will see the updated workspace
304
+ # https://circleci.com/blog/deep-diving-into-circleci-workspaces/
305
+ - persist_to_workspace :
306
+ root : .
307
+ paths :
308
+ - ./*
309
+
295
310
test-win :
296
311
executor : windows-executor
297
- # Skipping cache and workspace for now because it takes 10x longer than on linux.
298
- # TODO: when/if CircleCI makes them faster, use cache and workspaces fully.
299
- # Notes:
300
- # - windows needs its own cache key because binaries in node_modules are different.
301
- # - windows might need its own workspace for the same reason.
302
- # - get cache dir on windows via `yarn cache dir` (was `C:\Users\circleci\AppData\Local\Yarn\Cache\v4` last time)
303
312
steps :
313
+ - attach_workspace : *attach_options
304
314
- setup_windows
305
- # Build and test should be on their own jobs, but restoring workspaces is too slow
306
- # so we do it here.
307
- - run : yarn build
308
315
- run : yarn test --full
309
316
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.
310
317
- run : if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{basic,ivy}/**" }
@@ -314,23 +321,23 @@ jobs:
314
321
parallelism : 4
315
322
steps :
316
323
- setup_windows
317
- - run : yarn build
318
324
- run : node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
319
325
320
326
workflows :
321
327
version : 2
322
328
default_workflow :
323
329
jobs :
324
- - install
330
+ # Linux jobs
331
+ - setup
325
332
- lint :
326
333
requires :
327
- - install
334
+ - setup
328
335
- validate :
329
336
requires :
330
- - install
337
+ - setup
331
338
- build :
332
339
requires :
333
- - install
340
+ - setup
334
341
filters :
335
342
branches :
336
343
ignore :
@@ -341,9 +348,6 @@ workflows:
341
348
- test :
342
349
requires :
343
350
- build
344
- - test-win :
345
- requires :
346
- - test
347
351
- test-large :
348
352
requires :
349
353
- build
@@ -396,16 +400,33 @@ workflows:
396
400
<< : *ignore_pull_requests
397
401
requires :
398
402
- e2e-cli
399
- - e2e-cli-win :
400
- << : *ignore_pull_requests
401
- requires :
402
- - e2e-cli
403
403
- test-browsers :
404
404
requires :
405
405
- build
406
406
- flake-jail :
407
407
requires :
408
+ - build
409
+
410
+ # Windows jobs
411
+ # These jobs only run after their non-windows counterparts finish successfully.
412
+ # This isn't strictly necessary as there is no artifact dependency, but helps economize
413
+ # CI resources by not attempting to build when we know it should fail.
414
+ - setup-and-build-win :
415
+ requires :
416
+ # The Linux setup job also does checkout and rebase, which we get via the workspace.
417
+ - setup
408
418
- build
419
+ - test-win :
420
+ requires :
421
+ - setup-and-build-win
422
+ - test
423
+ - e2e-cli-win :
424
+ << : *ignore_pull_requests
425
+ requires :
426
+ - setup-and-build-win
427
+ - e2e-cli
428
+
429
+ # Publish jobs
409
430
- snapshot_publish :
410
431
<< : *ignore_pull_requests
411
432
requires :
0 commit comments