Skip to content

Commit 41333e2

Browse files
committed
always cache yarn cache instead of partially node_modules
1 parent 8747360 commit 41333e2

File tree

1 file changed

+40
-84
lines changed

1 file changed

+40
-84
lines changed

.circleci/config.yml

Lines changed: 40 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -49,45 +49,6 @@ aliases:
4949
paths:
5050
- ~/.cache/yarn
5151

52-
- &prepare_node_modules_cache_key
53-
run:
54-
name: Preparing node_modules cache key
55-
command: yarn workspaces info | head -n -1 > workspace_info.txt
56-
57-
- &save_node_modules
58-
save_cache:
59-
name: Save node_modules cache
60-
key: v1-node_modules-{{ arch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}
61-
paths:
62-
- node_modules
63-
- packages/eslint-plugin-react-hooks/node_modules
64-
- packages/react-art/node_modules
65-
- packages/react-client/node_modules
66-
- packages/react-devtools-core/node_modules
67-
- packages/react-devtools-extensions/node_modules
68-
- packages/react-devtools-inline/node_modules
69-
- packages/react-devtools-shared/node_modules
70-
- packages/react-devtools-shell/node_modules
71-
- packages/react-devtools-timeline/node_modules
72-
- packages/react-devtools/node_modules
73-
- packages/react-dom/node_modules
74-
- packages/react-interactions/node_modules
75-
- packages/react-native-renderer/node_modules
76-
- packages/react-reconciler/node_modules
77-
- packages/react-server-dom-relay/node_modules
78-
- packages/react-server-dom-webpack/node_modules
79-
- packages/react-server-native-relay/node_modules
80-
- packages/react-server/node_modules
81-
- packages/react-test-renderer/node_modules
82-
- packages/react/node_modules
83-
- packages/scheduler/node_modules
84-
85-
- &restore_node_modules
86-
restore_cache:
87-
name: Restore node_modules cache
88-
keys:
89-
- v1-node_modules-{{ arch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}
90-
9152
- &TEST_PARALLELISM 20
9253

9354
- &attach_workspace
@@ -113,21 +74,18 @@ jobs:
11374
- run:
11475
name: Nodejs Version
11576
command: node --version
116-
- *prepare_node_modules_cache_key
11777
- *restore_yarn_cache
118-
- *restore_node_modules
11978
- *yarn_install
12079
- *save_yarn_cache
121-
- *save_node_modules
12280

12381
yarn_lint:
12482
docker: *docker
12583
environment: *environment
12684

12785
steps:
12886
- checkout
129-
- *prepare_node_modules_cache_key
130-
- *restore_node_modules
87+
- *restore_yarn_cache
88+
- *yarn_install
13189
- run: node ./scripts/prettier/index
13290
- run: node ./scripts/tasks/eslint
13391
- run: ./scripts/circleci/check_license.sh
@@ -141,8 +99,8 @@ jobs:
14199

142100
steps:
143101
- checkout
144-
- *prepare_node_modules_cache_key
145-
- *restore_node_modules
102+
- *restore_yarn_cache
103+
- *yarn_install
146104
- run: node ./scripts/tasks/flow-ci
147105

148106
scrape_warning_messages:
@@ -151,8 +109,8 @@ jobs:
151109

152110
steps:
153111
- checkout
154-
- *prepare_node_modules_cache_key
155-
- *restore_node_modules
112+
- *restore_yarn_cache
113+
- *yarn_install
156114
- run:
157115
command: |
158116
mkdir -p ./build
@@ -168,8 +126,8 @@ jobs:
168126
parallelism: 40
169127
steps:
170128
- checkout
171-
- *prepare_node_modules_cache_key
172-
- *restore_node_modules
129+
- *restore_yarn_cache
130+
- *yarn_install
173131
- run: yarn build-combined
174132
- persist_to_workspace:
175133
root: .
@@ -184,8 +142,8 @@ jobs:
184142
type: string
185143
steps:
186144
- checkout
187-
- *prepare_node_modules_cache_key
188-
- *restore_node_modules
145+
- *restore_yarn_cache
146+
- *yarn_install
189147
- run:
190148
name: Download artifacts for revision
191149
command: |
@@ -202,8 +160,8 @@ jobs:
202160
environment: *environment
203161
steps:
204162
- checkout
205-
- *prepare_node_modules_cache_key
206-
- *restore_node_modules
163+
- *restore_yarn_cache
164+
- *yarn_install
207165
- run:
208166
name: Download artifacts for base revision
209167
command: |
@@ -231,8 +189,8 @@ jobs:
231189
- checkout
232190
- attach_workspace:
233191
at: .
234-
- *prepare_node_modules_cache_key
235-
- *restore_node_modules
192+
- *restore_yarn_cache
193+
- *yarn_install
236194
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
237195
# Compress build directory into a single tarball for easy download
238196
- run: tar -zcvf ./build.tgz ./build
@@ -251,8 +209,8 @@ jobs:
251209
- attach_workspace:
252210
at: .
253211
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
254-
- *prepare_node_modules_cache_key
255-
- *restore_node_modules
212+
- *restore_yarn_cache
213+
- *yarn_install
256214
- run:
257215
command: node ./scripts/tasks/danger
258216

@@ -263,8 +221,8 @@ jobs:
263221
- checkout
264222
- attach_workspace:
265223
at: .
266-
- *prepare_node_modules_cache_key
267-
- *restore_node_modules
224+
- *restore_yarn_cache
225+
- *yarn_install
268226
- run:
269227
environment:
270228
RELEASE_CHANNEL: experimental
@@ -279,8 +237,8 @@ jobs:
279237
- checkout
280238
- attach_workspace:
281239
at: .
282-
- *prepare_node_modules_cache_key
283-
- *restore_node_modules
240+
- *restore_yarn_cache
241+
- *yarn_install
284242
- run:
285243
name: Playwright install deps
286244
command: |
@@ -302,8 +260,8 @@ jobs:
302260
- checkout
303261
- attach_workspace:
304262
at: .
305-
- *prepare_node_modules_cache_key
306-
- *restore_node_modules
263+
- *restore_yarn_cache
264+
- *yarn_install
307265
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >> --replaceBuild
308266
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion << parameters.version >> --ci
309267

@@ -318,8 +276,8 @@ jobs:
318276
- checkout
319277
- attach_workspace:
320278
at: .
321-
- *prepare_node_modules_cache_key
322-
- *restore_node_modules
279+
- *restore_yarn_cache
280+
- *yarn_install
323281
- run:
324282
name: Playwright install deps
325283
command: |
@@ -343,8 +301,8 @@ jobs:
343301
- checkout
344302
- attach_workspace:
345303
at: .
346-
- *prepare_node_modules_cache_key
347-
- *restore_node_modules
304+
- *restore_yarn_cache
305+
- *yarn_install
348306
- run: yarn lint-build
349307

350308
yarn_check_release_dependencies:
@@ -354,8 +312,8 @@ jobs:
354312
- checkout
355313
- attach_workspace:
356314
at: .
357-
- *prepare_node_modules_cache_key
358-
- *restore_node_modules
315+
- *restore_yarn_cache
316+
- *yarn_install
359317
- run: yarn check-release-dependencies
360318

361319

@@ -365,8 +323,8 @@ jobs:
365323
steps:
366324
- checkout
367325
- attach_workspace: *attach_workspace
368-
- *prepare_node_modules_cache_key
369-
- *restore_node_modules
326+
- *restore_yarn_cache
327+
- *yarn_install
370328
- run:
371329
name: Search build artifacts for unminified errors
372330
command: |
@@ -382,8 +340,8 @@ jobs:
382340
type: string
383341
steps:
384342
- checkout
385-
- *prepare_node_modules_cache_key
386-
- *restore_node_modules
343+
- *restore_yarn_cache
344+
- *yarn_install
387345
- run: yarn test <<parameters.args>> --ci
388346

389347
yarn_test_build:
@@ -397,8 +355,8 @@ jobs:
397355
- checkout
398356
- attach_workspace:
399357
at: .
400-
- *prepare_node_modules_cache_key
401-
- *restore_node_modules
358+
- *restore_yarn_cache
359+
- *yarn_install
402360
- run: yarn test --build <<parameters.args>> --ci
403361

404362
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
@@ -408,8 +366,6 @@ jobs:
408366
- checkout
409367
- attach_workspace:
410368
at: .
411-
- *prepare_node_modules_cache_key
412-
- *restore_node_modules
413369
- *restore_yarn_cache_fixtures_dom
414370
- *yarn_install_fixtures_dom
415371
- *save_yarn_cache_fixtures_dom
@@ -427,8 +383,8 @@ jobs:
427383
environment: *environment
428384
steps:
429385
- checkout
430-
- *prepare_node_modules_cache_key
431-
- *restore_node_modules
386+
- *restore_yarn_cache
387+
- *yarn_install
432388
- run:
433389
name: Run fuzz tests
434390
command: |
@@ -447,8 +403,8 @@ jobs:
447403
environment: *environment
448404
steps:
449405
- checkout
450-
- *prepare_node_modules_cache_key
451-
- *restore_node_modules
406+
- *restore_yarn_cache
407+
- *yarn_install
452408
- run:
453409
name: Run publish script
454410
command: |
@@ -466,8 +422,8 @@ jobs:
466422
environment: *environment
467423
steps:
468424
- checkout
469-
- *prepare_node_modules_cache_key
470-
- *restore_node_modules
425+
- *restore_yarn_cache
426+
- *yarn_install
471427
- run:
472428
name: Fetch revisions that contain an intentional fork
473429
# This will fetch each revision listed in the `forked-revisions` file,

0 commit comments

Comments
 (0)