55 branches : [main]
66 pull_request :
77
8+ concurrency :
9+ group : ${{ github.workflow }}-${{ github.ref }}
10+ cancel-in-progress : true
11+
812jobs :
913 test :
1014 runs-on : ubuntu-latest
11- timeout-minutes : 15
15+ timeout-minutes : 20
1216
1317 steps :
14- # 1 ▸ code
18+ # 1 ▸ Checkout code
1519 - uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0 # required for git-diff later
1622
17- # 2 ▸ pnpm
23+ # 2 ▸ Set up pnpm
1824 - uses : pnpm/action-setup@v3
1925 with :
2026 version : 10.12.1
@@ -26,45 +32,73 @@ jobs:
2632 node-version : 20
2733 cache : pnpm
2834
29- # 4 ▸ deps
35+ # 4 ▸ Install deps (deterministic)
3036 - name : Install dependencies
3137 run : pnpm install --frozen-lockfile
3238
33- # 5 ▸ ** cache Playwright browsers**
39+ # 5 ▸ Playwright browser cache ────────────────
3440 - name : Cache Playwright browsers
41+ id : pw-cache
3542 uses : actions/cache@v4
3643 with :
37- path : ~/.cache/ms-playwright # default download dir
44+ path : ~/.cache/ms-playwright
3845 key : ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
39- restore-keys : ${{ runner.os }}-playwright-
46+ restore-keys : |
47+ ${{ runner.os }}-playwright-
4048
41- # 6 ▸ download browsers if cache miss
42- - name : Install Playwright browsers
49+ - name : Install Playwright browsers ( if cache miss)
50+ if : steps.pw-cache.outputs.cache-hit != 'true'
4351 run : pnpm --filter @austinserb/react-zero-ui exec playwright install --with-deps
4452
45- # 7 ▸ lint
46- - run : pnpm lint
47- name : Lint
48-
49- # 8 ▸ pack, inject tarball, run tests
50- - run : pnpm run prepack:core
51- name : Pack core tarball
52- - run : node scripts/install-local-tarball.js
53- name : Inject tarball into fixtures
54- - run : pnpm test:vite
55- name : Run Vite tests
56- - run : pnpm test:next
57- name : Run Next.js tests
58-
59- - run : pnpm test:unit
60- name : Run unit tests
61- - run : pnpm test:cli
62- name : Run CLI tests
63-
64- # 9 ▸ traces on failure
65- - name : Upload Playwright traces on failure
53+ - name : Save Playwright cache
54+ if : steps.pw-cache.outputs.cache-hit != 'true'
55+ uses : actions/cache/save@v4
56+ with :
57+ path : ~/.cache/ms-playwright
58+ key : ${{ steps.pw-cache.outputs.cache-primary-key }}
59+
60+ # 6 ▸ Lint fast, fail fast
61+ - name : Lint
62+ run : pnpm lint
63+
64+ # 7 ▸ Pack → inject tar-ball → run whole test suite
65+ - name : Pack core tarball
66+ run : pnpm run prepack:core
67+
68+ - name : Inject tarball into fixtures
69+ run : node scripts/install-local-tarball.js
70+
71+ - name : Run Vite tests
72+ run : pnpm test:vite
73+ - name : Run Next.js tests
74+ run : pnpm test:next
75+
76+ - name : Run unit tests
77+ run : pnpm test:unit
78+
79+ - name : Run CLI tests
80+ run : pnpm test:cli
81+
82+ # 8 ▸ Ensure repo is clean (tar-ball didn't dirty fixtures)
83+ - name : Verify clean git tree
84+ run : |
85+ if [[ -n $(git status --porcelain) ]]; then
86+ echo "::error::Git tree dirty after tests"
87+ git status --porcelain
88+ exit 1
89+ fi
90+
91+ # 9 ▸ Upload Playwright traces & junit on failure
92+ - name : Upload Playwright traces
6693 if : failure()
6794 uses : actions/upload-artifact@v4
6895 with :
6996 name : playwright-traces
7097 path : packages/core/__tests__/test-results/
98+
99+ - name : Upload unit snapshots
100+ if : failure()
101+ uses : actions/upload-artifact@v4
102+ with :
103+ name : unit-snapshots
104+ path : packages/core/__tests__/snapshots/
0 commit comments