Add workspaces hash to yarn cache key (#20154)
* Add branch to yarn cache key * Add checksum check for workspace info * Fix yaml * Try moving the command * How about here * Just inline it * i hate it here * try reverting back * Add run * idk * try inlining the command everywhere * Create workspace_info.txt when we create the cache * Delete the timestamp
Ricky committed
Nov 3, 2020 at 15:02 UTC
6b28eb6175e5251b31507749b79c55c0e389b6ef
1 file changed
+35
-3
.circleci/config.yml
+35
-3
@@ -16,7 +16,7 @@ aliases:
16
restore_cache:
17
name: Restore node_modules cache
18
keys:
19
- - v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
19
+ - v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules
20
21
- &TEST_PARALLELISM 20
22
@@ -29,6 +29,7 @@ aliases:
29
steps:
30
- checkout
31
- attach_workspace: *attach_workspace
32
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
33
- *restore_node_modules
34
- run: node ./scripts/rollup/consolidateBundleSizes.js
35
- run: ./scripts/circleci/pack_and_store_artifact.sh
@@ -51,7 +52,6 @@ jobs:
52
setup:
53
docker: *docker
54
environment: *environment
54
-
55
steps:
56
- checkout
57
- run:
@@ -61,6 +61,7 @@ jobs:
61
- run:
62
name: Install Packages
63
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
64
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
65
- save_cache:
66
# Store the yarn cache globally for all lock files with this same
67
# checksum. This will speed up the setup job for all PRs where the
@@ -75,7 +76,7 @@ jobs:
76
# all jobs run on this branch with the same lockfile.
77
name: Save node_modules cache
78
# This cache key is per branch, a yarn install in setup is required.
78
- key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-modules
79
+ key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules
80
paths:
81
- node_modules
82
@@ -85,6 +86,7 @@ jobs:
86
87
steps:
88
- checkout
89
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
90
- *restore_node_modules
91
- run: node ./scripts/prettier/index
92
- run: node ./scripts/tasks/eslint
@@ -98,6 +100,7 @@ jobs:
100
101
steps:
102
- checkout
103
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
104
- *restore_node_modules
105
- run: node ./scripts/tasks/flow-ci
106
@@ -108,6 +111,7 @@ jobs:
111
112
steps:
113
- checkout
114
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
115
- *restore_node_modules
116
- run: yarn test-stable --ci
117
@@ -117,6 +121,7 @@ jobs:
121
parallelism: *TEST_PARALLELISM
122
steps:
123
- checkout
124
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
125
- *restore_node_modules
126
- run: yarn test --ci
127
@@ -126,6 +131,7 @@ jobs:
131
parallelism: *TEST_PARALLELISM
132
steps:
133
- checkout
134
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
135
- *restore_node_modules
136
- run: yarn test-classic --ci
137
@@ -135,6 +141,7 @@ jobs:
141
parallelism: *TEST_PARALLELISM
142
steps:
143
- checkout
144
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
145
- *restore_node_modules
146
- run: yarn test-classic --variant --ci
147
@@ -144,6 +151,7 @@ jobs:
151
parallelism: *TEST_PARALLELISM
152
steps:
153
- checkout
154
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
155
- *restore_node_modules
156
- run: yarn test-classic --prod --ci
157
@@ -153,6 +161,7 @@ jobs:
161
parallelism: *TEST_PARALLELISM
162
steps:
163
- checkout
164
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
165
- *restore_node_modules
166
- run: yarn test-classic --prod --variant --ci
167
@@ -162,6 +171,7 @@ jobs:
171
parallelism: *TEST_PARALLELISM
172
steps:
173
- checkout
174
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
175
- *restore_node_modules
176
- run: yarn test-www --ci
177
@@ -171,6 +181,7 @@ jobs:
181
parallelism: *TEST_PARALLELISM
182
steps:
183
- checkout
184
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
185
- *restore_node_modules
186
- run: yarn test-www --variant --ci
187
@@ -180,6 +191,7 @@ jobs:
191
parallelism: *TEST_PARALLELISM
192
steps:
193
- checkout
194
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
195
- *restore_node_modules
196
- run: yarn test-www --prod --ci
197
@@ -189,6 +201,7 @@ jobs:
201
parallelism: *TEST_PARALLELISM
202
steps:
203
- checkout
204
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
205
- *restore_node_modules
206
- run: yarn test-www --prod --variant --ci
207
@@ -199,6 +212,7 @@ jobs:
212
213
steps:
214
- checkout
215
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
216
- *restore_node_modules
217
- run: yarn test-stable --persistent --ci
218
@@ -209,6 +223,7 @@ jobs:
223
224
steps:
225
- checkout
226
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
227
- *restore_node_modules
228
- run: yarn test-stable --prod --ci
229
@@ -218,6 +233,7 @@ jobs:
233
parallelism: *TEST_PARALLELISM
234
steps:
235
- checkout
236
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
237
- *restore_node_modules
238
- run: yarn test --prod --ci
239
@@ -227,6 +243,7 @@ jobs:
243
parallelism: *TEST_PARALLELISM
244
steps:
245
- checkout
246
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
247
- *restore_node_modules
248
- run:
249
environment:
@@ -254,6 +271,7 @@ jobs:
271
parallelism: 20
272
steps:
273
- checkout
274
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
275
- *restore_node_modules
276
- run:
277
environment:
@@ -281,6 +299,7 @@ jobs:
299
steps:
300
- checkout
301
- attach_workspace: *attach_workspace
302
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
303
- *restore_yarn_cache
304
- *restore_node_modules
305
- run:
@@ -299,6 +318,7 @@ jobs:
318
steps:
319
- checkout
320
- attach_workspace: *attach_workspace
321
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
322
- *restore_yarn_cache
323
- *restore_node_modules
324
- run:
@@ -326,6 +346,7 @@ jobs:
346
- checkout
347
- attach_workspace:
348
at: packages/react-devtools-scheduling-profiler
349
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
350
- *restore_node_modules
351
- run:
352
name: Deploy
@@ -344,6 +365,7 @@ jobs:
365
steps:
366
- checkout
367
- attach_workspace: *attach_workspace
368
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
369
- *restore_node_modules
370
# This runs in the process_artifacts job, too, but it's faster to run
371
# this step in both jobs instead of running the jobs sequentially
@@ -359,6 +381,7 @@ jobs:
381
steps:
382
- checkout
383
- attach_workspace: *attach_workspace
384
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
385
- *restore_node_modules
386
# This runs in the process_artifacts job, too, but it's faster to run
387
# this step in both jobs instead of running the jobs sequentially
@@ -374,6 +397,7 @@ jobs:
397
steps:
398
- checkout
399
- attach_workspace: *attach_workspace
400
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
401
- *restore_node_modules
402
- run: yarn lint-build
403
- run: scripts/circleci/check_minified_errors.sh
@@ -384,6 +408,7 @@ jobs:
408
steps:
409
- checkout
410
- attach_workspace: *attach_workspace
411
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
412
- *restore_node_modules
413
- run:
414
environment:
@@ -398,6 +423,7 @@ jobs:
423
steps:
424
- checkout
425
- attach_workspace: *attach_workspace
426
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
427
- *restore_node_modules
428
- run: yarn test-stable --build --ci
429
@@ -408,6 +434,7 @@ jobs:
434
steps:
435
- checkout
436
- attach_workspace: *attach_workspace
437
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
438
- *restore_node_modules
439
- run: yarn test --build --ci
440
@@ -417,6 +444,7 @@ jobs:
444
steps:
445
- checkout
446
- attach_workspace: *attach_workspace
447
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
448
- *restore_node_modules
449
- run: yarn test --project=devtools --build --ci
450
@@ -426,6 +454,7 @@ jobs:
454
steps:
455
- checkout
456
- attach_workspace: *attach_workspace
457
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
458
- *restore_node_modules
459
- run:
460
name: Run DOM fixture tests
@@ -442,6 +471,7 @@ jobs:
471
environment: *environment
472
steps:
473
- checkout
474
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
475
- *restore_node_modules
476
- run:
477
name: Run fuzz tests
@@ -456,6 +486,7 @@ jobs:
486
steps:
487
- checkout
488
- attach_workspace: *attach_workspace
489
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
490
- *restore_node_modules
491
- run: yarn test-stable --build --prod --ci
492
@@ -466,6 +497,7 @@ jobs:
497
steps:
498
- checkout
499
- attach_workspace: *attach_workspace
500
+ - run: yarn workspaces info | head -n -1 > workspace_info.txt
501
- *restore_node_modules
502
- run: yarn test --build --prod --ci
503