Skip to content

Commit 1c03693

Browse files
committed
Add check to ensure that git tag matches the wrapper version
1 parent 66b62d0 commit 1c03693

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.github/workflows/dist.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ jobs:
6464
run: |
6565
./rdev.sh ci check-pyproject
6666
67+
- name: Check git tag
68+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
69+
shell: bash
70+
run: |
71+
./rdev.sh ci check-tag
6772
6873
#
6974
# Build other wheels first (OS-specific, not python specific)

devtools/ci.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#
44

55
import pathlib
6+
import subprocess
67
import sys
78
import typing as T
89

910
import click
1011
from packaging.requirements import Requirement
12+
from packaging.version import Version
1113

1214
from .ctx import Context
1315
from .update_pyproject import ProjectUpdater
@@ -37,6 +39,27 @@ def check_pyproject(ctx: Context):
3739
print("OK")
3840

3941

42+
@ci.command
43+
@click.pass_obj
44+
def check_tag(ctx: Context):
45+
"""
46+
Ensures that the current git tag matches the 'wrapper' version
47+
"""
48+
wrapper_version = Version(ctx.cfg.py_versions["wrapper"])
49+
raw_git_version = subprocess.check_output(
50+
["git", "describe", "--tags"], encoding="utf-8"
51+
)
52+
git_version = Version(raw_git_version.split("-", 1)[0])
53+
print("Wrapper version :", wrapper_version)
54+
print("Git version :", git_version)
55+
56+
if wrapper_version != git_version:
57+
print("ERROR: git tag does not match wrapper version")
58+
exit(1)
59+
else:
60+
print("OK")
61+
62+
4063
@ci.command()
4164
@click.option("--no-test", default=False, is_flag=True)
4265
@click.pass_obj

rdev.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ native = "2025.3.2"
1717
halsim_native = "2025.3.2.2"
1818

1919
# Usually similar to native, but subminor version is bumped for bugfixes
20+
# - ./rdev.sh ci check_tag will fail if this doesn't match current tag
2021
wrapper = "2025.3.2.2"
2122

2223
[params]

0 commit comments

Comments
 (0)