Skip to content

Commit 9c332e4

Browse files
committed
ci: add a test workflow
resolves #8
1 parent cdb0ffe commit 9c332e4

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/test.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
# https://github.com/actions/setup-node/issues/1222
10+
# once resolved, replace with `- run: corepack enable`
11+
- name: Force Install Corepack and Enable
12+
run: npm install -g corepack && corepack enable
13+
- uses: actions/checkout@v4
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
cache: "pnpm"
19+
- name: Install dependencies
20+
run: pnpm install
21+
- name: Install playwright
22+
run: pnpm exec playwright install
23+
- name: Lint
24+
run: pnpm biome ci .
25+
- name: Test
26+
# preferrably with --coverage but fails due to: https://github.com/mswjs/msw/issues/2106
27+
run: pnpm vitest
28+
env:
29+
CI: true
30+
- name: Build
31+
run: pnpm build
32+
33+
test_matrix:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
react:
39+
- 18
40+
- 19
41+
- latest
42+
steps:
43+
# https://github.com/actions/setup-node/issues/1222
44+
# once resolved, replace with `- run: corepack enable`
45+
- name: Force Install Corepack and Enable
46+
run: npm install -g corepack && corepack enable
47+
- uses: actions/checkout@v4
48+
- name: Setup Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: 20
52+
cache: "pnpm"
53+
- name: Install dependencies
54+
run: pnpm install
55+
- name: Install React types
56+
run: pnpm add -D @types/react@${{ matrix.react }} @types/react-dom@${{ matrix.react }}
57+
- name: Install ${{ matrix.react }}
58+
run: pnpm add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
59+
- name: Validate types
60+
run: pnpm tsc
61+
- name: Run test
62+
run: |
63+
pnpm exec playwright install
64+
pnpm test

0 commit comments

Comments
 (0)