Skip to content

Commit 91c2884

Browse files
committed
always cache yarn cache instead of partially node_modules
1 parent 8747360 commit 91c2884

File tree

1 file changed

+41
-83
lines changed

1 file changed

+41
-83
lines changed

.circleci/config.yml

Lines changed: 41 additions & 83 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,9 +74,8 @@ 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
78+
- *yarn_install
11979
- *yarn_install
12080
- *save_yarn_cache
12181
- *save_node_modules
@@ -126,8 +86,8 @@ jobs:
12686

12787
steps:
12888
- checkout
129-
- *prepare_node_modules_cache_key
130-
- *restore_node_modules
89+
- *restore_yarn_cache
90+
- *yarn_install
13191
- run: node ./scripts/prettier/index
13292
- run: node ./scripts/tasks/eslint
13393
- run: ./scripts/circleci/check_license.sh
@@ -141,8 +101,8 @@ jobs:
141101

142102
steps:
143103
- checkout
144-
- *prepare_node_modules_cache_key
145-
- *restore_node_modules
104+
- *restore_yarn_cache
105+
- *yarn_install
146106
- run: node ./scripts/tasks/flow-ci
147107

148108
scrape_warning_messages:
@@ -151,8 +111,8 @@ jobs:
151111

152112
steps:
153113
- checkout
154-
- *prepare_node_modules_cache_key
155-
- *restore_node_modules
114+
- *restore_yarn_cache
115+
- *yarn_install
156116
- run:
157117
command: |
158118
mkdir -p ./build
@@ -168,8 +128,8 @@ jobs:
168128
parallelism: 40
169129
steps:
170130
- checkout
171-
- *prepare_node_modules_cache_key
172-
- *restore_node_modules
131+
- *restore_yarn_cache
132+
- *yarn_install
173133
- run: yarn build-combined
174134
- persist_to_workspace:
175135
root: .
@@ -184,8 +144,8 @@ jobs:
184144
type: string
185145
steps:
186146
- checkout
187-
- *prepare_node_modules_cache_key
188-
- *restore_node_modules
147+
- *restore_yarn_cache
148+
- *yarn_install
189149
- run:
190150
name: Download artifacts for revision
191151
command: |
@@ -202,8 +162,8 @@ jobs:
202162
environment: *environment
203163
steps:
204164
- checkout
205-
- *prepare_node_modules_cache_key
206-
- *restore_node_modules
165+
- *restore_yarn_cache
166+
- *yarn_install
207167
- run:
208168
name: Download artifacts for base revision
209169
command: |
@@ -231,8 +191,8 @@ jobs:
231191
- checkout
232192
- attach_workspace:
233193
at: .
234-
- *prepare_node_modules_cache_key
235-
- *restore_node_modules
194+
- *restore_yarn_cache
195+
- *yarn_install
236196
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
237197
# Compress build directory into a single tarball for easy download
238198
- run: tar -zcvf ./build.tgz ./build
@@ -251,8 +211,8 @@ jobs:
251211
- attach_workspace:
252212
at: .
253213
- run: echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
254-
- *prepare_node_modules_cache_key
255-
- *restore_node_modules
214+
- *restore_yarn_cache
215+
- *yarn_install
256216
- run:
257217
command: node ./scripts/tasks/danger
258218

@@ -263,8 +223,8 @@ jobs:
263223
- checkout
264224
- attach_workspace:
265225
at: .
266-
- *prepare_node_modules_cache_key
267-
- *restore_node_modules
226+
- *restore_yarn_cache
227+
- *yarn_install
268228
- run:
269229
environment:
270230
RELEASE_CHANNEL: experimental
@@ -279,8 +239,8 @@ jobs:
279239
- checkout
280240
- attach_workspace:
281241
at: .
282-
- *prepare_node_modules_cache_key
283-
- *restore_node_modules
242+
- *restore_yarn_cache
243+
- *yarn_install
284244
- run:
285245
name: Playwright install deps
286246
command: |
@@ -302,8 +262,8 @@ jobs:
302262
- checkout
303263
- attach_workspace:
304264
at: .
305-
- *prepare_node_modules_cache_key
306-
- *restore_node_modules
265+
- *restore_yarn_cache
266+
- *yarn_install
307267
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >> --replaceBuild
308268
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion << parameters.version >> --ci
309269

