Files
novalon-website/.woodpecker/quality-gate.yml
T
张翔 b207bfa7af feat: 增加测试覆盖率并优化代码质量
test: 添加单元测试和端到端测试
refactor: 重构登录页面和上传模块
ci: 更新测试覆盖率阈值至42%
build: 添加测试相关依赖
docs: 更新测试文档
style: 修复代码格式问题
2026-03-11 11:14:37 +08:00

72 lines
1.9 KiB
YAML

when:
event: [pull_request]
branch: [main, develop]
steps:
install-dependencies:
image: node:18-alpine
commands:
- npm ci
lint:
image: node:18-alpine
commands:
- echo "=== Running ESLint ==="
- npm run lint
- echo "✅ ESLint check passed"
type-check:
image: node:18-alpine
commands:
- echo "=== Running TypeScript type check ==="
- npm run type-check
- echo "✅ TypeScript type check passed"
unit-tests:
image: node:18-alpine
commands:
- echo "=== Running unit tests with coverage ==="
- npm run test:unit -- --coverage --coverageReporters=json
- |
COVERAGE=$(cat coverage/coverage-summary.json | grep -o '"lines":{"pct":[0-9.]*' | grep -o '[0-9.]*$')
echo "Current coverage: $COVERAGE%"
if [ $(echo "$COVERAGE < 42" | bc -l) -eq 1 ]; then
echo "❌ Coverage $COVERAGE% is below threshold 42%"
exit 1
fi
echo "✅ Coverage $COVERAGE% meets threshold 42%"
e2e-tests:
image: node:18-alpine
commands:
- echo "=== Running E2E tests ==="
- npx playwright install --with-deps
- npm run test:e2e
- echo "✅ E2E tests passed"
security-check:
image: node:18-alpine
commands:
- echo "=== Running security audit ==="
- npm audit --audit-level=moderate
- echo "✅ Security audit passed"
performance-check:
image: node:18-alpine
commands:
- echo "=== Running performance checks ==="
- npm run audit:performance
- echo "✅ Performance audit passed"
quality-summary:
image: node:18-alpine
commands:
- echo "=== Quality Gate Summary ==="
- echo "✅ All quality checks passed"
- echo " - ESLint: PASSED"
- echo " - TypeScript: PASSED"
- echo " - Unit Tests: PASSED (Coverage ≥ 42%)"
- echo " - E2E Tests: PASSED"
- echo " - Security: PASSED"
- echo " - Performance: PASSED"