Skip to content

Commit 0e38cdd

Browse files
committed
ci: add GitHub Actions workflow for tests and benchmarks
- test job: pnpm install, type check (tsc), unit tests (vitest) - bench job: generate data, start wrangler dev, seed R2, run benchmarks - Runs on push to main and PRs
1 parent 1cb5f1d commit 0e38cdd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: pnpm/action-setup@v4
16+
with:
17+
version: 9
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: pnpm
23+
24+
- run: pnpm install --frozen-lockfile
25+
26+
- name: Type check
27+
run: pnpm build
28+
29+
- name: Unit tests
30+
run: pnpm test
31+
32+
bench:
33+
runs-on: ubuntu-latest
34+
needs: test
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: pnpm/action-setup@v4
39+
with:
40+
version: 9
41+
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: 22
45+
cache: pnpm
46+
47+
- run: pnpm install --frozen-lockfile
48+
49+
- name: Generate benchmark data
50+
run: npx tsx scripts/generate-bench-data.ts
51+
52+
- name: Start wrangler dev
53+
run: |
54+
pnpm dev &
55+
# Wait for worker to be ready
56+
for i in $(seq 1 30); do
57+
if curl -sf http://localhost:8787/health > /dev/null 2>&1; then
58+
echo "Worker ready"
59+
break
60+
fi
61+
sleep 1
62+
done
63+
64+
- name: Seed local R2
65+
run: npx tsx scripts/seed-local-r2.ts
66+
67+
- name: Run benchmarks
68+
run: npx tsx scripts/bench.ts

0 commit comments

Comments
 (0)