Skip to content

Commit daca032

Browse files
committed
ci: run every workflow on every change; always re-import the vendored Boost
The path filters missed inputs (verify-scripts did not run for .xlings.json, which pins the generator's clang++), and release.yml requires tests and verify-scripts runs at the tag commit, which filtered commits never had. verify_generated.py re-imports Boost on every Linux run instead of only when import_boost.py changed: an edit under upstream/boost/ that no patch carries, or a patch dropped without its effect, now fails. The release archive is cached.
1 parent 27b135c commit daca032

6 files changed

Lines changed: 25 additions & 106 deletions

File tree

‎.github/workflows/check-docs.yml‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,8 @@ on:
1313
workflow_dispatch:
1414
push:
1515
branches: [main]
16-
paths:
17-
- ".github/workflows/check-docs.yml"
18-
- ".agents/**"
19-
- "docs/**"
20-
- "README*.md"
21-
- "tools/doc-tools/**"
2216
pull_request:
2317
branches: [main]
24-
paths:
25-
- ".github/workflows/check-docs.yml"
26-
- ".agents/**"
27-
- "docs/**"
28-
- "README*.md"
29-
- "tools/doc-tools/**"
3018

3119
concurrency:
3220
group: docs-${{ github.ref }}

‎.github/workflows/tests.yml‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,8 @@ name: Build and Tests
4444
on:
4545
push:
4646
branches: [main]
47-
paths:
48-
- ".github/workflows/tests.yml"
49-
- "examples/**"
50-
- "generated/**"
51-
- "port/**"
52-
- "src/**"
53-
- "templates/**"
54-
- "tests/**"
55-
- "tools/**"
56-
- "upstream/boost/**"
57-
- ".xlings.json"
58-
- "build.mcpp"
59-
- "mcpp.toml"
6047
pull_request:
6148
branches: [main]
62-
paths:
63-
- ".github/workflows/tests.yml"
64-
- "examples/**"
65-
- "generated/**"
66-
- "port/**"
67-
- "src/**"
68-
- "templates/**"
69-
- "tests/**"
70-
- "tools/**"
71-
- "upstream/boost/**"
72-
- ".xlings.json"
73-
- "build.mcpp"
74-
- "mcpp.toml"
7549

7650
permissions:
7751
contents: read

‎.github/workflows/verify-scripts.yml‎

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,8 @@ env:
2323
on:
2424
push:
2525
branches: [main]
26-
paths:
27-
- ".github/workflows/verify-scripts.yml"
28-
- ".github/actions/setup-generator/**"
29-
- "tools/**"
30-
- "src/**"
31-
- "patches/**"
32-
- "generated/**"
33-
- "upstream/boost/**"
34-
- "port/**"
35-
- "mcpp.toml"
36-
- ".gitignore"
37-
- ".gitattributes"
3826
pull_request:
3927
branches: [main]
40-
paths:
41-
- ".github/workflows/verify-scripts.yml"
42-
- ".github/actions/setup-generator/**"
43-
- "tools/**"
44-
- "src/**"
45-
- "patches/**"
46-
- "generated/**"
47-
- "upstream/boost/**"
48-
- "port/**"
49-
- "mcpp.toml"
50-
- ".gitignore"
51-
- ".gitattributes"
5228

5329
# The event is part of the group: a push to main must not cancel a run
5430
# triggered by another event on main.
@@ -68,7 +44,7 @@ jobs:
6844
matrix:
6945
include:
7046
# import_boost is platform-independent and intentionally owned by one
71-
# leg, so an update does not trigger three large downloads.
47+
# leg, so a run does not need three large downloads.
7248
- os: ubuntu-latest
7349
check_import_boost: true
7450
- os: windows-latest
@@ -103,15 +79,24 @@ jobs:
10379
restore-keys: |
10480
exports-cache-v2-${{ runner.os }}-${{ runner.arch }}-llvm-${{ env.LLVM_VERSION }}-${{ hashFiles('tools/gen_exports.py', 'tools/ast_json.py', 'tools/boost_common.py', 'tools/export_policy.toml', 'tools/fetch_mingw_sysroot.py') }}-
10581
82+
# The pinned Boost release re-imported below. import_boost.py checks the
83+
# archive against its pinned SHA-256, whether restored or downloaded.
84+
- name: Cache the Boost release archive
85+
if: matrix.check_import_boost
86+
uses: actions/cache@v6
87+
with:
88+
path: target/vendor-import/*.tar.gz
89+
key: boost-release-${{ hashFiles('tools/import_boost.py') }}
90+
10691
- name: Check the AST compiler and tool regressions
10792
working-directory: tools
10893
run: |
10994
uv run --locked python -c "import ast_json as aj; v = aj.clang_release(); print('AST compiler: clang', v); assert v == '${{ env.LLVM_VERSION }}', v"
11095
uv run --locked python -m unittest discover -s tests
11196
112-
- name: Verify generated outputs (including import_boost when changed)
97+
- name: Verify generated outputs (including the vendored Boost tree)
11398
if: matrix.check_import_boost
114-
run: uv run --project tools --locked python tools/ci/verify_generated.py --import-boost-if-changed
99+
run: uv run --project tools --locked python tools/ci/verify_generated.py --import-boost
115100

116101
- name: Verify generated outputs
117102
if: ${{ !matrix.check_import_boost }}

‎docs/architecture.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ keeps byte-identical notices.
319319
so they reuse the package objects and BMIs of the root `mcpp build`.
320320
- `tools/ci/verify_generated.py`: patch replay, `gen_exports.py --check`,
321321
`check_reachable.py`, `gen_features.py --check` and the audits on a clean tree on all three host
322-
platforms, then `git status` must be clean; a second build on the same
322+
platforms, then `git status` must be clean. The Linux leg first re-imports the
323+
pinned Boost release (`--import-boost`) and replays the patches, which must
324+
reproduce the committed `upstream/boost/`. A second build on the same
323325
configuration records the incremental TU count and mtimes.
324326
- `tools/check_mwrap_release.py`: identity, version scheme, tag, licence split and
325327
retained-document bytes.

‎docs/architecture.zh.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ feature(两种 Boost.Test 形态绝不能链接在一起)。
278278
- `tools/ci/verify_generated.py`:在三种宿主平台的干净代码树上跑补丁重放、
279279
`gen_exports.py --check`、`check_reachable.py`、`gen_features.py --check` 和审计,
280280
最后 `git status`
281-
必须干净;在同一配置上再做一次构建,记录增量 TU 数量和 mtime。
281+
必须干净。Linux 腿还会先重新导入固定的 Boost 发布包(`--import-boost`)并重放
282+
补丁,结果必须与提交的 `upstream/boost/` 一致。在同一配置上再做一次构建,记录增量 TU 数量和 mtime。
282283
- `tools/check_mwrap_release.py`:校验标识、版本方案、tag、许可证拆分以及保留
283284
文档的字节。
284285
- `tools/ci/test_template.py`:安装隔离的 `MCPP_HOME` 测试环境,执行真实的

‎tools/ci/verify_generated.py‎

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
``import_boost.py`` is different from the other steps. Re-vendoring restores
1414
the upstream files under ``upstream/boost/`` and intentionally removes the
1515
project's vendored patches; ``apply_patches.py`` must be run afterwards.
16-
The workflow runs this optional pair only once, on the Linux leg, when
17-
``tools/import_boost.py`` changed relative to the CI base revision. The AST
18-
steps need only ``clang++`` (no libclang) and the pinned MinGW sysroot.
16+
The workflow runs this optional pair on every run, on the Linux leg only: the
17+
result must be the committed tree, so an edit under ``upstream/boost/`` that no
18+
patch carries, or a patch dropped without its effect, fails. The AST steps need
19+
only ``clang++`` (no libclang) and the pinned MinGW sysroot.
1920
2021
Usage:
2122
python3 tools/ci/verify_generated.py
22-
python3 tools/ci/verify_generated.py --import-boost-if-changed
23+
python3 tools/ci/verify_generated.py --import-boost
2324
"""
2425

2526
import argparse
@@ -31,7 +32,6 @@
3132

3233
ROOT = Path(__file__).resolve().parents[2]
3334
TOOLS = ROOT / "tools"
34-
IMPORT_BOOST = "tools/import_boost.py"
3535

3636

3737
def git(*args, capture_output=False):
@@ -115,54 +115,23 @@ def _merge_base():
115115
return None
116116

117117

118-
def _changed_since_base(path):
119-
"""Return whether *path* changed in the current CI revision range."""
120-
for base in _base_revisions():
121-
names = git_text("diff", "--name-only", "{}...HEAD".format(base), "--", path)
122-
if names is not None:
123-
return bool(names.strip())
124-
125-
# Local runs and unusual GitHub events do not always provide a base ref.
126-
# HEAD^ is still a useful and deterministic fallback for the normal case.
127-
if _revision_exists("HEAD^{commit}"):
128-
names = git_text("diff", "--name-only", "HEAD^..HEAD", "--", path)
129-
if names is not None:
130-
return bool(names.strip())
131-
132-
# An initial commit has no parent; inspect the complete tree instead.
133-
names = git_text("diff-tree", "--root", "--no-commit-id", "--name-only", "-r", "HEAD", "--", path)
134-
return bool(names and names.strip())
135-
136-
137-
def import_boost_changed():
138-
changed = _changed_since_base(IMPORT_BOOST)
139-
print(
140-
"{} changed in the CI revision range: {}".format(
141-
IMPORT_BOOST, "yes" if changed else "no"
142-
)
143-
)
144-
return changed
145-
146-
147118
def main():
148119
parser = argparse.ArgumentParser(description=__doc__)
149120
parser.add_argument(
150-
"--import-boost-if-changed",
121+
"--import-boost",
151122
action="store_true",
152-
help="run import_boost.py once when it changed since the CI base",
123+
help="re-import the pinned Boost release and replay the patches first",
153124
)
154125
args = parser.parse_args()
155126

156127
assert_clean("initial checkout")
157128

158-
if args.import_boost_if_changed and import_boost_changed():
129+
if args.import_boost:
159130
# import_boost intentionally removes the vendored patches, so its
160131
# intermediate diff is expected. The following apply_patches step is the
161132
# idempotent boundary checked by CI and restores the committed state.
162133
run_step("import_boost.py", check_diff=False)
163134
run_step("apply_patches.py")
164-
elif args.import_boost_if_changed:
165-
print("skip tools/import_boost.py (unchanged)")
166135

167136
# Keep this order aligned with docs/architecture.md: provision the pinned
168137
# target headers, confirm the vendored adaptations are in place, then

0 commit comments

Comments
 (0)