ci: P3-6 前端单测接入CI + 覆盖率门禁 #542

Merged
auto-approve-bot merged 1 commits from ci/frontend-unit-test-ci into develop 2026-07-18 21:37:35 +08:00
Owner

目标

把前端 vitest 单测接入 CI 流水线,加覆盖率统计和低门槛门禁。Fixes #540

改动

  1. 新增 Frontend Unit Tests job(ci-cd.yml)

    • 独立 runner: ci-check,timeout 15分钟
    • 纯后端改动自动跳过(check-frontend-only skip_frontend)
    • 复用 xiaoxia-npm-cache 缓存卷
    • 失败通知走飞书 webhook
  2. 覆盖率门禁(vitest.config.ts)

    • provider: v8
    • 初始阈值:lines 10% / functions 5% / branches 5%
    • 报告:text + json + html
  3. 新增依赖:@vitest/coverage-v8@1.6.1

  4. check-frontend-only 增强:新增 skip_frontend 输出,纯后端改动跳过前端相关 job

说明

  • 纯 CI 配置 + 测试配置改动,不动业务代码
  • PR 模式增量检查后续再补,先把基础跑通
### 目标 把前端 vitest 单测接入 CI 流水线,加覆盖率统计和低门槛门禁。Fixes #540 ### 改动 1. **新增 Frontend Unit Tests job**(ci-cd.yml) - 独立 runner: ci-check,timeout 15分钟 - 纯后端改动自动跳过(check-frontend-only skip_frontend) - 复用 xiaoxia-npm-cache 缓存卷 - 失败通知走飞书 webhook 2. **覆盖率门禁**(vitest.config.ts) - provider: v8 - 初始阈值:lines 10% / functions 5% / branches 5% - 报告:text + json + html 3. **新增依赖**:@vitest/coverage-v8@1.6.1 4. **check-frontend-only 增强**:新增 skip_frontend 输出,纯后端改动跳过前端相关 job ### 说明 - 纯 CI 配置 + 测试配置改动,不动业务代码 - PR 模式增量检查后续再补,先把基础跑通
xiaoxia added 1 commit 2026-07-18 21:31:34 +08:00
ci: P3-6 前端单测接入CI + 覆盖率门禁
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 41s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 1m35s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m57s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 2m11s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 2m48s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m7s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 4m3s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m21s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 6m1s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 16s
AI Code Review / AI Code Review (pull_request) Successful in 8m4s
1f688d45b7
- 新增 Frontend Unit Tests job,跑 vitest --coverage
- 安装 @vitest/coverage-v8 (v1.6.1)
- vitest 配置覆盖率阈值:lines 10% / functions 5% / branches 5%
- 覆盖率报告:terminal + json + html
- check-frontend-only 新增 skip_frontend 输出,纯后端改动跳过前端单测
- 失败通知复用 CI_NOTIFY_WEBHOOK 飞书 webhook
- 复用 xiaoxia-npm-cache 缓存卷

Fixes #540
auto-approve-bot approved these changes 2026-07-18 21:35:37 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-07-18 21:35:37 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit 8df8255521 into develop 2026-07-18 21:37:35 +08:00
auto-approve-bot deleted branch ci/frontend-unit-test-ci 2026-07-18 21:37:35 +08:00

🗑️ 预览环境已清理

PR #542 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #542 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.