4ae6394c95
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 1s
CI/CD Pipeline / Check push changed paths (push) Failing after 2s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Security (pull_request) Has been skipped
CI/CD Pipeline / Validate - Style (pull_request) Has been skipped
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Style (push) Successful in 3m52s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 4m19s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 4m41s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 5m18s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 5m12s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Has been skipped
CI/CD Pipeline / Validate - Security (push) Failing after 5m19s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m32s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m37s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m19s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 8m42s
CI/CD Pipeline / Integration Tests (push) Successful in 6m59s
AI Code Review / AI Code Review (pull_request) Successful in 9m14s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 3s
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (push) Successful in 20m36s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
Change 5: Merge validate-type-check + validate-migration into validate-python - Single checkout + single pip install → mypy + alembic - Saves ~2min checkout + ~1min pip install + 1 runner slot - Preserves DATABASE_URL env for alembic migration validation Change 6: Split validate-code-quality into validate-style + validate-security - validate-style: compileall + black/isort/ruff + vulture (advisory) + auto-fix (~3min) - validate-security: detect-secrets + bandit (advisory) + pip-audit (advisory) + CI scripts syntax (~5min) - Both jobs run in parallel, reducing wall-clock time from ~10min to ~5min Updated references: - ci-gate needs: validate-code-quality → validate-style + validate-security - ci-gate needs: validate-type-check + validate-migration → validate-python - build-production needs: validate-code-quality → validate-style + validate-security - Removed obsolete scripts/ci/validate_code_quality.sh
43 lines
1.5 KiB
Bash
Executable File
43 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
||
# CI Validate: 代码风格检查(validate-style)
|
||
# 包含:Python 字节码编译、black 格式、isort 排序、ruff lint、vulture 死代码(仅告警)
|
||
set -eu
|
||
|
||
echo "=== CI Validate: 代码风格检查 ==="
|
||
|
||
# --- Python 字节码编译 ---
|
||
echo ""
|
||
echo "=== [1/3] Python bytecode compilation ==="
|
||
python3 -m compileall -q alembic apps packages tests scripts
|
||
echo "✅ Bytecode compilation passed"
|
||
|
||
# --- 代码格式检查(全量)---
|
||
echo ""
|
||
echo "=== [2/3] Code formatting (black + isort + ruff) ==="
|
||
echo "Full scan mode"
|
||
python3 -m black --check --fast alembic apps packages tests scripts
|
||
python3 -m isort --check-only alembic apps packages tests scripts
|
||
python3 -m ruff check apps packages tests --statistics
|
||
echo "✅ Code formatting checks passed"
|
||
|
||
# --- Vulture 死代码检测(仅告警)---
|
||
echo ""
|
||
echo "=== [3/3] Dead code detection (vulture, advisory only) ==="
|
||
set +e
|
||
python3 -m pip install -q vulture
|
||
vulture --version
|
||
echo "告警模式,不阻断CI。置信度>=90%建议尽快确认。"
|
||
echo ""
|
||
vulture apps packages scripts \
|
||
--exclude "tests,test,migrations,.gitea,docs,node_modules,site-packages,*/test_*.py,*/conftest.py" \
|
||
--min-confidence 70 \
|
||
2>&1 | sort -t'(' -k2 -rn | head -80
|
||
echo ""
|
||
echo "=== vulture scan summary ==="
|
||
echo "发现潜在死代码(可能包含框架装饰器注册的函数,为误报)"
|
||
echo "建议:定期人工审查高置信度(>=90%)条目"
|
||
set -e
|
||
|
||
echo ""
|
||
echo "=== CI Validate: 代码风格检查 全部通过 ✅ ==="
|