Skip to content

[chore] 建立 CPU CI:ruff gate + 全量测试 + coverage PR 评论 - #38

Merged
boundless-future merged 1 commit into
mainfrom
ci/cpu-pipeline
Jun 27, 2026
Merged

boundless-future merged 1 commit into
mainfrom
ci/cpu-pipeline

Conversation

@Jackie2049

Copy link
Copy Markdown
Owner

目的

建立一套面向 CPU 的 CI 维护机制(无 GPU/NPU runner 可用前提下的最大化自动化)。详见 verl070 release vs verl080 切换 与本次讨论结论。

CI 跑什么(.github/workflows/ci.yml

每次 push/PR 触发,ubuntu + py3.9 + torch-CPU

  • ruff gateF,E9:pyflakes + 语法错误,真 bug)
  • pytest tests/ 全量——靠 importorskip 自动筛环境:本地 208 passed / 29 skipped(NPU/GPU/verl080-e2e 自动跳过,等公司内 NPU 机手动跑)
  • coverage 进 job summary + PR 评论(聚焦本次改动文件)
  • import smokeprefix_sharingsetup.install 可导入

配置

  • pyproject.toml[tool.ruff] select F,E9[tool.coverage] omit tools/patches(核心覆盖率 75%,不再被 0% 的 tools/patches 拖到误导性的 34%)
  • requirements-ci.txt + .pre-commit-config.yaml(commit 前 ruff --fix

顺带修掉 F,E9 暴露的 29 个问题(让 gate 干净)

  • 2 个真 bugmegatron_runtime.pyprefix_log 全仓库从未定义(潜伏 NameError,diag dump 失败时触发)→ 改用 module logger;verl_mcore.py 死变量 device
  • 26 个未用 import / 空 f-string(ruff --fix

清理 main 既有的坏测试(CI 必须 green on main)

#35 重构后遗留:

范围之外(明确不做)

  • NPU/GPU/verl080-e2e 测试:公司内 NPU 机手动跑,发版前 gate(后续加进 release checklist)
  • ruff format 强制 + 全规则 gate:代码从未被 lint(全规则 ~2700 个),先 F,E9,逐步收紧
  • 分支保护:本 PR 合并、CI 验证稳定后再单独加(避免规则卡死)

测试结果

本地(py3.9 + torch-CPU,无 verl/GPU/NPU):208 passed / 29 skipped / 1 xfailed

GitHub 无可用 NPU/GPU runner,CI 只做 CPU 能覆盖的部分;NPU/GPU/verl080-e2e
测试靠 importorskip 自动跳过,由公司内 NPU 机在发版前手动跑。

- .github/workflows/ci.yml:push/PR/workflow_dispatch 触发,ubuntu + py3.9 + torch-CPU
  - ruff gate(F,E9 真 bug),format 仅 advisory
  - pytest tests/ 全量(importorskip 自动筛环境)
  - coverage 进 job summary + PR 评论(聚焦本次改动文件,单评论更新)
  - import smoke:prefix_sharing 与 setup.install 可导入
- pyproject.toml:[tool.ruff] select F,E9;[tool.coverage] omit tools/patches
  (核心覆盖率 75%,不被 0% 的 tools/patches 拖到误导性 34%)
- requirements-ci.txt + .pre-commit-config.yaml(commit 前 ruff --fix)
- .gitignore:补 coverage 产物

顺带修掉 F,E9 暴露的 27 个问题:
- verl_mcore.py:restore_via_2d_unfold_verl080 里死变量 device(F841)
- 26 个:F401 未用 import / F541 空 f-string(ruff --fix)
(注:megatron_runtime.py 的 prefix_log 潜伏 NameError 已由 #37 一并清理)

本地验证:209 passed / 29 skipped,ruff F,E9 clean,核心 coverage 75%。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📊 Coverage report

prefix_sharing/setup/version_guard.py                  37      9    76%   41, 44, 52, 55, 62-66
prefix_sharing/utils.py                                 7      0   100%
---------------------------------------------------------------------------------
TOTAL                                                2146    545    75%

Changed files in this PR

Name                                          Stmts   Miss  Cover   Missing
---------------------------------------------------------------------------
prefix_sharing/backends/flash_atten_base.py      52      3    94%   40, 45, 50
prefix_sharing/core/config.py                   116     10    91%   40-41, 46-52, 82, 97, 99, 130, 132
prefix_sharing/integrations/verl_mcore.py       378    164    57%   56-57, 90-93, 120-121, 131-132, 139-151, 161-162, 179-180, 283, 289, 295, 314, 334, 409, 525, 528, 540, 544-548, 591-682, 696-742, 758-808, 817-826, 840-846, 863-882, 901-903
prefix_sharing/setup/registry.py                 67     47    30%   37, 51-83, 102-152
---------------------------------------------------------------------------
TOTAL                                           613    224    63%

@boundless-future
boundless-future merged commit 6231593 into main Jun 27, 2026
1 check passed
Jackie2049 added a commit that referenced this pull request Jun 28, 2026
- 合并 origin/main 的 CPU CI 工作流(.github/workflows/ci.yml)
- 解决 verl_mcore.py import 冲突,保留 Iterator / ensure_global_packed_token_lengths / PatchHandle
- 同步 requirements-ci.txt、pyproject.toml ruff/coverage 配置、.pre-commit-config.yaml
- 本地验证:209 passed / 29 skipped,ruff F,E9 clean,核心 coverage 75%

Co-authored-by: Cursor <cursoragent@cursor.com>
@Jackie2049
Jackie2049 deleted the ci/cpu-pipeline branch July 10, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants