Files
gaokao-volunteer-system/.github/workflows/web-ci.yml
Hermes Agent ff72ce04eb
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
web-ci / ci (push) Has been cancelled
web-ci / e2e (push) Has been cancelled
web-ci / chromatic (push) Has been cancelled
web-ci / lighthouse (push) Has been cancelled
fix(ci): T4-04 harden LHCI/Chromatic/smoke gate semantics
2026-07-06 08:04:14 +08:00

169 lines
4.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: web-ci
on:
push:
branches: [main, develop]
paths:
- 'apps/web/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'turbo.json'
pull_request:
paths:
- 'apps/web/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'turbo.json'
jobs:
ci:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: TypeScript typecheck (G1 gate - 0 any)
run: pnpm typecheck
- name: ESLint (G1 gate - 0 warning)
run: pnpm lint
- name: Vitest (单元测试)
run: pnpm test
- name: Build
run: pnpm build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: web-dist
path: apps/web/dist
retention-days: 7
e2e:
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm --filter @gaokao/web exec playwright install --with-deps
- name: Build for preview
run: pnpm --filter @gaokao/web build
- name: Run Playwright e2e tests
run: pnpm --filter @gaokao/web test:e2e
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: apps/web/playwright-report
retention-days: 7
chromatic:
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 15
if: (github.event_name == 'push' || github.event_name == 'pull_request') && secrets.CHROMATIC_TOKEN != ''
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm --filter @gaokao/web build
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
workingDir: apps/web
buildScriptName: build
exitZeroOnChanges: true
lighthouse:
# G3 闸门真实化P/A/B/S 均 ≥ 90
runs-on: ubuntu-latest
needs: ci
timeout-minutes: 15
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm --filter @gaokao/web build
- name: Run Lighthouse CI (G3 闸门P/A/B/S ≥ 90)
uses: treosh/lighthouse-ci-action@v12
with:
configPath: ./apps/web/lighthouserc.cjs
uploadArtifacts: true
temporaryPublicStorage: true
runs: 3
serverUrl: http://127.0.0.1:8080/
# treosh action 自动启动 vite preview @ 8080
url: |
http://127.0.0.1:8080/
http://127.0.0.1:8080/data-query
http://127.0.0.1:8080/plans
http://127.0.0.1:8080/about