Skip to content

Commit 23d5579

Browse files
committed
ci(workflows): simplify ci commands by using make targets
replace direct uv commands with corresponding make targets in ci workflow for better maintainability and consistency 更新 GitHub Actions 工作流中的命令调用方式,通过使用 Makefile 目标来简化和统一类型检查、单元测试及覆盖率检查的执行过程,提升可维护性与一致性 Change-Id: Id06a96f683ae4e07eb9d6ccd4f9901c01efb5f58 Signed-off-by: OhYee <[email protected]>
1 parent 28559a5 commit 23d5579

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ jobs:
2828
2929
- name: Run type check (mypy)
3030
run: |
31-
uv run mypy --config-file mypy.ini .
31+
make mypy-check
3232
3333
- name: Run unit tests
3434
run: |
35-
uv run pytest tests/unittests/ -v
35+
make test-unit
3636
3737
- name: Run coverage check
3838
run: |
39-
uv run python scripts/check_coverage.py --incremental
39+
make coverage-check
4040
4141
# 检测文件更改并决定是否构建测试包
4242
- name: Check for changes in agentrun directory

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ test-unit: ## 运行单元测试
139139
test-e2e: ## 运行端到端测试
140140
@uv run pytest tests/e2e/
141141

142+
.PHONY: mypy-check
143+
mypy-check: ## 运行 mypy 类型检查
144+
@uv run mypy --config-file mypy.ini .
145+
142146
.PHONY: coverage
143147
coverage: ## 运行测试并显示覆盖率报告(全量代码 + 增量代码)
144148
@echo "📊 运行覆盖率测试..."

scripts/check_coverage.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ def main():
545545
)
546546
parser.add_argument(
547547
"--test-path",
548-
default="tests/",
549-
help="测试目录(默认: tests/)",
548+
default="tests/unittests/",
549+
help="测试目录(默认: tests/unittests/)",
550550
)
551551
parser.add_argument(
552552
"--config",
@@ -577,9 +577,13 @@ def main():
577577

578578
# 运行覆盖率测试
579579
print("🚀 运行覆盖率测试...")
580+
test_path = args.test_path
581+
if test_path == "tests/": # 如果用户未指定 test-path 参数,则使用 unittests
582+
test_path = "tests/unittests/"
583+
580584
if not run_coverage(
581585
source=args.source,
582-
test_path=args.test_path,
586+
test_path=test_path,
583587
):
584588
print("❌ 测试失败")
585589
sys.exit(1)

0 commit comments

Comments
 (0)