Skip to content

Commit

Permalink
Fixed freeze script github yaml parsing and unfroze the ci versions. …
Browse files Browse the repository at this point in the history
…Also addressed minor escaping issue in Makefile

Signed-off-by: Eric Reinecke <[email protected]>
  • Loading branch information
reinecke committed Apr 12, 2024
1 parent 7755f31 commit 71ee6c1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 26 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: OpenTimelineIO
# for configuring which build will be a C++ coverage build / coverage report
env:
GH_COV_PY: 3.7
GH_COV_OS: ubuntu-22.04
GH_COV_OS: ubuntu-latest
GH_DEPENDABOT: dependabot

on:
Expand All @@ -24,15 +24,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
os: [ubuntu-latest, windows-latest, macos-latest]
# Unfortunately the CMake test target is OS dependent so we set it as
# a variable here.
include:
- os: ubuntu-22.04
- os: ubuntu-latest
OTIO_TEST_TARGET: test
- os: windows-2022
- os: windows-latest
OTIO_TEST_TARGET: RUN_TESTS
- os: macos-12
- os: macos-latest
OTIO_TEST_TARGET: test

env:
Expand Down Expand Up @@ -92,13 +92,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
include:
- { os: ubuntu-22.04, shell: bash }
- { os: macos-12, shell: bash }
- { os: windows-2022, shell: pwsh }
- { os: windows-2022, shell: msys2, python-version: 'mingw64' }
- { os: ubuntu-latest, shell: bash }
- { os: macos-latest, shell: bash }
- { os: windows-latest, shell: pwsh }
- { os: windows-latest, shell: msys2, python-version: 'mingw64' }

defaults:
run:
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12]
os: [ubuntu-latest, windows-latest, macos-latest]
python-build: ['cp37*', 'cp38*', 'cp39*', 'cp310*', 'cp311*', 'cp312*']
steps:
- uses: actions/checkout@v3
Expand All @@ -184,7 +184,7 @@ jobs:

package_sdist:
needs: py_build_test
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ update-contributors: check-github-token
@echo "Updating CONTRIBUTORS.md..."
@python maintainers/fetch_contributors.py \
--repo AcademySoftwareFoundation/OpenTimelineIO \
--token $(OTIO_RELEASE_GITHUB_TOKEN)
--token "${OTIO_RELEASE_GITHUB_TOKEN}"

dev-python-install:
@python setup.py install
Expand Down
71 changes: 58 additions & 13 deletions maintainers/freeze_ci_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,69 @@ def _parsed_args():
return parser.parse_args()


def main():
args = _parsed_args()

def fetch_plat_map():
# HACK: pull the image version corresponding to -latest out of the
# README.md for the github repo where they are stored
request = urllib.request.Request(GITHUB_README_URL)
response = urllib.request.urlopen(request).read().decode('utf-8')

# HACK: pull the image version corresponding to -latest out of the
# README.md for the github repo where they are stored
def md_row_fields(md_row):
# Split on |, discard the empty entries from leading and trailing |
return [
col.strip() for col in md_row.split("|")[1:-1]
]

# First, just strip the readme down the platform image table
lines = response.split("\n")
plat_map = {}
for plat in PLATFORMS:
plat_latest = plat + "-latest"
for ln in lines:
if plat_latest not in ln:
continue
plat_map[plat] = (
re.match(".*(" + plat + "-.*)`.*", ln).groups(0)[0]
table_lines = []
in_images_section = False
for line in lines:
if not in_images_section and line.startswith("## Available Images"):
in_images_section = True
continue
elif in_images_section and line.startswith("#"):
break
elif not in_images_section:
continue

if line.startswith("|"):
table_lines.append(line.strip())

# Extract the table column labels
plat_col_labels = md_row_fields(table_lines[0])

platform_name_re = re.compile(r"`([^`]*)`")
entries = {}
for line in table_lines[2:]:
col_data = md_row_fields(line)
plat_entry = dict(zip(plat_col_labels, col_data))
raw_labels = plat_entry["YAML Label"]
available_labels = platform_name_re.findall(raw_labels)
try:
next(
label for label in available_labels
if label.split("-")[-1] == "latest"
)
except StopIteration:
# not a latest label
continue

label = next(
label for label in available_labels
if label.split("-")[-1] not in {"xl", "latest"}
)
platform = label.split("-")[0]
if platform not in PLATFORMS:
continue
entries[platform] = label

return entries


def main():
args = _parsed_args()

plat_map = fetch_plat_map()

if args.freeze:
freeze_ci(plat_map, args.dryrun)
Expand Down

0 comments on commit 71ee6c1

Please sign in to comment.