CI:Gitea Actions 落地 L0+L0.5(补 T-6)

新增 .gitea/workflows/ci.yml:push/PR 触发两个 Windows job——
l0-gates 跑 pre-commit --all-files(无 Keil .map 时自适应跳过 mem-numbers),
l05-host-unit-tests 遍历 test/host/**/run_unit_test.py(缺 MSVC 则告警降级跳过)。
刻意不跑 @build(需 Keil 授权);L1/L2/L3 需真机+ST-LINK,不上 CI。

新增 scripts/ci_local.py:本地跑与 CI 等价的门禁(自动选用装了 pre-commit
的解释器;.map 自适应;退出码 0/1/2 与 CI 对齐),供提交前自查与 runner 就绪前过渡。

文档同步:测试开发标准流程 §9(CI 章节)/§1/§4.1、待处理内容 T-6 销项、
项目部署环境要求 §2.11(runner 前置)、pre-commit 使用说明 §1、scripts/README.md、AGENTS.md。

验证:scripts/ci_local.py rc=0(L0 14 钩子全过 + L0.5 39/39)。
This commit is contained in:
2026-10-01 10:19:38 +08:00
parent 2055de0303
commit e90486524d
8 changed files with 507 additions and 1 deletions
+11
View File
@@ -23,12 +23,23 @@
| `ram_report.py` | 从 `.map` 生成**静态 RAM/Flash 占用**报告(→ `docs/内存管理/data/`) |
| `stack_report.py` | 从 Keil 静态调用图 + 串口 `[STACK]` 水位生成**每任务最坏链**报告 |
### CI 与本地等价(2026-10-01 T-6)
| 脚本 / 文件 | 作用 |
|---|---|
| `ci_local.py` | **本地跑与 CI 等价的门禁**(L0 pre-commit + L0.5 主机侧单测):自动选用装了 pre-commit 的解释器;无 `.map` 时自适应跳过 `mem-numbers`;退出码 0/1/2 与 CI 对齐。CI 定义见 `../.gitea/workflows/ci.yml`,说明见 `docs/测试说明/测试开发标准流程.md` §9 |
## 使用方式
```bash
# 全库跑门禁
& 'C:\ProgramData\anaconda3\python.exe' -m pre_commit run --all-files
# 本地跑与 CI 等价的门禁(L0 + L0.5)
& '.venv\Scripts\python.exe' scripts/ci_local.py
& '.venv\Scripts\python.exe' scripts/ci_local.py --l0-only # 只跑 L0
& '.venv\Scripts\python.exe' scripts/ci_local.py --l05-only # 只跑 L0.5
# 单个脚本
& '.venv\Scripts\python.exe' scripts/check_doc_links.py --all
& '.venv\Scripts\python.exe' scripts/gen_task_table.py --check # 或 --write / --diff