Repository navigation
64 lines (62 loc) · 3.39 KB
/
Copy pathpython-tests.yml
File metadata and controls
64 lines (62 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: python-tests
# Python 侧全量套件接入 CI(2026-09-20 v15-2 修复)。
#
# 为什么必须有:此前 6 个 workflow **无一**调用 `scripts/run_tests.py`,147 目标的
# Python 套件完全在 CI 之外——于是 `md_cg/test_datapath_root`(一条只在 Windows 成立的
# 断言)从入库那刻起就在 POSIX 上红着,而**没有任何流水线会拦下它**:
# 「干净克隆上全绿」这一对外承诺因此长期不成立且无人可见。红基线看得见,才有自愈闭环。
#
# 刻意**不加 paths 过滤**:套件覆盖面横跨 md_cg/、hive/、compiler/、swarm/、scripts/,
# 任何一处改动都可能让它变红;paths 白名单一旦漏项就会重现「改动不入门禁」的盲区
# (20260915 cogmap-check 已有前例)。全量跑换「红基线必然可见」。
#
# CI 与部署侧的差异是**设计内**的:无真源数据面的目标由 `run_tests.py` 按依赖检查
# SKIP(如实标记跳过理由,不是假绿)。
on:
workflow_dispatch:
# 只在 main 上响应 push:PR 分支若同时触发 push + pull_request,同一提交会跑两遍
# (实测每 PR 双份 run-tests,队列被占满 —— 12 个 PR 排队数小时)。PR 侧只留 pull_request。
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
# issue #245/#258 等的 S10 组守卫取「修复前源」需要历史提交(git show <old>:<path>),
# 而 checkout 默认 fetch-depth: 1 是浅克隆 ⇒ 那些断言在 CI 上取不到旧版本而红,
# 本地(完整克隆)却全绿。此处拉全历史,让「本地绿」与「CI 绿」同义。
- uses: actions/checkout@v7
with:
# Several existing guards locate the original buggy source through
# git log -S and git show <introduction>^; a shallow checkout cannot
# execute their negative controls and must not be treated as ready.
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- uses: actions/setup-node@v7
with:
node-version: "22"
- name: 构建插件入口(干净检出验收前置)
run: |
npm ci --ignore-scripts --include=dev
npm run build
# 套件里 scripts/test_injection_chain.py 经 verify_discipline → render_discipline
# 依赖 pyyaml(discipline-check job 已装,python-tests job 此前漏装 → 该用例
# 在这里恒红 `ModuleNotFoundError: No module named 'yaml'`,属依赖面不一致,
# 不是被测缺陷)。两个 job 的依赖面保持同款。
- name: 依赖(scripts/test_injection_chain 需要 pyyaml)
run: python -m pip install pyyaml
# 全量套件包含需要 release 二进制的 Rust / Hive 守卫;裸 runner 没有
# 工作区缓存,必须在测试前显式构建,否则会把“未构建”误报成代码失败。
- name: 构建 Rust release 二进制
run: |
cargo build --release --manifest-path rust/Cargo.toml
cargo build --release --manifest-path hive/Cargo.toml
- name: Python 全量套件(scripts/run_tests.py)
# 多个 hive 守卫共享临时工作区与生成表;并行执行会产生竞态假红。
run: python scripts/run_tests.py --jobs 1