Skip to content

Commit 6b28eb6

Browse files
authored
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
1 parent 31d0966 commit 6b28eb6

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

.circleci/config.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ aliases:
1616
restore_cache:
1717
name: Restore node_modules cache
1818
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
2020

2121
- &TEST_PARALLELISM 20
2222

@@ -29,6 +29,7 @@ aliases:
2929
steps:
3030
- checkout
3131
- attach_workspace: *attach_workspace
32+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
3233
- *restore_node_modules
3334
- run: node ./scripts/rollup/consolidateBundleSizes.js
3435
- run: ./scripts/circleci/pack_and_store_artifact.sh
@@ -51,7 +52,6 @@ jobs:
5152
setup:
5253
docker: *docker
5354
environment: *environment
54-
5555
steps:
5656
- checkout
5757
- run:
@@ -61,6 +61,7 @@ jobs:
6161
- run:
6262
name: Install Packages
6363
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
64+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
6465
- save_cache:
6566
# Store the yarn cache globally for all lock files with this same
6667
# checksum. This will speed up the setup job for all PRs where the
@@ -75,7 +76,7 @@ jobs:
7576
# all jobs run on this branch with the same lockfile.
7677
name: Save node_modules cache
7778
# 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
7980
paths:
8081
- node_modules
8182

@@ -85,6 +86,7 @@ jobs:
8586

8687
steps:
8788
- checkout
89+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
8890
- *restore_node_modules
8991
- run: node ./scripts/prettier/index
9092
- run: node ./scripts/tasks/eslint
@@ -98,6 +100,7 @@ jobs:
98100

99101
steps:
100102
- checkout
103+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
101104
- *restore_node_modules
102105
- run: node ./scripts/tasks/flow-ci
103106

@@ -108,6 +111,7 @@ jobs:
108111

109112
steps:
110113
- checkout
114+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
111115
- *restore_node_modules
112116
- run: yarn test-stable --ci
113117

@@ -117,6 +121,7 @@ jobs:
117121
parallelism: *TEST_PARALLELISM
118122
steps:
119123
- checkout
124+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
120125
- *restore_node_modules
121126
- run: yarn test --ci
122127

@@ -126,6 +131,7 @@ jobs:
126131
parallelism: *TEST_PARALLELISM
127132
steps:
128133
- checkout
134+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
129135
- *restore_node_modules
130136
- run: yarn test-classic --ci
131137

@@ -135,6 +141,7 @@ jobs:
135141
parallelism: *TEST_PARALLELISM
136142
steps:
137143
- checkout
144+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
138145
- *restore_node_modules
139146
- run: yarn test-classic --variant --ci
140147

@@ -144,6 +151,7 @@ jobs:
144151
parallelism: *TEST_PARALLELISM
145152
steps:
146153
- checkout
154+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
147155
- *restore_node_modules
148156
- run: yarn test-classic --prod --ci
149157

@@ -153,6 +161,7 @@ jobs:
153161
parallelism: *TEST_PARALLELISM
154162
steps:
155163
- checkout
164+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
156165
- *restore_node_modules
157166
- run: yarn test-classic --prod --variant --ci
158167

@@ -162,6 +171,7 @@ jobs:
162171
parallelism: *TEST_PARALLELISM
163172
steps:
164173
- checkout
174+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
165175
- *restore_node_modules
166176
- run: yarn test-www --ci
167177

@@ -171,6 +181,7 @@ jobs:
171181
parallelism: *TEST_PARALLELISM
172182
steps:
173183
- checkout
184+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
174185
- *restore_node_modules
175186
- run: yarn test-www --variant --ci
176187

@@ -180,6 +191,7 @@ jobs:
180191
parallelism: *TEST_PARALLELISM
181192
steps:
182193
- checkout
194+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
183195
- *restore_node_modules
184196
- run: yarn test-www --prod --ci
185197

@@ -189,6 +201,7 @@ jobs:
189201
parallelism: *TEST_PARALLELISM
190202
steps:
191203
- checkout
204+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
192205
- *restore_node_modules
193206
- run: yarn test-www --prod --variant --ci
194207

@@ -199,6 +212,7 @@ jobs:
199212

200213
steps:
201214
- checkout
215+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
202216
- *restore_node_modules
203217
- run: yarn test-stable --persistent --ci
204218

@@ -209,6 +223,7 @@ jobs:
209223

