Skip to content

Commit 9f58e4b

Browse files
committed
ci: add unit tests workflow
Add GitHub Actions workflow to run Vitest unit tests: - Runs on push to main/develop and on PRs - Executes all 292 unit tests - Generates coverage report on PRs - Uploads coverage artifacts for review This provides fast feedback (~20s) compared to E2E tests.
1 parent ebd0a1d commit 9f58e4b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/unit-tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
name: Run Unit Tests
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: pnpm/action-setup@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 18
23+
cache: "pnpm"
24+
25+
- name: Install dependencies
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Run unit tests
29+
run: pnpm test
30+
31+
- name: Run unit tests with coverage
32+
run: pnpm run test:coverage
33+
if: github.event_name == 'pull_request'
34+
35+
- name: Upload coverage reports
36+
uses: actions/upload-artifact@v4
37+
if: github.event_name == 'pull_request'
38+
with:
39+
name: coverage-report
40+
path: coverage/
41+
retention-days: 7

0 commit comments

Comments
 (0)