chore: 激活验证闭环 — pre-commit hook + CI gate + npm test scripts
三层质量保障闭环: package.json: - 新增 typecheck / test:unit / test:smoke / test:e2e / test / prepare 脚本 - 新增 lint-staged 配置(仅对暂存 .ts/.tsx 文件运行 eslint --fix) - 新增 devDependencies: husky, lint-staged, tsx .husky/pre-commit: - 依次执行 lint-staged → tsc --noEmit → 单元测试 - 任一步骤失败即阻止提交 src/__tests__/e2e/smoke.spec.ts: - 5 个 Playwright @smoke 测试覆盖核心路由 (/, /chat, /plugins, /plugins/mcp, /settings) - 检查 HTTP 状态、Next.js 错误覆盖层、标题、console 错误 - 复用已有 helpers (goToChat, goToPlugins, goToMCP, goToSettings, collectConsoleErrors, filterCriticalErrors) .github/workflows/build.yml: - 新增 lint-test job (ubuntu-latest): lint → typecheck → unit tests - 新增 pull_request 触发器 - 三个 build job 添加 needs: [lint-test],lint-test 失败则不构建 - lint 步骤暂设 continue-on-error(存量 4 个 lint error 待修复) CLAUDE.md: - 新增"自检命令"区块,说明 test / test:smoke / test:e2e 用途 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
243724a765
commit
99c4931b12
7 files changed
+694
-4
No files matched your search
@@ -13,6 +13,8 @@ on:
|
||||
- windows
|
||||
- macos
|
||||
- linux
|
||||
pull_request:
|
||||
branches: [main]
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
@@ -21,7 +23,32 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
# TODO: fix 4 existing lint errors then remove continue-on-error
|
||||
continue-on-error: true
|
||||
run: npm run lint
|
||||
|
||||
- name: Typecheck
|
||||
run: npm run typecheck
|
||||
|
||||
- name: Unit tests
|
||||
run: npm run test:unit
|
||||
|
||||
build-windows:
|
||||
needs: [lint-test]
|
||||
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'windows' }}
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
@@ -50,6 +77,7 @@ jobs:
|
||||
retention-days: 3
|
||||
|
||||
build-macos:
|
||||
needs: [lint-test]
|
||||
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'macos' }}
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
@@ -132,6 +160,7 @@ jobs:
|
||||
retention-days: 3
|
||||
|
||||
build-linux:
|
||||
needs: [lint-test]
|
||||
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'linux' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
||||
Reference in new issue
Block a user