Skip to content

Commit 6733870

Browse files
authored
[ci] Update yarn and node_modules cache key (facebook#32603)
Now that the compiler lint rule is merged into eslint-plugin-react-hooks, we also need to update our caches so compiler dependencies are also cached. This should fix the CI walltime regression we are now seeing. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32603). * facebook#32604 * __->__ facebook#32603
1 parent 7939d92 commit 6733870

File tree

7 files changed

+66
-41
lines changed

7 files changed

+66
-41
lines changed

.github/workflows/runtime_build_and_test.yml

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ jobs:
5050
with:
5151
node-version-file: '.nvmrc'
5252
cache: yarn
53-
cache-dependency-path: yarn.lock
53+
cache-dependency-path: '**/yarn.lock'
5454
- name: Restore cached node_modules
5555
uses: actions/cache@v4
5656
id: node_modules
5757
with:
5858
path: "**/node_modules"
59-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
59+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
6060
- name: Ensure clean build directory
6161
run: rm -rf build
6262
- run: yarn install --frozen-lockfile
@@ -74,16 +74,18 @@ jobs:
7474
with:
7575
node-version-file: '.nvmrc'
7676
cache: yarn
77-
cache-dependency-path: yarn.lock
77+
cache-dependency-path: '**/yarn.lock'
7878
- name: Restore cached node_modules
7979
uses: actions/cache@v4
8080
id: node_modules
8181
with:
8282
path: "**/node_modules"
83-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
83+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
8484
- name: Ensure clean build directory
8585
run: rm -rf build
8686
- run: yarn install --frozen-lockfile
87+
- run: yarn install --frozen-lockfile
88+
working-directory: compiler
8789
- run: |
8890
yarn generate-inline-fizz-runtime
8991
git diff --quiet || (echo "There was a change to the Fizz runtime. Run `yarn generate-inline-fizz-runtime` and check in the result." && false)
@@ -100,16 +102,18 @@ jobs:
100102
with:
101103
node-version-file: '.nvmrc'
102104
cache: yarn
103-
cache-dependency-path: yarn.lock
105+
cache-dependency-path: '**/yarn.lock'
104106
- name: Restore cached node_modules
105107
uses: actions/cache@v4
106108
id: node_modules
107109
with:
108110
path: "**/node_modules"
109-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
111+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
110112
- name: Ensure clean build directory
111113
run: rm -rf build
112114
- run: yarn install --frozen-lockfile
115+
- run: yarn install --frozen-lockfile
116+
working-directory: compiler
113117
- run: yarn flags
114118

115119
# ----- TESTS -----
@@ -153,16 +157,18 @@ jobs:
153157
with:
154158
node-version-file: '.nvmrc'
155159
cache: yarn
156-
cache-dependency-path: yarn.lock
160+
cache-dependency-path: '**/yarn.lock'
157161
- name: Restore cached node_modules
158162
uses: actions/cache@v4
159163
id: node_modules
160164
with:
161165
path: "**/node_modules"
162-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
166+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
163167
- name: Ensure clean build directory
164168
run: rm -rf build
165169
- run: yarn install --frozen-lockfile
170+
- run: yarn install --frozen-lockfile
171+
working-directory: compiler
166172
- run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}
167173

