Skip to content

Commit 440ba88

Browse files
committed
[ci] Skip yarn install on cache hit
We currently already do this in runtime_build_and_test, we can reuse the same technique in other workflows to speed them up.
1 parent 313332d commit 440ba88

8 files changed

+51
-13
lines changed

.github/workflows/compiler_playground.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ jobs:
4040
with:
4141
path: |
4242
**/node_modules
43-
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
43+
key: compiler-and-playground-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
4444
- run: yarn install --frozen-lockfile
45+
if: steps.node_modules.outputs.cache-hit != 'true'
46+
working-directory: compiler
47+
- run: yarn install --frozen-lockfile
48+
if: steps.node_modules.outputs.cache-hit != 'true'
4549
- name: Check Playwright version
4650
id: playwright_version
4751
run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT"

.github/workflows/compiler_prereleases.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ jobs:
4949
with:
5050
path: |
5151
**/node_modules
52-
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
52+
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }}
5353
- run: yarn install --frozen-lockfile
54+
if: steps.node_modules.outputs.cache-hit != 'true'
5455
- name: Publish packages to npm
5556
run: |
5657
cp ./scripts/release/ci-npmrc ~/.npmrc

.github/workflows/compiler_typescript.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ jobs:
4747
cache-dependency-path: compiler/yarn.lock
4848
- name: Restore cached node_modules
4949
uses: actions/cache@v4
50+
id: node_modules
5051
with:
5152
path: |
5253
**/node_modules
53-
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
54+
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }}
5455
- run: yarn install --frozen-lockfile
56+
if: steps.node_modules.outputs.cache-hit != 'true'
5557
- run: yarn workspace babel-plugin-react-compiler lint
5658

5759
# Hardcoded to improve parallelism
@@ -71,8 +73,9 @@ jobs:
7173
with:
7274
path: |
7375
**/node_modules
74-
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
76+
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }}
7577
- run: yarn install --frozen-lockfile
78+
if: steps.node_modules.outputs.cache-hit != 'true'
7679
- run: yarn workspace babel-plugin-react-compiler jest
7780

7881
test:
@@ -96,8 +99,9 @@ jobs:
9699
with:
97100
path: |
98101
**/node_modules
99-
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }}
102+
key: compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/yarn.lock') }}
100103
- run: yarn install --frozen-lockfile
104+
if: steps.node_modules.outputs.cache-hit != 'true'
101105
- run: xvfb-run -a yarn workspace ${{ matrix.workspace_name }} test
102106
if: runner.os == 'Linux' && matrix.workspace_name == 'react-forgive'
103107
- run: yarn workspace ${{ matrix.workspace_name }} test

.github/workflows/devtools_regression_tests.yml

+18-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
- name: Ensure clean build directory
4141
run: rm -rf build
4242
- run: yarn install --frozen-lockfile
43+
if: steps.node_modules.outputs.cache-hit != 'true'
4344
- run: yarn --cwd scripts/release install --frozen-lockfile
45+
if: steps.node_modules.outputs.cache-hit != 'true'
4446
- name: Download react-devtools artifacts for base revision
4547
run: |
4648
git fetch origin main
@@ -75,6 +77,7 @@ jobs:
7577
- name: Ensure clean build directory
7678
run: rm -rf build
7779
- run: yarn install --frozen-lockfile
80+
if: steps.node_modules.outputs.cache-hit != 'true'
7881
- name: Restore archived build
7982
uses: actions/download-artifact@v4
8083
with:
@@ -134,6 +137,7 @@ jobs:
134137
**/node_modules
135138
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
136139
- run: yarn install --frozen-lockfile
140+
if: steps.node_modules.outputs.cache-hit != 'true'
137141
- name: Restore all archived build artifacts
138142
uses: actions/download-artifact@v4
139143
- name: Display structure of build
@@ -169,14 +173,24 @@ jobs:
169173
**/node_modules
170174
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
171175
- run: yarn install --frozen-lockfile
176+
if: steps.node_modules.outputs.cache-hit != 'true'
172177
- name: Restore all archived build artifacts
173178
uses: actions/download-artifact@v4
174179
- name: Display structure of build
175180
run: ls -R build
176-
- name: Playwright install deps
177-
run: |
178-
npx playwright install
179-
sudo npx playwright install-deps
181+
- name: Check Playwright version
182+
id: playwright_version
183+
run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT"
184+
- name: Cache Playwright Browsers for version ${{ steps.playwright_version.outputs.playwright_version }}
185+
id: cache_playwright_browsers
186+
uses: actions/cache@v4
187+
with:
188+
path: ~/.cache/ms-playwright
189+
key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ steps.playwright_version.outputs.playwright_version }}
190+
- run: npx playwright install --with-deps
191+
if: steps.cache_playwright_browsers.outputs.cache-hit != 'true'
192+
- run: npx playwright install-deps
193+
if: steps.cache_playwright_browsers.outputs.cache-hit == 'true'
180194
- run: ./scripts/ci/download_devtools_regression_build.js ${{ matrix.version }}
181195
- run: ls -R build-regression
182196
- run: ./scripts/ci/run_devtools_e2e_tests.js ${{ matrix.version }}

