CI: extract node_modules cache key computation (#25258)
Jan Kassens committed
Sep 13, 2022 at 17:54 UTC
aca7f30c9599d8724a3ae1a3df8ce3e14e48029a
1 file changed
+26
-22
.circleci/config.yml
+26
-22
@@ -12,6 +12,11 @@ aliases:
12
name: Restore yarn cache
13
key: v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
14
15
+ - &prepare_node_modules_cache_key
16
+ run:
17
+ name: Preparing node_modules cache key
18
+ command: yarn workspaces info | head -n -1 > workspace_info.txt
19
+
20
- &restore_node_modules
21
restore_cache:
22
name: Restore node_modules cache
@@ -72,7 +77,7 @@ jobs:
77
78
steps:
79
- checkout
75
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
80
+ - *prepare_node_modules_cache_key
81
- *restore_node_modules
82
- run: node ./scripts/prettier/index
83
- run: node ./scripts/tasks/eslint
@@ -87,7 +92,7 @@ jobs:
92
93
steps:
94
- checkout
90
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
95
+ - *prepare_node_modules_cache_key
96
- *restore_node_modules
97
- run: node ./scripts/tasks/flow-ci
98
@@ -97,7 +102,7 @@ jobs:
102
103
steps:
104
- checkout
100
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
105
+ - *prepare_node_modules_cache_key
106
- *restore_node_modules
107
- run:
108
command: |
@@ -114,7 +119,7 @@ jobs:
119
parallelism: 40
120
steps:
121
- checkout
117
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
122
+ - *prepare_node_modules_cache_key
123
- *restore_node_modules
124
- run: yarn build-combined
125
- persist_to_workspace:
@@ -130,7 +135,7 @@ jobs:
135
type: string
136
steps:
137
- checkout
133
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
138
+ - *prepare_node_modules_cache_key
139
- *restore_node_modules
140
- run:
141
name: Download artifacts for revision
@@ -148,7 +153,7 @@ jobs:
153
environment: *environment
154
steps:
155
- checkout
151
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
156
+ - *prepare_node_modules_cache_key
157
- *restore_node_modules
158
- run:
159
name: Download artifacts for base revision
@@ -177,7 +182,7 @@ jobs:
182
- checkout
183
- attach_workspace:
184
at: .
180
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
185
+ - *prepare_node_modules_cache_key
186
- *restore_node_modules
187
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
188
# Compress build directory into a single tarball for easy download
@@ -197,7 +202,7 @@ jobs:
202
- attach_workspace:
203
at: .
204
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
200
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
205
+ - *prepare_node_modules_cache_key
206
- *restore_node_modules
207
- run:
208
command: node ./scripts/tasks/danger
@@ -209,7 +214,7 @@ jobs:
214
- checkout
215
- attach_workspace:
216
at: .
212
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
217
+ - *prepare_node_modules_cache_key
218
- *restore_node_modules
219
- run:
220
name: Install Packages
@@ -228,7 +233,7 @@ jobs:
233
- checkout
234
- attach_workspace:
235
at: .
231
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
236
+ - *prepare_node_modules_cache_key
237
- *restore_node_modules
238
- run:
239
name: Install Packages
@@ -254,7 +259,7 @@ jobs:
259
- checkout
260
- attach_workspace:
261
at: .
257
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
262
+ - *prepare_node_modules_cache_key
263
- *restore_node_modules
264
- run:
265
name: Install nested packages from Yarn cache
@@ -273,7 +278,7 @@ jobs:
278
- checkout
279
- attach_workspace:
280
at: .
276
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
281
+ - *prepare_node_modules_cache_key
282
- *restore_node_modules
283
- run:
284
name: Install nested packages from Yarn cache
@@ -301,7 +306,7 @@ jobs:
306
- checkout
307
- attach_workspace:
308
at: .
304
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
309
+ - *prepare_node_modules_cache_key
310
- *restore_node_modules
311
- run: yarn lint-build
312
@@ -312,7 +317,7 @@ jobs:
317
- checkout
318
- attach_workspace:
319
at: .
315
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
320
+ - *prepare_node_modules_cache_key
321
- *restore_node_modules
322
- run: yarn check-release-dependencies
323
@@ -323,7 +328,7 @@ jobs:
328
steps:
329
- checkout
330
- attach_workspace: *attach_workspace
326
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
331
+ - *prepare_node_modules_cache_key
332
- *restore_node_modules
333
- run:
334
name: Search build artifacts for unminified errors
@@ -340,7 +345,7 @@ jobs:
345
type: string
346
steps:
347
- checkout
343
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
348
+ - *prepare_node_modules_cache_key
349
- *restore_node_modules
350
- run: yarn test <<parameters.args>> --ci
351
@@ -355,7 +360,7 @@ jobs:
360
- checkout
361
- attach_workspace:
362
at: .
358
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
363
+ - *prepare_node_modules_cache_key
364
- *restore_node_modules
365
- run:
366
name: Install nested packages from Yarn cache
@@ -369,7 +374,7 @@ jobs:
374
- checkout
375
- attach_workspace:
376
at: .
372
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
377
+ - *prepare_node_modules_cache_key
378
- *restore_node_modules
379
- run:
380
name: Run DOM fixture tests
@@ -386,7 +391,7 @@ jobs:
391
environment: *environment
392
steps:
393
- checkout
389
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
394
+ - *prepare_node_modules_cache_key
395
- *restore_node_modules
396
- run:
397
name: Run fuzz tests
@@ -406,7 +411,7 @@ jobs:
411
environment: *environment
412
steps:
413
- checkout
409
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
414
+ - *prepare_node_modules_cache_key
415
- *restore_node_modules
416
- run:
417
name: Run publish script
@@ -425,7 +430,7 @@ jobs:
430
environment: *environment
431
steps:
432
- checkout
428
- - run: yarn workspaces info | head -n -1 > workspace_info.txt
433
+ - *prepare_node_modules_cache_key
434
- *restore_node_modules
435
- run:
436
name: Fetch revisions that contain an intentional fork
@@ -676,4 +681,3 @@ workflows:
681
commit_sha: << pipeline.git.revision >>
682
release_channel: experimental
683
dist_tag: experimental
679
-