168174
# ----- BUILD -----
@@ -183,7 +189,7 @@ jobs:
183189
with:
184190
node-version-file: '.nvmrc'
185191
cache: yarn
186-
cache-dependency-path: yarn.lock
192+
cache-dependency-path: '**/yarn.lock'
187193
- uses: actions/setup-java@v4
188194
with:
189195
distribution: temurin
@@ -193,10 +199,12 @@ jobs:
193199
id: node_modules
194200
with:
195201
path: "**/node_modules"
196-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
202+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
197203
- name: Ensure clean build directory
198204
run: rm -rf build
199205
- run: yarn install --frozen-lockfile
206+
- run: yarn install --frozen-lockfile
207+
working-directory: compiler
200208
- run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci
201209
env:
202210
CI: github
@@ -261,16 +269,18 @@ jobs:
261269
with:
262270
node-version-file: '.nvmrc'
263271
cache: yarn
264-
cache-dependency-path: yarn.lock
272+
cache-dependency-path: '**/yarn.lock'
265273
- name: Restore cached node_modules
266274
uses: actions/cache@v4
267275
id: node_modules
268276
with:
269277
path: "**/node_modules"
270-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
278+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
271279
- name: Ensure clean build directory
272280
run: rm -rf build
273281
- run: yarn install --frozen-lockfile
282+
- run: yarn install --frozen-lockfile
283+
working-directory: compiler
274284
- name: Restore archived build
275285
uses: actions/download-artifact@v4
276286
with:
@@ -293,16 +303,18 @@ jobs:
293303
with:
294304
node-version-file: '.nvmrc'
295305
cache: yarn
296-
cache-dependency-path: yarn.lock
306+
cache-dependency-path: '**/yarn.lock'
297307
- name: Restore cached node_modules
298308
uses: actions/cache@v4
299309
id: node_modules
300310
with:
301311
path: "**/node_modules"
302-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
312+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
303313
- name: Ensure clean build directory
304314
run: rm -rf build
305315
- run: yarn install --frozen-lockfile
316+
- run: yarn install --frozen-lockfile
317+
working-directory: compiler
306318
- name: Restore archived build
307319
uses: actions/download-artifact@v4
308320
with:
@@ -340,16 +352,18 @@ jobs:
340352
with:
341353
node-version-file: '.nvmrc'
342354
cache: yarn
343-
cache-dependency-path: yarn.lock
355+
cache-dependency-path: '**/yarn.lock'
344356
- name: Restore cached node_modules
345357
uses: actions/cache@v4
346358
id: node_modules
347359
with:
348360
path: "**/node_modules"
349-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
361+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
350362
- name: Ensure clean build directory
351363
run: rm -rf build
352364
- run: yarn install --frozen-lockfile
365+
- run: yarn install --frozen-lockfile
366+
working-directory: compiler
353367
- name: Restore archived build
354368
uses: actions/download-artifact@v4
355369
with:
@@ -375,16 +389,18 @@ jobs:
375389
with:
376390
node-version-file: '.nvmrc'
377391
cache: yarn
378-
cache-dependency-path: yarn.lock
392+
cache-dependency-path: '**/yarn.lock'
379393
- name: Restore cached node_modules
380394
uses: actions/cache@v4
381395
id: node_modules
382396
with:
383397
path: "**/node_modules"
384-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
398+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
385399
- name: Ensure clean build directory
386400
run: rm -rf build
387401
- run: yarn install --frozen-lockfile
402+
- run: yarn install --frozen-lockfile
403+
working-directory: compiler
388404
- name: Restore archived build
389405
uses: actions/download-artifact@v4
390406
with:
@@ -407,13 +423,13 @@ jobs:
407423
with:
408424
node-version-file: '.nvmrc'
409425
cache: yarn
410-
cache-dependency-path: yarn.lock
426+
cache-dependency-path: 'fixtures/dom/yarn.lock'
411427
- name: Restore cached node_modules
412428
uses: actions/cache@v4
413429
id: node_modules
414430
with:
415431
path: "**/node_modules"
416-
key: fixtures_dom-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
432+
key: fixtures_dom-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('fixtures/dom/yarn.lock') }}
417433
- name: Ensure clean build directory
418434
run: rm -rf build
419435
- run: yarn install --frozen-lockfile
@@ -447,7 +463,7 @@ jobs:
447463
with:
448464
node-version-file: '.nvmrc'
449465
cache: yarn
450-
cache-dependency-path: yarn.lock
466+
cache-dependency-path: '**/yarn.lock'
451467
# Fixture copies some built packages from the workroot after install.
452468
# That means dependencies of the built packages are not installed.
453469
# We need to install dependencies of the workroot to fulfill all dependency constraints
@@ -456,10 +472,12 @@ jobs:
456472
id: node_modules
457473
with:
458474
path: "**/node_modules"
459-
key: fixtures_flight-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
475+
key: fixtures_flight-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
460476
- name: Ensure clean build directory
461477
run: rm -rf build
462478
- run: yarn install --frozen-lockfile
479+
- run: yarn install --frozen-lockfile
480+
working-directory: compiler
463481
- name: Restore archived build
464482
uses: actions/download-artifact@v4
465483
with:
@@ -512,16 +530,18 @@ jobs:
512530
with:
513531
node-version-file: '.nvmrc'
514532
cache: yarn
515-
cache-dependency-path: yarn.lock
533+
cache-dependency-path: '**/yarn.lock'
516534
- name: Restore cached node_modules
517535
uses: actions/cache@v4
518536
id: node_modules
519537
with:
520538
path: "**/node_modules"
521-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
539+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
522540
- name: Ensure clean build directory
523541
run: rm -rf build
524542
- run: yarn install --frozen-lockfile
543+
- run: yarn install --frozen-lockfile
544+
working-directory: compiler
525545
- name: Restore archived build
526546
uses: actions/download-artifact@v4
527547
with:
@@ -563,16 +583,18 @@ jobs:
563583
with:
564584
node-version-file: '.nvmrc'
565585
cache: yarn
566-
cache-dependency-path: yarn.lock
586+
cache-dependency-path: '**/yarn.lock'
567587
- name: Restore cached node_modules
568588
uses: actions/cache@v4
569589
id: node_modules
570590
with:
571591
path: "**/node_modules"
572-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
592+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
573593
- name: Ensure clean build directory
574594
run: rm -rf build
575595
- run: yarn install --frozen-lockfile
596+
- run: yarn install --frozen-lockfile
597+
working-directory: compiler
576598
- name: Restore archived build
577599
uses: actions/download-artifact@v4
578600
with:
@@ -600,13 +622,13 @@ jobs:
600622
with:
601623
node-version-file: '.nvmrc'
602624
cache: yarn
603-
cache-dependency-path: yarn.lock
625+
cache-dependency-path: '**/yarn.lock'
604626
- name: Restore cached node_modules
605627
uses: actions/cache@v4
606628
id: node_modules
607629
with:
608630
path: "**/node_modules"
609-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
631+
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
610632
- name: Ensure clean build directory
611633
run: rm -rf build
612634
- run: yarn install --frozen-lockfile
@@ -626,6 +648,8 @@ jobs:
626648
- name: Ensure clean build directory
627649
run: rm -rf build
628650
- run: yarn install --frozen-lockfile
651+
- run: yarn install --frozen-lockfile
652+
working-directory: compiler
629653
- name: Restore archived build for PR
630654
uses: actions/download-artifact@v4
631655
with:

