|
31 | 31 | - Ensures tags are merged into stable branches (for non-RC releases) |
32 | 32 | - Verifies bump branches exist and are configured correctly |
33 | 33 | - 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) |
34 | 36 |
|
35 | 37 | 3. Optionally automates missing steps (when not in --dry-run mode): |
36 | 38 | - Creates missing release tags using push_repo_release_tag.py |
@@ -499,6 +501,57 @@ def check_proofwidgets4_release(repo_url, target_toolchain, github_token): |
499 | 501 | print(f" You will need to create and push a tag v0.0.{next_version}") |
500 | 502 | return False |
501 | 503 |
|
| 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 | + |
502 | 555 | def main(): |
503 | 556 | parser = argparse.ArgumentParser(description="Check release status of Lean4 repositories") |
504 | 557 | parser.add_argument("toolchain", help="The toolchain version to check (e.g., v4.6.0)") |
@@ -763,6 +816,12 @@ def main(): |
763 | 816 | repo_status[name] = False |
764 | 817 | continue |
765 | 818 |
|
| 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 | + |
766 | 825 | repo_status[name] = success |
767 | 826 |
|
768 | 827 | # Final check for lean4 master branch |
|
0 commit comments