Skip to content

Commit 5a9acd4

Browse files
committed
refactor(coverage): streamline coverage checking workflow and enhance reporting
- Simplify Makefile targets by removing redundant coverage-check-full, coverage-dir, coverage-server, coverage-json, and coverage-html targets - Update CI workflow to use 'Run coverage' instead of 'Run coverage check' - Modify check_coverage.py to default to 'main' branch instead of 'master' - Add detailed failure reporting with specific threshold violations - Improve incremental coverage calculation and directory coverage processing - Remove commented server module coverage thresholds in coverage.yaml - Add coverage.json to .gitignore The coverage script now provides comprehensive reporting with clear failure indications and processes both full and incremental coverage checks in a unified manner. === 重构覆盖率检查工作流程并增强报告功能 - 简化 Makefile 目标,移除冗余的 coverage-check-full、coverage-dir、 coverage-server、coverage-json 和 coverage-html 目标 - 更新 CI 工作流程,使用 'Run coverage' 替代 'Run coverage check' - 修改 check_coverage.py 默认使用 'main' 分支而不是 'master' - 添加详细的失败报告和具体的阈值违规信息 - 改进增量覆盖率计算和目录覆盖率处理 - 在 coverage.yaml 中移除注释的服务器模块覆盖率阈值 - 将 coverage.json 添加到 .gitignore 覆盖率脚本现在提供全面的报告,包含清晰的失败指示,并以统一的方式处理全量和增量覆盖率检查。 footer(s): === 脚注: === Change-Id: I95bc072129d71ce478875748c83696327a0cce4a Signed-off-by: OhYee <[email protected]>
1 parent 8ebd015 commit 5a9acd4

File tree

6 files changed

+89
-7422
lines changed

6 files changed

+89
-7422
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
run: |
3535
make test-unit
3636
37-
- name: Run coverage check
37+
- name: Run coverage
3838
run: |
39-
make coverage-check
39+
make coverage
4040
4141
# 检测文件更改并决定是否构建测试包
4242
- name: Check for changes in agentrun directory

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,6 @@ dmypy.json
102102
.pytest_cache
103103
.env
104104

105-
uv.lock
105+
uv.lock
106+
coverage.json
107+
coverage.json

Makefile

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -146,43 +146,5 @@ mypy-check: ## 运行 mypy 类型检查
146146
.PHONY: coverage
147147
coverage: ## 运行测试并显示覆盖率报告(全量代码 + 增量代码)
148148
@echo "📊 运行覆盖率测试..."
149-
@uv run python scripts/check_coverage.py --incremental --no-check
150-
151-
.PHONY: coverage-full
152-
coverage-full: ## 运行测试并显示全量覆盖率报告
153-
@echo "📊 运行全量覆盖率测试..."
154-
@uv run python scripts/check_coverage.py --no-check
155-
156-
.PHONY: coverage-check
157-
coverage-check: ## 运行测试并检查覆盖率是否达标(根据 coverage.yaml 配置)
158-
@echo "🔍 运行覆盖率检查..."
159-
@uv run python scripts/check_coverage.py --incremental
160-
161-
.PHONY: coverage-check-full
162-
coverage-check-full: ## 运行测试并检查全量覆盖率是否达标
163-
@echo "🔍 运行全量覆盖率检查..."
164149
@uv run python scripts/check_coverage.py
165150

166-
.PHONY: coverage-dir
167-
coverage-dir: ## 检查特定目录的覆盖率 (使用 DIR=agentrun/server)
168-
@if [ -z "$(DIR)" ]; then \
169-
echo "Usage: make coverage-dir DIR=agentrun/server"; \
170-
exit 1; \
171-
fi
172-
@echo "📊 检查目录 $(DIR) 的覆盖率..."
173-
@uv run python scripts/check_coverage.py --source $(DIR) --check-directories $(DIR)
174-
175-
.PHONY: coverage-server
176-
coverage-server: ## 检查 server 模块的覆盖率
177-
@echo "📊 检查 server 模块覆盖率..."
178-
@uv run pytest tests/unittests/server/ --cov=agentrun/server --cov-report=term-missing --cov-branch
179-
180-
.PHONY: coverage-json
181-
coverage-json: ## 输出 JSON 格式的覆盖率报告
182-
@uv run python scripts/check_coverage.py --json-only --no-check
183-
184-
.PHONY: coverage-html
185-
coverage-html: ## 生成 HTML 覆盖率报告
186-
@echo "📊 生成 HTML 覆盖率报告..."
187-
@uv run pytest tests/ --cov=agentrun --cov-report=html --cov-branch
188-
@echo "✅ HTML 报告已生成到 htmlcov/ 目录"

0 commit comments

Comments
 (0)