Skip to content

Commit 4df7d59

Browse files
authored
ci: update test workflows to use setup/node action cache and corepack (#213)
- removed actions/cache in favor of setup/node own caching - used corepack to select yarn version
1 parent 8e60722 commit 4df7d59

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
with:
1313
node-version: 22
1414
cache: yarn
15+
cache-dependency-path: "**/yarn.lock"
1516
- run: yarn install
1617
- run: yarn prettier --check .
1718

@@ -23,34 +24,22 @@ jobs:
2324
node-version: [18, 20, 21]
2425

2526
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v4
28-
29-
- name: Determine Yarn Cache Path
30-
id: yarn-cache-dir-path
31-
run: echo "::set-output name=dir::$(yarn cache dir)"
27+
- uses: actions/checkout@v4
3228

33-
- uses: actions/cache@v4
34-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
35-
with:
36-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
37-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
38-
restore-keys: |
39-
${{ runner.os }}-yarn-
29+
- run: corepack enable
4030

4131
- name: Use Node.js ${{ matrix.node-version }}
4232
uses: actions/setup-node@v4
4333
with:
4434
node-version: ${{ matrix.node-version }}
35+
cache: yarn
36+
cache-dependency-path: "**/yarn.lock"
4537

46-
- name: Install Packages
47-
run: yarn install --frozen-lockfile
38+
- run: yarn install --frozen-lockfile
4839

49-
- name: Build
50-
run: yarn build
40+
- run: yarn build
5141

5242
- name: Test
5343
run: yarn test --runInBand=false --maxWorkers=2 --workerIdleMemoryLimit=2GB # https://github.com/facebook/jest/issues/11956
5444
env:
55-
CI: true
5645
NODE_OPTIONS: --max_old_space_size=4096

0 commit comments

Comments
 (0)