[PATCH] D131650: workflows/version-check: Fix check for release candidates
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 21:51:58 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b108dfc159a: workflows/version-check: Fix check for release candidates (authored by tstellar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131650/new/
https://reviews.llvm.org/D131650
Files:
.github/workflows/version-check.py
Index: .github/workflows/version-check.py
===================================================================
--- .github/workflows/version-check.py
+++ .github/workflows/version-check.py
@@ -4,33 +4,29 @@
import re
import sys
+
+def get_version_from_tag(tag):
+ m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)(-rc[0-9]+)?$', tag)
+ if m:
+ if m.lastindex == 4:
+ # We have an rc tag.
+ return m.group(1,2,3)
+ # We have a final release tag.
+ return (m.group(1), m.group(2), int(m.group(3)) + 1)
+
+ m = re.match('llvmorg-([0-9]+)-init', tag)
+ if m:
+ return (int(m.group(1)) + 1, 0, 0)
+
+ raise Exception(f"error: Tag is not valid: {tag}")
+
+
version = sys.argv[1]
repo = Repo()
tag = repo.git.describe(tags = True, abbrev=0)
-m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)', tag)
-
-if m:
- expected_major = m.group(1)
- expected_minor = m.group(2)
- expected_patch = int(m.group(3)) + 1
-else:
- # If the previous tag is llvmorg-X-init, then we should be at version X.0.0.
- m = re.match('llvmorg-([0-9]+)-init', tag)
- if not m:
- print("error: Tag is not valid: ", tag)
- sys.exit(1)
- expected_major = m.group(1)
- expected_minor = 0
- expected_patch = 0
-
-expected_version = f"{expected_major}.{expected_minor}.{expected_patch}"
-
-m = re.match("[0-9]+\.[0-9]+\.[0-9]+", version)
-if not m:
- print("error: Version is not valid: ", version)
- sys.exit(1)
+expected_version = '.'.join(get_version_from_tag(tag))
if version != expected_version:
print("error: Expected version", expected_version, "but found version", version)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131650.454163.patch
Type: text/x-patch
Size: 1674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220820/10f2f0c1/attachment.bin>
More information about the llvm-commits
mailing list