.github/workflows/runtime_eslint_plugin_e2e.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ jobs:
4646
with:
4747
path: |
4848
**/node_modules
49-
key: runtime-and-compiler-eslint_e2e-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
49+
key: runtime-and-compiler-eslint_e2e-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock', 'fixtures/eslint-v*/yarn.lock') }}
5050
- name: Ensure clean build directory
5151
run: rm -rf build
5252
- run: yarn install --frozen-lockfile
53+
if: steps.node_modules.outputs.cache-hit != 'true'
5354
- run: yarn --cwd compiler install --frozen-lockfile
54-
- name: Build plugin
55-
working-directory: fixtures/eslint-v${{ matrix.eslint_major }}
56-
run: node build.mjs
55+
if: steps.node_modules.outputs.cache-hit != 'true'
5756
- name: Install fixture dependencies
5857
working-directory: ./fixtures/eslint-v${{ matrix.eslint_major }}
5958
run: yarn --frozen-lockfile
59+
if: steps.node_modules.outputs.cache-hit != 'true'
60+
- name: Build plugin
61+
working-directory: fixtures/eslint-v${{ matrix.eslint_major }}
62+
run: node build.mjs
6063
- name: Run lint test
6164
working-directory: ./fixtures/eslint-v${{ matrix.eslint_major }}
6265
run: yarn lint

.github/workflows/runtime_prereleases.yml

+2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ jobs:
5151
- name: Ensure clean build directory
5252
run: rm -rf build
5353
- run: yarn install --frozen-lockfile
54+
if: steps.node_modules.outputs.cache-hit != 'true'
5455
- run: yarn --cwd scripts/release install --frozen-lockfile
56+
if: steps.node_modules.outputs.cache-hit != 'true'
5557
- run: |
5658
GH_TOKEN=${{ secrets.GH_TOKEN }} scripts/release/prepare-release-from-ci.js --skipTests -r ${{ inputs.release_channel }} --commit=${{ inputs.commit_sha }}
5759
cp ./scripts/release/ci-npmrc ~/.npmrc

.github/workflows/runtime_releases_from_npm_manual.yml

+2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ jobs:
7878
- name: Ensure clean build directory
7979
run: rm -rf build
8080
- run: yarn install --frozen-lockfile
81+
if: steps.node_modules.outputs.cache-hit != 'true'
8182
- run: yarn --cwd scripts/release install --frozen-lockfile
83+
if: steps.node_modules.outputs.cache-hit != 'true'
8284
- run: cp ./scripts/release/ci-npmrc ~/.npmrc
8385
- if: '${{ inputs.only_packages }}'
8486
name: 'Prepare ${{ inputs.only_packages }} from NPM'

.github/workflows/shared_lint.yml

+8
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ jobs:
2929
cache-dependency-path: yarn.lock
3030
- name: Restore cached node_modules
3131
uses: actions/cache@v4
32+
id: node_modules
3233
with:
3334
path: |
3435
**/node_modules
3536
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
3637
- name: Ensure clean build directory
3738
run: rm -rf build
3839
- run: yarn install --frozen-lockfile
40+
if: steps.node_modules.outputs.cache-hit != 'true'
3941
- run: yarn prettier-check
4042

4143
eslint:
@@ -50,13 +52,15 @@ jobs:
5052
cache-dependency-path: yarn.lock
5153
- name: Restore cached node_modules
5254
uses: actions/cache@v4
55+
id: node_modules
5356
with:
5457
path: |
5558
**/node_modules
5659
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
5760
- name: Ensure clean build directory
5861
run: rm -rf build
5962
- run: yarn install --frozen-lockfile
63+
if: steps.node_modules.outputs.cache-hit != 'true'
6064
- run: node ./scripts/tasks/eslint
6165

6266
check_license:
@@ -71,13 +75,15 @@ jobs:
7175
cache-dependency-path: yarn.lock
7276
- name: Restore cached node_modules
7377
uses: actions/cache@v4
78+
id: node_modules
7479
with:
7580
path: |
7681
**/node_modules
7782
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
7883
- name: Ensure clean build directory
7984
run: rm -rf build
8085
- run: yarn install --frozen-lockfile
86+
if: steps.node_modules.outputs.cache-hit != 'true'
8187
- run: ./scripts/ci/check_license.sh
8288

8389
test_print_warnings:
@@ -92,11 +98,13 @@ jobs:
9298
cache-dependency-path: yarn.lock
9399
- name: Restore cached node_modules
94100
uses: actions/cache@v4
101+
id: node_modules
95102
with:
96103
path: |
97104
**/node_modules
98105
key: shared-lint-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
99106
- name: Ensure clean build directory
100107
run: rm -rf build
101108
- run: yarn install --frozen-lockfile
109+
if: steps.node_modules.outputs.cache-hit != 'true'
102110
- run: ./scripts/ci/test_print_warnings.sh

0 commit comments

Comments
 (0)