feat(ci): PP-10 软门禁 baseline — cargo-tarpaulin 覆盖率 job
在 Gitea ci.yml 加 coverage job: - cargo-tarpaulin --workspace 生成 cobertura XML 报告 - fail-under 20% baseline + continue-on-error=true(不阻塞其他 job) - 上传 coverage-report artifact 当前为 baseline 阶段(覆盖率可见,不阻塞)。后续根据真实覆盖率提高 fail-under(目标 service 层 ≥60%)并去掉 continue-on-error 硬化门禁。 PP-10 是「测试金字塔失衡 + 覆盖率工具缺失」根因修复(历史 24% fix 提交率)。
This commit is contained in:
@@ -46,6 +46,47 @@ jobs:
|
|||||||
ERP__JWT__SECRET: ci-test-secret
|
ERP__JWT__SECRET: ci-test-secret
|
||||||
ERP__AUTH__SUPER_ADMIN_PASSWORD: CI_Test_Pass_2026
|
ERP__AUTH__SUPER_ADMIN_PASSWORD: CI_Test_Pass_2026
|
||||||
|
|
||||||
|
# PP-10: 覆盖率 baseline(软门禁阶段)
|
||||||
|
# 当前 continue-on-error=true,先让覆盖率可见、生成报告 artifact。
|
||||||
|
# 后续根据 baseline 真实数据提高 fail-under 阈值(目标 service 层 ≥60%)并去掉
|
||||||
|
# continue-on-error 硬化门禁。见 docs/discussions/2026-06-25-analysis/ PP-10。
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: erp_test
|
||||||
|
POSTGRES_USER: test
|
||||||
|
POSTGRES_PASSWORD: test
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: ". -> target"
|
||||||
|
- name: Install cargo-tarpaulin
|
||||||
|
run: cargo install cargo-tarpaulin --locked
|
||||||
|
- name: Run coverage (fail-under 20% baseline)
|
||||||
|
run: cargo tarpaulin --workspace --out Xml --output-dir coverage --fail-under 20 -- --test-threads=2
|
||||||
|
env:
|
||||||
|
ERP__DATABASE__URL: postgres://test:test@localhost:5432/erp_test
|
||||||
|
ERP__JWT__SECRET: ci-test-secret
|
||||||
|
ERP__AUTH__SUPER_ADMIN_PASSWORD: CI_Test_Pass_2026
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage-report
|
||||||
|
path: coverage/
|
||||||
|
if-no-files-found: warn
|
||||||
|
|
||||||
frontend-build:
|
frontend-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user