-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ómar Högni Guðmarsson
committed
Apr 3, 2024
1 parent
0679100
commit e92e1cc
Showing
4 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Verify that the version string matches in all locations | ||
# Run this script from the root level of your tfc project | ||
# not inside the scripts folder | ||
import json | ||
import re | ||
|
||
# Read and parse the json file | ||
def read_and_parse(filename: 'string'): | ||
with open(filename, 'r') as f: | ||
return json.loads(f.read()) | ||
|
||
|
||
# Return the vcpkg version string | ||
def vcpkg_version_string(): | ||
return read_and_parse('vcpkg.json')["version"] | ||
|
||
# Return the base cmake version | ||
def cmake_project_version(): | ||
cmake_contents = "" | ||
with open("CMakeLists.txt", "r") as f: | ||
cmake_contents = f.read() | ||
|
||
## Use regex and try and find the version of the format "2023.10.2" | ||
p = re.compile(r'\d{4}\.\d{1,2}.\d*') | ||
version_strings = p.findall(cmake_contents) | ||
if len(version_strings) != 1: | ||
print("Multiple possible versions found {version_strings}") | ||
exit(-1) | ||
return version_strings[0] | ||
|
||
if __name__ == "__main__": | ||
vcpkg_version = vcpkg_version_string() | ||
cmake_version = cmake_project_version() | ||
print(f"vcpkg version {vcpkg_version}") | ||
print(f"Cmake version {cmake_version}") | ||
|
||
if cmake_version != vcpkg_version: | ||
print("cmake_version and vcpkg_version dont match!") | ||
exit(-1) | ||
|
||
exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: sanity_check_version | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
check: | ||
name: 'Check version strings' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check | ||
run: | | ||
python .github/scripts/sanity_check_version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters