Skip to content

Commit 490d714

Browse files
authored
chore: run Mathlib's verify_version_tags.py in release_checklist.py (#11392)
Not tested carefully: I will shake out any problems during the next release. This script would have detected the mistakes I made in recent releases of `v4.24.1` / `v4.25.1` and `v4.25.2`. (And #11374 would have prevented these mistakes.)
1 parent 9220ee3 commit 490d714

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

script/release_checklist.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
- Ensures tags are merged into stable branches (for non-RC releases)
3232
- Verifies bump branches exist and are configured correctly
3333
- Special handling for ProofWidgets4 release tags
34+
- For mathlib4: runs verify_version_tags.py to validate the release tag
35+
(checks git/GitHub consistency, toolchain, elan, cache, and build)
3436
3537
3. Optionally automates missing steps (when not in --dry-run mode):
3638
- Creates missing release tags using push_repo_release_tag.py
@@ -499,6 +501,57 @@ def check_proofwidgets4_release(repo_url, target_toolchain, github_token):
499501
print(f" You will need to create and push a tag v0.0.{next_version}")
500502
return False
501503

504+
def run_mathlib_verify_version_tags(toolchain, verbose=False):
505+
"""Run mathlib4's verify_version_tags.py script to validate the release tag.
506+
507+
This clones mathlib4 to a temp directory and runs the verification script.
508+
Returns True if verification passes, False otherwise.
509+
"""
510+
import tempfile
511+
512+
print(f" ... Running mathlib4 verify_version_tags.py {toolchain}")
513+
514+
with tempfile.TemporaryDirectory() as tmpdir:
515+
# Clone mathlib4 (shallow clone is sufficient for running the script)
516+
clone_result = subprocess.run(
517+
['git', 'clone', '--depth', '1', 'https://github.com/leanprover-community/mathlib4.git', tmpdir],
518+
capture_output=True,
519+
text=True
520+
)
521+
if clone_result.returncode != 0:
522+
print(f" ❌ Failed to clone mathlib4: {clone_result.stderr.strip()[:200]}")
523+
return False
524+
525+
# Run the verification script
526+
script_path = os.path.join(tmpdir, 'scripts', 'verify_version_tags.py')
527+
if not os.path.exists(script_path):
528+
print(f" ❌ verify_version_tags.py not found in mathlib4 (expected at scripts/verify_version_tags.py)")
529+
return False
530+
531+
# Run from the mathlib4 directory so git operations work
532+
result = subprocess.run(
533+
['python3', script_path, toolchain],
534+
cwd=tmpdir,
535+
capture_output=True,
536+
text=True,
537+
timeout=900 # 15 minutes timeout for cache download etc.
538+
)
539+
540+
# Print output with indentation
541+
if result.stdout:
542+
for line in result.stdout.strip().split('\n'):
543+
print(f" {line}")
544+
if result.stderr:
545+
for line in result.stderr.strip().split('\n'):
546+
print(f" {line}")
547+
548+
if result.returncode != 0:
549+
print(f" ❌ mathlib4 verify_version_tags.py failed")
550+
return False
551+
552+
print(f" ✅ mathlib4 verify_version_tags.py passed")
553+
return True
554+
502555
def main():
503556
parser = argparse.ArgumentParser(description="Check release status of Lean4 repositories")
504557
parser.add_argument("toolchain", help="The toolchain version to check (e.g., v4.6.0)")
@@ -763,6 +816,12 @@ def main():
763816
repo_status[name] = False
764817
continue
765818

819+
# For mathlib4, run verify_version_tags.py to validate the release tag
820+
if name == "mathlib4":
821+
if not run_mathlib_verify_version_tags(toolchain, verbose):
822+
repo_status[name] = False
823+
continue
824+
766825
repo_status[name] = success
767826

768827
# Final check for lean4 master branch

0 commit comments

Comments
 (0)