@@ -7,17 +7,11 @@ aliases:
77 - &environment
88 TZ : /usr/share/zoneinfo/America/Los_Angeles
99
10- - &restore_yarn_cache
10+ - &restore_node_modules
1111 restore_cache :
1212 name : Restore node_modules cache
1313 keys :
14- - v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
15- - v2-node-{{ arch }}-{{ .Branch }}-
16- - v2-node-{{ arch }}-
17- - &run_yarn
18- run :
19- name : Install Packages
20- command : yarn --frozen-lockfile
14+ - v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
2115
2216 - &TEST_PARALLELISM 20
2317
@@ -30,8 +24,7 @@ aliases:
3024 steps :
3125 - checkout
3226 - attach_workspace : *attach_workspace
33- - *restore_yarn_cache
34- - *run_yarn
27+ - *restore_node_modules
3528 - run : node ./scripts/rollup/consolidateBundleSizes.js
3629 - run : ./scripts/circleci/pack_and_store_artifact.sh
3730 - store_artifacts :
@@ -59,22 +52,37 @@ jobs:
5952 - run :
6053 name : Nodejs Version
6154 command : node --version
62- - *restore_yarn_cache
63- - *run_yarn
55+ - restore_cache :
56+ name : Restore yarn cache
57+ key : v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
58+ - run :
59+ name : Install Packages
60+ command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
6461 - save_cache :
65- name : Save node_modules cache
66- key : v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
62+ # Store the yarn cache globally for all lock files with this same
63+ # checksum. This will speed up the setup job for all PRs where the
64+ # lockfile is the same.
65+ name : Save yarn cache for future installs
66+ key : v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
6767 paths :
6868 - ~/.cache/yarn
69+ - save_cache :
70+ # Store node_modules for all jobs in this workflow so that they don't
71+ # need to each run a yarn install for each job. This will speed up
72+ # all jobs run on this branch with the same lockfile.
73+ name : Save node_modules cache
74+ # This cache key is per branch, a yarn install in setup is required.
75+ key : v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
76+ paths :
77+ - node_modules
6978
7079 yarn_lint :
7180 docker : *docker
7281 environment : *environment
7382
7483 steps :
7584 - checkout
76- - *restore_yarn_cache
77- - *run_yarn
85+ - *restore_node_modules
7886 - run : node ./scripts/prettier/index
7987 - run : node ./scripts/tasks/eslint
8088 - run : ./scripts/circleci/check_license.sh
8795
8896 steps :
8997 - checkout
90- - *restore_yarn_cache
91- - *run_yarn
98+ - *restore_node_modules
9299 - run : node ./scripts/tasks/flow-ci
93100
94101 RELEASE_CHANNEL_stable_yarn_test :
98105
99106 steps :
100107 - checkout
101- - *restore_yarn_cache
102- - *run_yarn
108+ - *restore_node_modules
103109 - run : yarn test --release-channel=stable --ci
104110
105111 yarn_test :
@@ -108,8 +114,7 @@ jobs:
108114 parallelism : *TEST_PARALLELISM
109115 steps :
110116 - checkout
111- - *restore_yarn_cache
112- - *run_yarn
117+ - *restore_node_modules
113118 - run : yarn test --ci
114119
115120 RELEASE_CHANNEL_stable_yarn_test_www :
@@ -118,8 +123,7 @@ jobs:
118123 parallelism : *TEST_PARALLELISM
119124 steps :
120125 - checkout
121- - *restore_yarn_cache
122- - *run_yarn
126+ - *restore_node_modules
123127 - run : yarn test --release-channel=www-classic --ci
124128
125129 RELEASE_CHANNEL_stable_yarn_test_www_variant :
@@ -128,8 +132,7 @@ jobs:
128132 parallelism : *TEST_PARALLELISM
129133 steps :
130134 - checkout
131- - *restore_yarn_cache
132- - *run_yarn
135+ - *restore_node_modules
133136 - run : yarn test --release-channel=www-classic --variant --ci
134137
135138 RELEASE_CHANNEL_stable_yarn_test_prod_www :
@@ -138,8 +141,7 @@ jobs:
138141 parallelism : *TEST_PARALLELISM
139142 steps :
140143 - checkout
141- - *restore_yarn_cache
142- - *run_yarn
144+ - *restore_node_modules
143145 - run : yarn test --release-channel=www-classic --prod --ci
144146
145147 RELEASE_CHANNEL_stable_yarn_test_prod_www_variant :
@@ -148,8 +150,7 @@ jobs:
148150 parallelism : *TEST_PARALLELISM
149151 steps :
150152 - checkout
151- - *restore_yarn_cache
152- - *run_yarn
153+ - *restore_node_modules
153154 - run : yarn test --release-channel=www-classic --prod --variant --ci
154155
155156 yarn_test_www :
@@ -158,8 +159,7 @@ jobs:
158159 parallelism : *TEST_PARALLELISM
159160 steps :
160161 - checkout
161- - *restore_yarn_cache
162- - *run_yarn
162+ - *restore_node_modules
163163 - run : yarn test --release-channel=www-modern --ci
164164
165165 yarn_test_www_variant :
@@ -168,8 +168,7 @@ jobs:
168168 parallelism : *TEST_PARALLELISM
169169 steps :
170170 - checkout
171- - *restore_yarn_cache
172- - *run_yarn
171+ - *restore_node_modules
173172 - run : yarn test --release-channel=www-modern --variant --ci
174173
175174 yarn_test_prod_www :
@@ -178,8 +177,7 @@ jobs:
178177 parallelism : *TEST_PARALLELISM
179178 steps :
180179 - checkout
181- - *restore_yarn_cache
182- - *run_yarn
180+ - *restore_node_modules
183181 - run : yarn test --release-channel=www-modern --prod --ci
184182
185183 yarn_test_prod_www_variant :
@@ -188,8 +186,7 @@ jobs:
188186 parallelism : *TEST_PARALLELISM
189187 steps :
190188 - checkout
191- - *restore_yarn_cache
192- - *run_yarn
189+ - *restore_node_modules
193190 - run : yarn test --release-channel=www-modern --prod --variant --ci
194191
195192 RELEASE_CHANNEL_stable_yarn_test_persistent :
@@ -199,8 +196,7 @@ jobs:
199196
200197 steps :
201198 - checkout
202- - *restore_yarn_cache
203- - *run_yarn
199+ - *restore_node_modules
204200 - run : yarn test --release-channel=stable --persistent --ci
205201
206202 RELEASE_CHANNEL_stable_yarn_test_prod :
@@ -210,8 +206,7 @@ jobs:
210206
211207 steps :
212208 - checkout
213- - *restore_yarn_cache
214- - *run_yarn
209+ - *restore_node_modules
215210 - run : yarn test --release-channel=stable --prod --ci
216211
217212 yarn_test_prod :
@@ -220,8 +215,7 @@ jobs:
220215 parallelism : *TEST_PARALLELISM
221216 steps :
222217 - checkout
223- - *restore_yarn_cache
224- - *run_yarn
218+ - *restore_node_modules
225219 - run : yarn test --release-channel=experimental --prod --ci
226220
227221 RELEASE_CHANNEL_stable_yarn_build :
@@ -230,8 +224,7 @@ jobs:
230224 parallelism : *TEST_PARALLELISM
231225 steps :
232226 - checkout
233- - *restore_yarn_cache
234- - *run_yarn
227+ - *restore_node_modules
235228 - run :
236229 environment :
237230 RELEASE_CHANNEL : stable
@@ -257,8 +250,7 @@ jobs:
257250 parallelism : 20
258251 steps :
259252 - checkout
260- - *restore_yarn_cache
261- - *run_yarn
253+ - *restore_node_modules
262254 - run :
263255 environment :
264256 RELEASE_CHANNEL : experimental
@@ -285,8 +277,7 @@ jobs:
285277 steps :
286278 - checkout
287279 - attach_workspace : *attach_workspace
288- - *restore_yarn_cache
289- - *run_yarn
280+ - *restore_node_modules
290281 - run :
291282 environment :
292283 RELEASE_CHANNEL : experimental
@@ -305,8 +296,7 @@ jobs:
305296 steps :
306297 - checkout
307298 - attach_workspace : *attach_workspace
308- - *restore_yarn_cache
309- - *run_yarn
299+ - *restore_node_modules
310300 # This runs in the process_artifacts job, too, but it's faster to run
311301 # this step in both jobs instead of running the jobs sequentially
312302 - run : node ./scripts/rollup/consolidateBundleSizes.js
@@ -321,8 +311,7 @@ jobs:
321311 steps :
322312 - checkout
323313 - attach_workspace : *attach_workspace
324- - *restore_yarn_cache
325- - *run_yarn
314+ - *restore_node_modules
326315 # This runs in the process_artifacts job, too, but it's faster to run
327316 # this step in both jobs instead of running the jobs sequentially
328317 - run : node ./scripts/rollup/consolidateBundleSizes.js
@@ -337,8 +326,7 @@ jobs:
337326 steps :
338327 - checkout
339328 - attach_workspace : *attach_workspace
340- - *restore_yarn_cache
341- - *run_yarn
329+ - *restore_node_modules
342330 - run : yarn lint-build
343331 - run : scripts/circleci/check_minified_errors.sh
344332
@@ -348,8 +336,7 @@ jobs:
348336 steps :
349337 - checkout
350338 - attach_workspace : *attach_workspace
351- - *restore_yarn_cache
352- - *run_yarn
339+ - *restore_node_modules
353340 - run :
354341 environment :
355342 RELEASE_CHANNEL : stable
@@ -363,8 +350,7 @@ jobs:
363350 steps :
364351 - checkout
365352 - attach_workspace : *attach_workspace
366- - *restore_yarn_cache
367- - *run_yarn
353+ - *restore_node_modules
368354 - run : yarn test --release-channel=stable --build --ci
369355
370356 yarn_test_build :
@@ -374,8 +360,7 @@ jobs:
374360 steps :
375361 - checkout
376362 - attach_workspace : *attach_workspace
377- - *restore_yarn_cache
378- - *run_yarn
363+ - *restore_node_modules
379364 - run : yarn test --release-channel=experimental --build --ci
380365
381366 yarn_test_build_devtools :
@@ -384,8 +369,7 @@ jobs:
384369 steps :
385370 - checkout
386371 - attach_workspace : *attach_workspace
387- - *restore_yarn_cache
388- - *run_yarn
372+ - *restore_node_modules
389373 - run : yarn test --project=devtools --build --ci
390374
391375 RELEASE_CHANNEL_stable_yarn_test_dom_fixtures :
@@ -394,7 +378,7 @@ jobs:
394378 steps :
395379 - checkout
396380 - attach_workspace : *attach_workspace
397- - *restore_yarn_cache
381+ - *restore_node_modules
398382 - run :
399383 name : Run DOM fixture tests
400384 environment :
@@ -410,8 +394,7 @@ jobs:
410394 environment : *environment
411395 steps :
412396 - checkout
413- - *restore_yarn_cache
414- - *run_yarn
397+ - *restore_node_modules
415398 - run :
416399 name : Run fuzz tests
417400 command : |
@@ -425,8 +408,7 @@ jobs:
425408 steps :
426409 - checkout
427410 - attach_workspace : *attach_workspace
428- - *restore_yarn_cache
429- - *run_yarn
411+ - *restore_node_modules
430412 - run : yarn test --release-channel=stable --build --prod --ci
431413
432414 yarn_test_build_prod :
@@ -436,8 +418,7 @@ jobs:
436418 steps :
437419 - checkout
438420 - attach_workspace : *attach_workspace
439- - *restore_yarn_cache
440- - *run_yarn
421+ - *restore_node_modules
441422 - run : yarn test --release-channel=experimental --build --prod --ci
442423
443424workflows :
0 commit comments