mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-30 17:50:07 +08:00
c376f2eb1b
Add json/json-summary reporters to vitest config, upload coverage to Codecov after test step in CI, and add coverage badge to README. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83 lines
2.2 KiB
YAML
83 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
check:
|
|
name: Typecheck & Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
id: deps
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- if: steps.deps.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
- run: npm run lint
|
|
- run: npm run typecheck
|
|
- run: npm test
|
|
- uses: codecov/codecov-action@v5
|
|
if: always()
|
|
with:
|
|
files: coverage/coverage.json
|
|
fail_ci_if_error: false
|
|
- run: mkdir -p dist
|
|
- run: npm run test:cf
|
|
|
|
e2e-node:
|
|
name: E2E (Node)
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
env:
|
|
BETTER_AUTH_SECRET: ci-test-secret-that-is-at-least-32-chars
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: npm run e2e
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-node
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-cf:
|
|
name: E2E (CF Workers)
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: echo "BETTER_AUTH_SECRET=ci-test-secret-that-is-at-least-32-chars" > .dev.vars
|
|
- run: npx wrangler d1 migrations apply DB --local
|
|
- run: E2E_RUNTIME=cf npm run e2e
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-cf
|
|
path: playwright-report/
|
|
retention-days: 7
|