- 新增截图标注工具,支持高亮、圆圈、箭头等标注 - 新增 MDX 用户手册源文件和 HTML 生成脚本 - 新增 GIF 录制功能,支持视频转 GIF 和键盘提示 - 为组件添加 data-testid 属性以支持 E2E 定位 - 更新 smoke/visual 测试,修复 tooltip 拦截问题 - 新增 E2E 测试规范到 CODING_RULES.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
132 lines
3.3 KiB
YAML
132 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
|
|
jobs:
|
|
# PR 时运行:lint、test、build 和冒烟测试
|
|
main:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Cache node_modules
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- run: npm ci
|
|
- uses: nrwl/nx-set-shas@v4
|
|
|
|
# 安装 Playwright 浏览器和依赖
|
|
- name: Install Playwright
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
# lint、test、build
|
|
- run: npx nx affected -t test build --base=origin/develop --verbose
|
|
- run: npx nx affected -t lint --exclude=drawnix --base=origin/develop --verbose
|
|
|
|
# PR 时运行冒烟测试(快速,约2分钟)
|
|
- name: Run Smoke Tests
|
|
run: pnpm run e2e:smoke
|
|
|
|
- name: Upload Smoke Test Results
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: smoke-test-results
|
|
path: apps/web-e2e/test-results/
|
|
|
|
# PR 时运行视觉回归测试
|
|
- name: Run Visual Regression Tests
|
|
run: pnpm run e2e:visual
|
|
|
|
- name: Upload Visual Test Report
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: visual-diff-report
|
|
path: apps/web-e2e/playwright-report/
|
|
|
|
- name: Check Bundle Size
|
|
if: always()
|
|
run: pnpm run size
|
|
|
|
- name: Upload Bundle Stats
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bundle-stats
|
|
path: dist/apps/web/stats.html
|
|
|
|
# 发布前运行:完整 E2E 测试 + 生成用户手册
|
|
release-e2e:
|
|
runs-on: ubuntu-latest
|
|
# 仅在 main 分支 push 或手动触发时运行
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- run: npm ci
|
|
|
|
# 安装所有浏览器用于完整测试
|
|
- name: Install Playwright Browsers
|
|
run: npx playwright install --with-deps
|
|
|
|
# 运行完整功能测试
|
|
- name: Run Full E2E Tests
|
|
run: pnpm run e2e:features
|
|
|
|
# 运行视觉回归测试
|
|
- name: Run Visual Tests
|
|
run: pnpm run e2e:visual
|
|
|
|
# 运行手册生成测试
|
|
- name: Run Manual Generation Tests
|
|
run: pnpm run e2e:manual
|
|
|
|
# 生成用户手册
|
|
- name: Generate User Manual
|
|
run: pnpm run generate:manual
|
|
|
|
# 上传测试报告
|
|
- name: Upload E2E Test Report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: e2e-test-report
|
|
path: apps/web-e2e/playwright-report/
|
|
|
|
# 上传测试结果(包含截图)
|
|
- name: Upload Test Results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: e2e-test-results
|
|
path: apps/web-e2e/test-results/
|
|
|
|
# 上传用户手册
|
|
- name: Upload User Manual
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: user-manual
|
|
path: docs/user-manual/
|
|
|