ci / 质量门禁 (push) Canceled after 0s
- 建立 pnpm workspace + Turborepo 单仓、ESLint 9/Prettier/commitlint/husky 门禁 - NestJS + Fastify API:统一错误体、trace_id、Zod 管道、/health 真实依赖探活、OpenAPI 3.1 契约 - Prisma 基线:outbox_events/idempotency_keys/system_configs 与首版迁移、幂等种子 - shared 契约包:错误码、权限点、ULID、游标分页、命名/时间工具 - ui 包与 Web 壳层:Semi + Remix 图标统一出口、Cloud Blue 视觉、登录/工作台/错误页 - worker 骨架、Playwright 冒烟、Gitea CI、OpenAPI 快照与 oasdiff 回退脚本 - 补充 A0 实施报告与本地开发说明
117 lines
2.7 KiB
YAML
117 lines
2.7 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main, 'feat/**']
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify:
|
|
name: 质量门禁
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18-alpine
|
|
env:
|
|
POSTGRES_USER: lingxi
|
|
POSTGRES_PASSWORD: lingxi_dev_password
|
|
POSTGRES_DB: lingxi_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U lingxi -d lingxi_test"
|
|
--health-interval 5s
|
|
--health-timeout 3s
|
|
--health-retries 10
|
|
redis:
|
|
image: redis:7.4-alpine
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 5s
|
|
--health-timeout 3s
|
|
--health-retries 10
|
|
|
|
env:
|
|
NODE_ENV: test
|
|
LOG_LEVEL: error
|
|
DATABASE_URL: postgresql://lingxi:lingxi_dev_password@127.0.0.1:5432/lingxi_test?schema=public
|
|
REDIS_URL: redis://127.0.0.1:6379
|
|
JWT_SECRET: ci-only-access-secret
|
|
JWT_REFRESH_SECRET: ci-only-refresh-secret
|
|
WEB_ORIGIN: http://127.0.0.1:4173
|
|
VITE_PUBLIC_API_BASE_URL: http://127.0.0.1:3000/api/v1
|
|
VITE_PUBLIC_DEMO_SESSION: 'true'
|
|
PLAYWRIGHT_CHANNEL: ''
|
|
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 安装 pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.34.9
|
|
|
|
- name: 安装 Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.15.0
|
|
cache: pnpm
|
|
|
|
- name: 安装依赖
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: 格式检查
|
|
run: pnpm format:check
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: 类型检查
|
|
run: pnpm typecheck
|
|
|
|
- name: 单元测试与覆盖率
|
|
run: pnpm test
|
|
|
|
- name: 构建
|
|
run: pnpm build
|
|
|
|
- name: 数据库迁移
|
|
run: pnpm exec prisma migrate deploy
|
|
|
|
- name: 集成测试
|
|
run: pnpm test:int
|
|
|
|
- name: 导出 OpenAPI 快照并检查破坏性变更
|
|
run: |
|
|
pnpm openapi:export
|
|
pnpm openapi:diff
|
|
|
|
- name: 安装 Playwright 浏览器
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
|
|
- name: 端到端冒烟
|
|
run: pnpm test:e2e
|
|
|
|
- name: 归档测试产物
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-artifacts
|
|
if-no-files-found: ignore
|
|
path: |
|
|
coverage
|
|
apps/*/coverage
|
|
packages/*/coverage
|
|
test-results
|
|
playwright-report
|
|
openapi/lingxi.openapi.json
|