1212 - master
1313
1414jobs :
15- # 1. Lint check
16- lint :
15+ setup :
1716 runs-on : ubuntu-latest
17+ outputs :
18+ cache-key : ${{ steps.deps-cache.outputs.cache-hit }}
1819 steps :
1920 - uses : actions/checkout@v4
21+
2022 - uses : actions/setup-node@v4
2123 with :
2224 node-version : lts/*
25+
26+ - name : Cache node_modules
27+ id : deps-cache
28+ uses : actions/cache@v4
29+ with :
30+ path : |
31+ node_modules
32+ ~/.cache/ms-playwright
33+ key : deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
34+ restore-keys : |
35+ deps-${{ runner.os }}-
36+
2337 - name : Install dependencies
2438 run : npm ci
39+
40+ - name : Install Playwright browsers (cached)
41+ run : npx playwright install --with-deps
42+
43+ - name : Upload node_modules for reuse
44+ if : steps.deps-cache.outputs.cache-hit != 'true'
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : node_modules
48+ path : node_modules
49+
50+ lint :
51+ needs : setup
52+ runs-on : ubuntu-latest
53+ steps :
54+ - uses : actions/checkout@v4
55+ - uses : actions/setup-node@v4
56+ with :
57+ node-version : lts/*
58+ - uses : actions/download-artifact@v4
59+ with :
60+ name : node_modules
61+ path : node_modules
2562 - name : Run lint check
2663 run : ./node_modules/.bin/eslint ./src
2764
28- # 2. TypeScript check
2965 typescript :
3066 needs : lint
3167 runs-on : ubuntu-latest
@@ -34,12 +70,13 @@ jobs:
3470 - uses : actions/setup-node@v4
3571 with :
3672 node-version : lts/*
37- - name : Install dependencies
38- run : npm ci
73+ - uses : actions/download-artifact@v4
74+ with :
75+ name : node_modules
76+ path : node_modules
3977 - name : Run TypeScript check
4078 run : ./node_modules/.bin/tsc
4179
42- # 3. Playwright tests
4380 playwright :
4481 needs : typescript
4582 runs-on : ubuntu-latest
4885 - uses : actions/setup-node@v4
4986 with :
5087 node-version : lts/*
51- - name : Install dependencies
52- run : npm ci
53- - name : Install Playwright Browsers
88+ - uses : actions/download-artifact@v4
89+ with :
90+ name : node_modules
91+ path : node_modules
92+ - name : Install Playwright browsers (cached)
5493 run : npx playwright install --with-deps
5594 - name : Run Playwright tests
5695 run : npx playwright test
0 commit comments