210224
steps:
211225
- checkout
226+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
212227
- *restore_node_modules
213228
- run: yarn test-stable --prod --ci
214229

@@ -218,6 +233,7 @@ jobs:
218233
parallelism: *TEST_PARALLELISM
219234
steps:
220235
- checkout
236+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
221237
- *restore_node_modules
222238
- run: yarn test --prod --ci
223239

@@ -227,6 +243,7 @@ jobs:
227243
parallelism: *TEST_PARALLELISM
228244
steps:
229245
- checkout
246+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
230247
- *restore_node_modules
231248
- run:
232249
environment:
@@ -254,6 +271,7 @@ jobs:
254271
parallelism: 20
255272
steps:
256273
- checkout
274+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
257275
- *restore_node_modules
258276
- run:
259277
environment:
@@ -281,6 +299,7 @@ jobs:
281299
steps:
282300
- checkout
283301
- attach_workspace: *attach_workspace
302+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
284303
- *restore_yarn_cache
285304
- *restore_node_modules
286305
- run:
@@ -299,6 +318,7 @@ jobs:
299318
steps:
300319
- checkout
301320
- attach_workspace: *attach_workspace
321+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
302322
- *restore_yarn_cache
303323
- *restore_node_modules
304324
- run:
@@ -326,6 +346,7 @@ jobs:
326346
- checkout
327347
- attach_workspace:
328348
at: packages/react-devtools-scheduling-profiler
349+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
329350
- *restore_node_modules
330351
- run:
331352
name: Deploy
@@ -344,6 +365,7 @@ jobs:
344365
steps:
345366
- checkout
346367
- attach_workspace: *attach_workspace
368+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
347369
- *restore_node_modules
348370
# This runs in the process_artifacts job, too, but it's faster to run
349371
# this step in both jobs instead of running the jobs sequentially
@@ -359,6 +381,7 @@ jobs:
359381
steps:
360382
- checkout
361383
- attach_workspace: *attach_workspace
384+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
362385
- *restore_node_modules
363386
# This runs in the process_artifacts job, too, but it's faster to run
364387
# this step in both jobs instead of running the jobs sequentially
@@ -374,6 +397,7 @@ jobs:
374397
steps:
375398
- checkout
376399
- attach_workspace: *attach_workspace
400+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
377401
- *restore_node_modules
378402
- run: yarn lint-build
379403
- run: scripts/circleci/check_minified_errors.sh
@@ -384,6 +408,7 @@ jobs:
384408
steps:
385409
- checkout
386410
- attach_workspace: *attach_workspace
411+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
387412
- *restore_node_modules
388413
- run:
389414
environment:
@@ -398,6 +423,7 @@ jobs:
398423
steps:
399424
- checkout
400425
- attach_workspace: *attach_workspace
426+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
401427
- *restore_node_modules
402428
- run: yarn test-stable --build --ci
403429

@@ -408,6 +434,7 @@ jobs:
408434
steps:
409435
- checkout
410436
- attach_workspace: *attach_workspace
437+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
411438
- *restore_node_modules
412439
- run: yarn test --build --ci
413440

@@ -417,6 +444,7 @@ jobs:
417444
steps:
418445
- checkout
419446
- attach_workspace: *attach_workspace
447+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
420448
- *restore_node_modules
421449
- run: yarn test --project=devtools --build --ci
422450

@@ -426,6 +454,7 @@ jobs:
426454
steps:
427455
- checkout
428456
- attach_workspace: *attach_workspace
457+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
429458
- *restore_node_modules
430459
- run:
431460
name: Run DOM fixture tests
@@ -442,6 +471,7 @@ jobs:
442471
environment: *environment
443472
steps:
444473
- checkout
474+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
445475
- *restore_node_modules
446476
- run:
447477
name: Run fuzz tests
@@ -456,6 +486,7 @@ jobs:
456486
steps:
457487
- checkout
458488
- attach_workspace: *attach_workspace
489+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
459490
- *restore_node_modules
460491
- run: yarn test-stable --build --prod --ci
461492

@@ -466,6 +497,7 @@ jobs:
466497
steps:
467498
- checkout
468499
- attach_workspace: *attach_workspace
500+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
469501
- *restore_node_modules
470502
- run: yarn test --build --prod --ci
471503

0 commit comments

Comments
 (0)