Skip to content

Commit bcf873a

Browse files
committed
[ci] Cache runtime and compiler only for test runs
We only need the compiler built for `yarn test` in the root directory. Rather than always cache both for every step, let's just do it where it's needed explicitly.
1 parent 5200721 commit bcf873a

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

.github/workflows/runtime_build_and_test.yml

+29-17
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
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-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
6060
- name: Ensure clean build directory
6161
run: rm -rf build
6262
- run: yarn install --frozen-lockfile
@@ -80,7 +80,7 @@ jobs:
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-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
8484
- name: Ensure clean build directory
8585
run: rm -rf build
8686
- run: yarn install --frozen-lockfile
@@ -106,7 +106,7 @@ jobs:
106106
id: node_modules
107107
with:
108108
path: "**/node_modules"
109-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
109+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
110110
- name: Ensure clean build directory
111111
run: rm -rf build
112112
- run: yarn install --frozen-lockfile
@@ -153,16 +153,20 @@ jobs:
153153
with:
154154
node-version-file: '.nvmrc'
155155
cache: yarn
156-
cache-dependency-path: yarn.lock
156+
cache-dependency-path: |
157+
yarn.lock
158+
compiler/yarn.lock
157159
- name: Restore cached node_modules
158160
uses: actions/cache@v4
159161
id: node_modules
160162
with:
161163
path: "**/node_modules"
162-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
164+
key: runtime-and-compiler-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
163165
- name: Ensure clean build directory
164166
run: rm -rf build
165167
- run: yarn install --frozen-lockfile
168+
- run: yarn install --frozen-lockfile
169+
working-directory: compiler
166170
- run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}
167171

168172
# ----- BUILD -----
@@ -183,7 +187,9 @@ jobs:
183187
with:
184188
node-version-file: '.nvmrc'
185189
cache: yarn
186-
cache-dependency-path: yarn.lock
190+
cache-dependency-path: |
191+
yarn.lock
192+
compiler/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-and-compiler-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/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,20 @@ jobs:
261269
with:
262270
node-version-file: '.nvmrc'
263271
cache: yarn
264-
cache-dependency-path: yarn.lock
272+
cache-dependency-path: |
273+
yarn.lock
274+
compiler/yarn.lock
265275
- name: Restore cached node_modules
266276
uses: actions/cache@v4
267277
id: node_modules
268278
with:
269279
path: "**/node_modules"
270-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
280+
key: runtime-and-compiler-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
271281
- name: Ensure clean build directory
272282
run: rm -rf build
273283
- run: yarn install --frozen-lockfile
284+
- run: yarn install --frozen-lockfile
285+
working-directory: compiler
274286
- name: Restore archived build
275287
uses: actions/download-artifact@v4
276288
with:
@@ -299,7 +311,7 @@ jobs:
299311
id: node_modules
300312
with:
301313
path: "**/node_modules"
302-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
314+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
303315
- name: Ensure clean build directory
304316
run: rm -rf build
305317
- run: yarn install --frozen-lockfile
@@ -346,7 +358,7 @@ jobs:
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-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
350362
- name: Ensure clean build directory
351363
run: rm -rf build
352364
- run: yarn install --frozen-lockfile
@@ -381,7 +393,7 @@ jobs:
381393
id: node_modules
382394
with:
383395
path: "**/node_modules"
384-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
396+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
385397
- name: Ensure clean build directory
386398
run: rm -rf build
387399
- run: yarn install --frozen-lockfile
@@ -413,7 +425,7 @@ jobs:
413425
id: node_modules
414426
with:
415427
path: "**/node_modules"
416-
key: fixtures_dom-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
428+
key: fixtures_dom-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
417429
- name: Ensure clean build directory
418430
run: rm -rf build
419431
- run: yarn install --frozen-lockfile
@@ -456,7 +468,7 @@ jobs:
456468
id: node_modules
457469
with:
458470
path: "**/node_modules"
459-
key: fixtures_flight-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
471+
key: fixtures_flight-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
460472
- name: Ensure clean build directory
461473
run: rm -rf build
462474
- run: yarn install --frozen-lockfile
@@ -518,7 +530,7 @@ jobs:
518530
id: node_modules
519531
with:
520532
path: "**/node_modules"
521-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
533+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
522534
- name: Ensure clean build directory
523535
run: rm -rf build
524536
- run: yarn install --frozen-lockfile
@@ -569,7 +581,7 @@ jobs:
569581
id: node_modules
570582
with:
571583
path: "**/node_modules"
572-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
584+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
573585
- name: Ensure clean build directory
574586
run: rm -rf build
575587
- run: yarn install --frozen-lockfile
@@ -606,7 +618,7 @@ jobs:
606618
id: node_modules
607619
with:
608620
path: "**/node_modules"
609-
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
621+
key: runtime-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
610622
- name: Ensure clean build directory
611623
run: rm -rf build
612624
- run: yarn install --frozen-lockfile

.github/workflows/runtime_eslint_plugin_e2e.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,20 @@ jobs:
3535
with:
3636
node-version-file: '.nvmrc'
3737
cache: yarn
38-
cache-dependency-path: yarn.lock
38+
cache-dependency-path: |
39+
yarn.lock
40+
compiler/yarn.lock
3941
- name: Restore cached node_modules
4042
uses: actions/cache@v4
4143
id: node_modules
4244
with:
4345
path: "node_modules"
44-
key: runtime-eslint_e2e-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
46+
key: runtime-and-compiler-eslint_e2e-node_modules-v3-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
4547
- name: Ensure clean build directory
4648
run: rm -rf build
4749
- run: yarn install --frozen-lockfile
50+
- run: yarn install --frozen-lockfile
51+
working-directory: compiler
4852
- name: Build plugin
4953
working-directory: fixtures/eslint-v${{ matrix.eslint_major }}
5054
run: node build.mjs

package.json

+1-1
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

-1
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)