diff options
author | Tom Stellard <tstellar@redhat.com> | 2022-07-26 16:52:53 -0700 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2022-07-26 16:53:24 -0700 |
commit | 9d05de2a912e60c12670c50ee61abb24335d8f16 (patch) | |
tree | 4252e48aa0b3eefe105a50340b2abff8cc0e233b /.github/workflows/version-check.py | |
parent | 8e26c315a70f4833c38c23ed9efcee90c69e9069 (diff) | |
download | llvm-9d05de2a912e60c12670c50ee61abb24335d8f16.tar.gz |
Import CI tests from the release branch
The tests still only run on pushes or pull requests for the release
branch, but having it in the main branch means we don't have to copy
the tests every time we create a new release branch.
Reviewed By: asl
Differential Revision: https://reviews.llvm.org/D129526
Diffstat (limited to '.github/workflows/version-check.py')
-rwxr-xr-x | .github/workflows/version-check.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py new file mode 100755 index 000000000000..74c061ee9e95 --- /dev/null +++ b/.github/workflows/version-check.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +from git import Repo +import re +import sys + +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 not m: + print("error: Tag is not valid: ", tag) + sys.exit(1) + +expected_major = m.group(1) +expected_minor = m.group(2) +expected_patch = int(m.group(3)) + 1 +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) + +if version != expected_version: + print("error: Expected version", expected_version, "but found version", version) + sys.exit(1) + +print("Versions match:", version, expected_version) +sys.exit(0) |