Skip to content

Commit 9888c68

Browse files
committed
Optimize GitHub workflow with node version file and caching
1 parent c291a1a commit 9888c68

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,27 @@ jobs:
2222
private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
2323

2424
- uses: actions/setup-node@v4
25+
id: setup-node
2526
with:
26-
node-version: '20'
27-
cache: 'pnpm'
28-
cache-dependency-path: 'pnpm-lock.yaml'
27+
node-version-file: 'package.json'
28+
29+
- uses: actions/cache@v4
30+
id: cache
31+
with:
32+
path: ${{ github.workspace }}/node_modules
33+
key: node-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
2935
- uses: pnpm/action-setup@v4
3036
with:
3137
version: 8
3238
- run: pnpm install --frozen-lockfile
3339
if: steps.cache.outputs.cache-hit != 'true'
3440

35-
# Linting
41+
# Additional checks
3642
- run: pnpm lint:ts
3743
- run: pnpm lint:docs
3844

39-
# Auto-fix formatting to reduce noise in diffs
45+
# Run automatic fixes (run prettier apart from eslint to also fix mdx files)
4046
- run: pnpm lint:prettier:fix
4147
- run: pnpm lint:eslint:fix
4248

@@ -60,14 +66,19 @@ jobs:
6066
runs-on: ubuntu-latest
6167
steps:
6268
- uses: actions/checkout@v4
63-
- uses: actions/setup-node@v4
69+
- name: Set up Node
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version-file: 'package.json'
73+
- uses: actions/cache@v4
74+
id: cache
6475
with:
65-
node-version: '20'
66-
cache: 'pnpm'
67-
cache-dependency-path: 'pnpm-lock.yaml'
76+
path: ${{ github.workspace }}/node_modules
77+
key: node-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
6878
- uses: pnpm/action-setup@v4
6979
with:
7080
version: 8
7181
- run: pnpm install --frozen-lockfile
82+
if: steps.cache.outputs.cache-hit != 'true'
7283
- name: Run Tests
7384
run: pnpm test

0 commit comments

Comments
 (0)