Skip to content

Commit 50f4bc8

Browse files
reineckeapetrynetssteinbach
authored
Fixed freeze script github yaml parsing and unfroze the ci versions (#1726)
* Fixed freeze script github yaml parsing and unfroze the ci versions. Signed-off-by: Eric Reinecke <ereinecke@netflix.com> --------- Signed-off-by: Eric Reinecke <reinecke.eric@gmail.com> Signed-off-by: Eric Reinecke <ereinecke@netflix.com> Co-authored-by: Daniel Flehner Heen <flehnerheener@gmail.com> Co-authored-by: Stephan Steinbach <61017+ssteinbach@users.noreply.github.com>
1 parent 588ff5b commit 50f4bc8

File tree

2 files changed

+76
-31
lines changed

2 files changed

+76
-31
lines changed

.github/workflows/python-package.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: OpenTimelineIO
66
# for configuring which build will be a C++ coverage build / coverage report
77
env:
88
GH_COV_PY: "3.10"
9-
GH_COV_OS: ubuntu-22.04
9+
GH_COV_OS: ubuntu-latest
1010
GH_DEPENDABOT: dependabot
1111

1212
on:
@@ -24,17 +24,17 @@ jobs:
2424
runs-on: ${{ matrix.os }}
2525
strategy:
2626
matrix:
27-
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
27+
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
2828
# Unfortunately the CMake test target is OS dependent so we set it as
2929
# a variable here.
3030
include:
31-
- os: ubuntu-22.04
31+
- os: ubuntu-latest
3232
OTIO_TEST_TARGET: test
33-
- os: windows-2022
33+
- os: windows-latest
3434
OTIO_TEST_TARGET: RUN_TESTS
35-
- os: macos-12
35+
- os: macos-latest
3636
OTIO_TEST_TARGET: test
37-
- os: macos-14
37+
- os: macos-13
3838
OTIO_TEST_TARGET: test
3939

4040
env:
@@ -94,18 +94,18 @@ jobs:
9494
runs-on: ${{ matrix.os }}
9595
strategy:
9696
matrix:
97-
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
97+
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
9898
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
9999
include:
100-
- { os: ubuntu-22.04, shell: bash }
101-
- { os: macos-12, shell: bash }
102-
- { os: macos-14, shell: bash }
103-
- { os: windows-2022, shell: pwsh }
104-
- { os: windows-2022, shell: msys2, python-version: 'mingw64' }
100+
- { os: ubuntu-latest, shell: bash }
101+
- { os: macos-latest, shell: bash }
102+
- { os: macos-13, shell: bash }
103+
- { os: windows-latest, shell: pwsh }
104+
- { os: windows-latest, shell: msys2, python-version: 'mingw64' }
105105
exclude:
106-
- { os: macos-14, python-version: 3.7 }
107-
- { os: macos-14, python-version: 3.8 }
108-
- { os: macos-14, python-version: 3.9 }
106+
- { os: macos-latest, python-version: 3.7 }
107+
- { os: macos-latest, python-version: 3.8 }
108+
- { os: macos-latest, python-version: 3.9 }
109109

110110
defaults:
111111
run:
@@ -175,10 +175,10 @@ jobs:
175175
runs-on: ${{ matrix.os }}
176176
strategy:
177177
matrix:
178-
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
178+
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
179179
python-build: ['cp37*', 'cp38*', 'cp39*', 'cp310*', 'cp311*', 'cp312*']
180180
exclude:
181-
- { os: macos-14, python-build: 'cp37*' }
181+
- { os: macos-latest, python-build: 'cp37*' }
182182
steps:
183183
- uses: actions/checkout@v4
184184

@@ -199,7 +199,7 @@ jobs:
199199

200200
package_sdist:
201201
needs: py_build_test
202-
runs-on: ubuntu-22.04
202+
runs-on: ubuntu-latest
203203
steps:
204204
- uses: actions/checkout@v4
205205
with:

maintainers/freeze_ci_versions.py

+58-13
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,69 @@ def _parsed_args():
4949
return parser.parse_args()
5050

5151

52-
def main():
53-
args = _parsed_args()
54-
52+
def _fetch_plat_map():
53+
# HACK: pull the image version corresponding to -latest out of the
54+
# README.md for the github repo where they are stored
5555
request = urllib.request.Request(GITHUB_README_URL)
5656
response = urllib.request.urlopen(request).read().decode('utf-8')
5757

58-
# HACK: pull the image version corresponding to -latest out of the
59-
# README.md for the github repo where they are stored
58+
def md_row_fields(md_row):
59+
# Split on |, discard the empty entries from leading and trailing |
60+
return [
61+
col.strip() for col in md_row.split("|")[1:-1]
62+
]
63+
64+
# First, just strip the readme down the platform image table
6065
lines = response.split("\n")
61-
plat_map = {}
62-
for plat in PLATFORMS:
63-
plat_latest = plat + "-latest"
64-
for ln in lines:
65-
if plat_latest not in ln:
66-
continue
67-
plat_map[plat] = (
68-
re.match(".*(" + plat + "-.*)`.*", ln).groups(0)[0]
66+
table_lines = []
67+
in_images_section = False
68+
for line in lines:
69+
if not in_images_section and line.startswith("## Available Images"):
70+
in_images_section = True
71+
continue
72+
elif in_images_section and line.startswith("#"):
73+
break
74+
elif not in_images_section:
75+
continue
76+
77+
if line.startswith("|"):
78+
table_lines.append(line.strip())
79+
80+
# Extract the table column labels
81+
plat_col_labels = md_row_fields(table_lines[0])
82+
83+
platform_name_re = re.compile(r"`([^`]*)`")
84+
entries = {}
85+
for line in table_lines[2:]:
86+
col_data = md_row_fields(line)
87+
plat_entry = dict(zip(plat_col_labels, col_data))
88+
raw_labels = plat_entry["YAML Label"]
89+
available_labels = platform_name_re.findall(raw_labels)
90+
try:
91+
next(
92+
label for label in available_labels
93+
if label.split("-")[-1] == "latest"
6994
)
95+
except StopIteration:
96+
# not a latest label
97+
continue
98+
99+
label = next(
100+
label for label in available_labels
101+
if label.split("-")[-1] not in {"xl", "xlarge", "latest"}
102+
)
103+
platform = label.split("-")[0]
104+
if platform not in PLATFORMS:
105+
continue
106+
entries[platform] = label
107+
108+
return entries
109+
110+
111+
def main():
112+
args = _parsed_args()
113+
114+
plat_map = _fetch_plat_map()
70115

71116
if args.freeze:
72117
freeze_ci(plat_map, args.dryrun)

0 commit comments

Comments
 (0)