.github/workflows/runtime_eslint_plugin_e2e.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ jobs:
3535
with:
3636
node-version-file: '.nvmrc'
3737
cache: yarn
38-
cache-dependency-path: yarn.lock
38+
cache-dependency-path: '**/yarn.lock'
3939
- name: Restore cached node_modules
4040
uses: actions/cache@v4
4141
id: node_modules
4242
with:
43-
path: "node_modules"
44-
key: runtime-eslint_e2e-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
43+
path: "**/node_modules"
44+
key: runtime-eslint_e2e-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
4545
- name: Ensure clean build directory
4646
run: rm -rf build
4747
- run: yarn install --frozen-lockfile
48+
- run: yarn install --frozen-lockfile
49+
working-directory: compiler
4850
- name: Build plugin
4951
working-directory: fixtures/eslint-v${{ matrix.eslint_major }}
5052
run: node build.mjs

.github/workflows/runtime_prereleases.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ jobs:
3434
with:
3535
node-version-file: '.nvmrc'
3636
cache: yarn
37-
cache-dependency-path: yarn.lock
37+
cache-dependency-path: '**/yarn.lock'
3838
- name: Restore cached node_modules
3939
uses: actions/cache@v4
4040
id: node_modules
4141
with:
4242
path: "**/node_modules"
43-
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
43+
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
4444
- name: Ensure clean build directory
4545
run: rm -rf build
4646
- run: yarn install --frozen-lockfile

.github/workflows/runtime_releases_from_npm_manual.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ jobs:
6666
with:
6767
node-version-file: '.nvmrc'
6868
cache: yarn
69-
cache-dependency-path: yarn.lock
69+
cache-dependency-path: '**/yarn.lock'
7070
- name: Restore cached node_modules
7171
uses: actions/cache@v4
7272
id: node_modules
7373
with:
7474
path: "**/node_modules"
75-
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
75+
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
7676
- name: Ensure clean build directory
7777
run: rm -rf build
7878
- run: yarn install --frozen-lockfile

.github/workflows/shared_lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
node-version-file: '.nvmrc'
2626
cache: yarn
27-
cache-dependency-path: yarn.lock
27+
cache-dependency-path: '**/yarn.lock'
2828
- name: Restore cached node_modules
2929
uses: actions/cache@v4
3030
with:
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
node-version-file: '.nvmrc'
4646
cache: yarn
47-
cache-dependency-path: yarn.lock
47+
cache-dependency-path: '**/yarn.lock'
4848
- name: Restore cached node_modules
4949
uses: actions/cache@v4
5050
with:
@@ -64,7 +64,7 @@ jobs:
6464
with:
6565
node-version-file: '.nvmrc'
6666
cache: yarn
67-
cache-dependency-path: yarn.lock
67+
cache-dependency-path: '**/yarn.lock'
6868
- name: Restore cached node_modules
6969
uses: actions/cache@v4
7070
with:
@@ -84,7 +84,7 @@ jobs:
8484
with:
8585
node-version-file: '.nvmrc'
8686
cache: yarn
87-
cache-dependency-path: yarn.lock
87+
cache-dependency-path: '**/yarn.lock'
8888
- name: Restore cached node_modules
8989
uses: actions/cache@v4
9090
with:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
119119
},
120120
"scripts": {
121-
"prebuild": "yarn --cwd compiler install --frozen-lockfile && ./scripts/react-compiler/link-compiler.sh",
121+
"prebuild": "./scripts/react-compiler/link-compiler.sh",
122122
"build": "node ./scripts/rollup/build-all-release-channels.js",
123123
"build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react/compiler-runtime,react-dom/index,react-dom/client,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE",
124124
"build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV",

scripts/react-compiler/build-compiler.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ if [[ "$REACT_CLASS_EQUIVALENCE_TEST" == "true" ]]; then
1111
fi
1212

1313
echo "Building babel-plugin-react-compiler..."
14-
yarn --cwd compiler install --frozen-lockfile
1514
yarn --cwd compiler workspace babel-plugin-react-compiler build --dts

0 commit comments

Comments
 (0)