@@ -318,8 +278,8 @@ jobs:
318278
- checkout
319279
- attach_workspace:
320280
at: .
321-
- *prepare_node_modules_cache_key
322-
- *restore_node_modules
281+
- *restore_yarn_cache
282+
- *yarn_install
323283
- run:
324284
name: Playwright install deps
325285
command: |
@@ -343,8 +303,8 @@ jobs:
343303
- checkout
344304
- attach_workspace:
345305
at: .
346-
- *prepare_node_modules_cache_key
347-
- *restore_node_modules
306+
- *restore_yarn_cache
307+
- *yarn_install
348308
- run: yarn lint-build
349309

350310
yarn_check_release_dependencies:
@@ -354,8 +314,8 @@ jobs:
354314
- checkout
355315
- attach_workspace:
356316
at: .
357-
- *prepare_node_modules_cache_key
358-
- *restore_node_modules
317+
- *restore_yarn_cache
318+
- *yarn_install
359319
- run: yarn check-release-dependencies
360320

361321

@@ -365,8 +325,8 @@ jobs:
365325
steps:
366326
- checkout
367327
- attach_workspace: *attach_workspace
368-
- *prepare_node_modules_cache_key
369-
- *restore_node_modules
328+
- *restore_yarn_cache
329+
- *yarn_install
370330
- run:
371331
name: Search build artifacts for unminified errors
372332
command: |
@@ -382,8 +342,8 @@ jobs:
382342
type: string
383343
steps:
384344
- checkout
385-
- *prepare_node_modules_cache_key
386-
- *restore_node_modules
345+
- *restore_yarn_cache
346+
- *yarn_install
387347
- run: yarn test <<parameters.args>> --ci
388348

389349
yarn_test_build:
@@ -397,8 +357,8 @@ jobs:
397357
- checkout
398358
- attach_workspace:
399359
at: .
400-
- *prepare_node_modules_cache_key
401-
- *restore_node_modules
360+
- *restore_yarn_cache
361+
- *yarn_install
402362
- run: yarn test --build <<parameters.args>> --ci
403363

404364
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
@@ -408,8 +368,6 @@ jobs:
408368
- checkout
409369
- attach_workspace:
410370
at: .
411-
- *prepare_node_modules_cache_key
412-
- *restore_node_modules
413371
- *restore_yarn_cache_fixtures_dom
414372
- *yarn_install_fixtures_dom
415373
- *save_yarn_cache_fixtures_dom
@@ -427,8 +385,8 @@ jobs:
427385
environment: *environment
428386
steps:
429387
- checkout
430-
- *prepare_node_modules_cache_key
431-
- *restore_node_modules
388+
- *restore_yarn_cache
389+
- *yarn_install
432390
- run:
433391
name: Run fuzz tests
434392
command: |
@@ -447,8 +405,8 @@ jobs:
447405
environment: *environment
448406
steps:
449407
- checkout
450-
- *prepare_node_modules_cache_key
451-
- *restore_node_modules
408+
- *restore_yarn_cache
409+
- *yarn_install
452410
- run:
453411
name: Run publish script
454412
command: |
@@ -466,8 +424,8 @@ jobs:
466424
environment: *environment
467425
steps:
468426
- checkout
469-
- *prepare_node_modules_cache_key
470-
- *restore_node_modules
427+
- *restore_yarn_cache
428+
- *yarn_install
471429
- run:
472430
name: Fetch revisions that contain an intentional fork
473431
# This will fetch each revision listed in the `forked-revisions` file,

0 commit comments

Comments
 (0)