Skip to content

Commit b5cb9b2

Browse files
committed
ci: move release-notes checker to ci/tools and drop component=all
Addresses review feedback on #1907: - Relocate check_release_notes.py (and its tests) from toolshed/ to ci/tools/, matching validate-release-wheels which is the closest conceptual neighbor. toolshed/ is for scripts we rarely re-run; this one is invoked from release.yml on every release. - Drop the `all` component. The shared-version assumption it encoded no longer matches the repo's independent tag families (v*, cuda-core-v*, cuda-pathfinder-v*). The broader release-workflow cleanup for `all` will happen in a separate pass. - Register ci/tools/tests under pytest testpaths, and run the unit tests in the check-release-notes job before invoking the script.
1 parent 90fcc08 commit b5cb9b2

File tree

4 files changed

+25
-37
lines changed

4 files changed

+25
-37
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ jobs:
102102
with:
103103
python-version: "3.12"
104104

105+
- name: Self-test release-notes checker
106+
run: |
107+
pip install pytest
108+
pytest ci/tools/tests
109+
105110
- name: Check versioned release notes exist
106111
run: |
107-
python toolshed/check_release_notes.py \
112+
python ci/tools/check_release_notes.py \
108113
--git-tag "${{ inputs.git-tag }}" \
109114
--component "${{ inputs.component }}"
110115
Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
python check_release_notes.py --git-tag <tag> --component <component>
88
99
Exit codes:
10-
0 — all release notes present and non-empty (or .post version, skipped)
11-
1 — one or more release notes missing or empty
10+
0 — release notes present and non-empty (or .post version, skipped)
11+
1 — release notes missing or empty
1212
2 — invalid arguments
1313
"""
1414

@@ -19,12 +19,11 @@
1919
import re
2020
import sys
2121

22-
COMPONENT_TO_PACKAGES: dict[str, list[str]] = {
23-
"cuda-core": ["cuda_core"],
24-
"cuda-bindings": ["cuda_bindings"],
25-
"cuda-pathfinder": ["cuda_pathfinder"],
26-
"cuda-python": ["cuda_python"],
27-
"all": ["cuda_bindings", "cuda_core", "cuda_pathfinder", "cuda_python"],
22+
COMPONENT_TO_PACKAGE: dict[str, str] = {
23+
"cuda-core": "cuda_core",
24+
"cuda-bindings": "cuda_bindings",
25+
"cuda-pathfinder": "cuda_pathfinder",
26+
"cuda-python": "cuda_python",
2827
}
2928

3029
# Matches tags like "v13.1.0", "cuda-core-v0.7.0", "cuda-pathfinder-v1.5.2"
@@ -48,7 +47,7 @@ def notes_path(package: str, version: str) -> str:
4847
def check_release_notes(git_tag: str, component: str, repo_root: str = ".") -> list[tuple[str, str]]:
4948
"""Return a list of (path, reason) for missing or empty release notes.
5049
51-
Returns an empty list when all notes are present and non-empty.
50+
Returns an empty list when notes are present and non-empty.
5251
"""
5352
version = parse_version_from_tag(git_tag)
5453
if version is None:
@@ -57,26 +56,23 @@ def check_release_notes(git_tag: str, component: str, repo_root: str = ".") -> l
5756
if is_post_release(version):
5857
return []
5958

60-
packages = COMPONENT_TO_PACKAGES.get(component)
61-
if packages is None:
59+
package = COMPONENT_TO_PACKAGE.get(component)
60+
if package is None:
6261
return [("<component>", f"unknown component '{component}'")]
6362

64-
problems = []
65-
for pkg in packages:
66-
path = notes_path(pkg, version)
67-
full = os.path.join(repo_root, path)
68-
if not os.path.isfile(full):
69-
problems.append((path, "missing"))
70-
elif os.path.getsize(full) == 0:
71-
problems.append((path, "empty"))
72-
73-
return problems
63+
path = notes_path(package, version)
64+
full = os.path.join(repo_root, path)
65+
if not os.path.isfile(full):
66+
return [(path, "missing")]
67+
if os.path.getsize(full) == 0:
68+
return [(path, "empty")]
69+
return []
7470

7571

7672
def main(argv: list[str] | None = None) -> int:
7773
parser = argparse.ArgumentParser(description=__doc__)
7874
parser.add_argument("--git-tag", required=True)
79-
parser.add_argument("--component", required=True, choices=list(COMPONENT_TO_PACKAGES))
75+
parser.add_argument("--component", required=True, choices=list(COMPONENT_TO_PACKAGE))
8076
parser.add_argument("--repo-root", default=".")
8177
args = parser.parse_args(argv)
8278

toolshed/tests/test_check_release_notes.py renamed to ci/tools/tests/test_check_release_notes.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,6 @@ def test_post_release_skipped(self, tmp_path):
7474
problems = check_release_notes("v12.6.2.post1", "cuda-bindings", str(tmp_path))
7575
assert problems == []
7676

77-
def test_component_all(self, tmp_path):
78-
for pkg in ("cuda_bindings", "cuda_core", "cuda_pathfinder", "cuda_python"):
79-
self._make_notes(tmp_path, pkg, "13.1.0")
80-
problems = check_release_notes("v13.1.0", "all", str(tmp_path))
81-
assert problems == []
82-
83-
def test_component_all_partial_missing(self, tmp_path):
84-
self._make_notes(tmp_path, "cuda_bindings", "13.1.0")
85-
self._make_notes(tmp_path, "cuda_core", "13.1.0")
86-
problems = check_release_notes("v13.1.0", "all", str(tmp_path))
87-
assert len(problems) == 2
88-
missing_pkgs = {p.split("/")[0] for p, _ in problems}
89-
assert missing_pkgs == {"cuda_pathfinder", "cuda_python"}
90-
9177
def test_invalid_tag(self, tmp_path):
9278
problems = check_release_notes("not-a-tag", "cuda-core", str(tmp_path))
9379
assert len(problems) == 1

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ testpaths =
1212
cuda_bindings/tests
1313
cuda_core/tests
1414
tests/integration
15+
ci/tools/tests
1516

1617
markers =
1718
pathfinder: tests for cuda_pathfinder

0 commit comments

Comments
 (0)