@@ -10,18 +10,93 @@ aliases:
1010 - &restore_yarn_cache
1111 restore_cache :
1212 name : Restore yarn cache
13- key : v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
13+ keys :
14+ - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
15+ - v1-yarn_cache-{{ arch }}-
16+ - v1-yarn_cache-
17+
18+ - &yarn_install
19+ run :
20+ name : Install dependencies
21+ command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
22+
23+ - &yarn_install_retry
24+ run :
25+ name : Install dependencies (retry)
26+ when : on_fail
27+ command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
28+
29+ - &save_yarn_cache
30+ save_cache :
31+ name : Save yarn cache
32+ key : v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
33+ paths :
34+ - ~/.cache/yarn
35+
36+ - &restore_yarn_cache_fixtures_dom
37+ restore_cache :
38+ name : Restore yarn cache for fixtures/dom
39+ keys :
40+ - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom
41+ - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}
42+ - v1-yarn_cache-{{ arch }}-
43+ - v1-yarn_cache-
44+
45+ - &yarn_install_fixtures_dom
46+ run :
47+ name : Install dependencies in fixtures/dom
48+ working_directory : fixtures/dom
49+ command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
1450
15- - &prepare_node_modules_cache_key
51+ - &yarn_install_fixtures_dom_retry
1652 run :
17- name : Preparing node_modules cache key
18- command : yarn workspaces info | head -n -1 > workspace_info.txt
53+ name : Install dependencies in fixtures/dom (retry)
54+ when : on_fail
55+ working_directory : fixtures/dom
56+ command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
57+
58+ - &save_yarn_cache_fixtures_dom
59+ save_cache :
60+ name : Save yarn cache for fixtures/dom
61+ key : v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom
62+ paths :
63+ - ~/.cache/yarn
64+
65+ - &save_node_modules
66+ save_cache :
67+ name : Save node_modules cache
68+ # Cache only for the current revision to prevent cache injections from
69+ # malicious PRs.
70+ key : v1-node_modules-{{ arch }}-{{ .Revision }}
71+ paths :
72+ - node_modules
73+ - packages/eslint-plugin-react-hooks/node_modules
74+ - packages/react-art/node_modules
75+ - packages/react-client/node_modules
76+ - packages/react-devtools-core/node_modules
77+ - packages/react-devtools-extensions/node_modules
78+ - packages/react-devtools-inline/node_modules
79+ - packages/react-devtools-shared/node_modules
80+ - packages/react-devtools-shell/node_modules
81+ - packages/react-devtools-timeline/node_modules
82+ - packages/react-devtools/node_modules
83+ - packages/react-dom/node_modules
84+ - packages/react-interactions/node_modules
85+ - packages/react-native-renderer/node_modules
86+ - packages/react-reconciler/node_modules
87+ - packages/react-server-dom-relay/node_modules
88+ - packages/react-server-dom-webpack/node_modules
89+ - packages/react-server-native-relay/node_modules
90+ - packages/react-server/node_modules
91+ - packages/react-test-renderer/node_modules
92+ - packages/react/node_modules
93+ - packages/scheduler/node_modules
1994
2095 - &restore_node_modules
2196 restore_cache :
2297 name : Restore node_modules cache
2398 keys :
24- - v2-node -{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules
99+ - v1-node_modules -{{ arch }}-{{ .Revision }}
25100
26101 - &TEST_PARALLELISM 20
27102
@@ -49,35 +124,18 @@ jobs:
49124 name : Nodejs Version
50125 command : node --version
51126 - *restore_yarn_cache
52- - run :
53- name : Install Packages
54- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
55- - run : yarn workspaces info | head -n -1 > workspace_info.txt
56- - save_cache :
57- # Store the yarn cache globally for all lock files with this same
58- # checksum. This will speed up the setup job for all PRs where the
59- # lockfile is the same.
60- name : Save yarn cache for future installs
61- key : v2-node-{{ arch }}-{{ checksum "yarn.lock" }}-yarn
62- paths :
63- - ~/.cache/yarn
64- - save_cache :
65- # Store node_modules for all jobs in this workflow so that they don't
66- # need to each run a yarn install for each job. This will speed up
67- # all jobs run on this branch with the same lockfile.
68- name : Save node_modules cache
69- # This cache key is per branch, a yarn install in setup is required.
70- key : v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum "workspace_info.txt" }}-node-modules
71- paths :
72- - node_modules
127+ - *restore_node_modules
128+ - *yarn_install
129+ - *yarn_install_retry
130+ - *save_yarn_cache
131+ - *save_node_modules
73132
74133 yarn_lint :
75134 docker : *docker
76135 environment : *environment
77136
78137 steps :
79138 - checkout
80- - *prepare_node_modules_cache_key
81139 - *restore_node_modules
82140 - run : node ./scripts/prettier/index
83141 - run : node ./scripts/tasks/eslint
92150
93151 steps :
94152 - checkout
95- - *prepare_node_modules_cache_key
96153 - *restore_node_modules
97154 - run : node ./scripts/tasks/flow-ci
98155
@@ -102,7 +159,6 @@ jobs:
102159
103160 steps :
104161 - checkout
105- - *prepare_node_modules_cache_key
106162 - *restore_node_modules
107163 - run :
108164 command : |
@@ -119,7 +175,6 @@ jobs:
119175 parallelism : 40
120176 steps :
121177 - checkout
122- - *prepare_node_modules_cache_key
123178 - *restore_node_modules
124179 - run : yarn build-combined
125180 - persist_to_workspace :
@@ -135,7 +190,6 @@ jobs:
135190 type : string
136191 steps :
137192 - checkout
138- - *prepare_node_modules_cache_key
139193 - *restore_node_modules
140194 - run :
141195 name : Download artifacts for revision
@@ -153,7 +207,6 @@ jobs:
153207 environment : *environment
154208 steps :
155209 - checkout
156- - *prepare_node_modules_cache_key
157210 - *restore_node_modules
158211 - run :
159212 name : Download artifacts for base revision
@@ -182,7 +235,6 @@ jobs:
182235 - checkout
183236 - attach_workspace :
184237 at : .
185- - *prepare_node_modules_cache_key
186238 - *restore_node_modules
187239 - run : echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
188240 # Compress build directory into a single tarball for easy download
@@ -202,7 +254,6 @@ jobs:
202254 - attach_workspace :
203255 at : .
204256 - run : echo "<< pipeline.git.revision >>" >> build/COMMIT_SHA
205- - *prepare_node_modules_cache_key
206257 - *restore_node_modules
207258 - run :
208259 command : node ./scripts/tasks/danger
@@ -214,11 +265,7 @@ jobs:
214265 - checkout
215266 - attach_workspace :
216267 at : .
217- - *prepare_node_modules_cache_key
218268 - *restore_node_modules
219- - run :
220- name : Install Packages
221- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
222269 - run :
223270 environment :
224271 RELEASE_CHANNEL : experimental
@@ -233,11 +280,7 @@ jobs:
233280 - checkout
234281 - attach_workspace :
235282 at : .
236- - *prepare_node_modules_cache_key
237283 - *restore_node_modules
238- - run :
239- name : Install Packages
240- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
241284 - run :
242285 name : Playwright install deps
243286 command : |
@@ -259,11 +302,7 @@ jobs:
259302 - checkout
260303 - attach_workspace :
261304 at : .
262- - *prepare_node_modules_cache_key
263305 - *restore_node_modules
264- - run :
265- name : Install nested packages from Yarn cache
266- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
267306 - run : ./scripts/circleci/download_devtools_regression_build.js << parameters.version >> --replaceBuild
268307 - run : node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion << parameters.version >> --ci
269308
@@ -278,11 +317,7 @@ jobs:
278317 - checkout
279318 - attach_workspace :
280319 at : .
281- - *prepare_node_modules_cache_key
282320 - *restore_node_modules
283- - run :
284- name : Install nested packages from Yarn cache
285- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
286321 - run :
287322 name : Playwright install deps
288323 command : |
@@ -306,7 +341,6 @@ jobs:
306341 - checkout
307342 - attach_workspace :
308343 at : .
309- - *prepare_node_modules_cache_key
310344 - *restore_node_modules
311345 - run : yarn lint-build
312346
@@ -317,7 +351,6 @@ jobs:
317351 - checkout
318352 - attach_workspace :
319353 at : .
320- - *prepare_node_modules_cache_key
321354 - *restore_node_modules
322355 - run : yarn check-release-dependencies
323356
@@ -328,7 +361,6 @@ jobs:
328361 steps :
329362 - checkout
330363 - attach_workspace : *attach_workspace
331- - *prepare_node_modules_cache_key
332364 - *restore_node_modules
333365 - run :
334366 name : Search build artifacts for unminified errors
@@ -345,7 +377,6 @@ jobs:
345377 type : string
346378 steps :
347379 - checkout
348- - *prepare_node_modules_cache_key
349380 - *restore_node_modules
350381 - run : yarn test <<parameters.args>> --ci
351382
@@ -360,11 +391,7 @@ jobs:
360391 - checkout
361392 - attach_workspace :
362393 at : .
363- - *prepare_node_modules_cache_key
364394 - *restore_node_modules
365- - run :
366- name : Install nested packages from Yarn cache
367- command : yarn --frozen-lockfile --cache-folder ~/.cache/yarn
368395 - run : yarn test --build <<parameters.args>> --ci
369396
370397 RELEASE_CHANNEL_stable_yarn_test_dom_fixtures :
@@ -374,15 +401,17 @@ jobs:
374401 - checkout
375402 - attach_workspace :
376403 at : .
377- - *prepare_node_modules_cache_key
378404 - *restore_node_modules
405+ - *restore_yarn_cache_fixtures_dom
406+ - *yarn_install_fixtures_dom
407+ - *yarn_install_fixtures_dom_retry
408+ - *save_yarn_cache_fixtures_dom
379409 - run :
380410 name : Run DOM fixture tests
381411 environment :
382412 RELEASE_CHANNEL : stable
413+ working_directory : fixtures/dom
383414 command : |
384- cd fixtures/dom
385- yarn --frozen-lockfile
386415 yarn prestart
387416 yarn test --maxWorkers=2
388417
@@ -391,7 +420,6 @@ jobs:
391420 environment : *environment
392421 steps :
393422 - checkout
394- - *prepare_node_modules_cache_key
395423 - *restore_node_modules
396424 - run :
397425 name : Run fuzz tests
@@ -411,7 +439,6 @@ jobs:
411439 environment : *environment
412440 steps :
413441 - checkout
414- - *prepare_node_modules_cache_key
415442 - *restore_node_modules
416443 - run :
417444 name : Run publish script
@@ -430,7 +457,6 @@ jobs:
430457 environment : *environment
431458 steps :
432459 - checkout
433- - *prepare_node_modules_cache_key
434460 - *restore_node_modules
435461 - run :
436462 name : Fetch revisions that contain an intentional fork
0 commit comments