Relax Xcode version checks in GitHub Actions

This commit is contained in:
Max Radermacher 2025-10-03 19:40:24 -05:00 committed by GitHub
parent c7a070683e
commit 96eed3bced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View File

@ -18,7 +18,7 @@ concurrency:
env:
# Path format pulled from https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
DEVELOPER_DIR: /Applications/Xcode_26.0.1.app
DEVELOPER_DIR: /Applications/Xcode_26.0.app
jobs:
build_and_test:
@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
# Add additional Xcode versions here if necessary.
xcode: ["Xcode_26.0.1", "Xcode_16.4"]
xcode: ["Xcode_26.0", "Xcode_16.4"]
steps:
- name: Set Xcode version
@ -43,10 +43,10 @@ jobs:
- name: Check Xcode version
if: ${{ matrix.xcode != 'Xcode_16.4' }}
run: |
Scripts/check_xcode_version.py
Scripts/check_xcode_version.py --relaxed
- name: Download Metal toolchain
if: ${{ matrix.xcode == 'Xcode_26.0.1' }}
if: ${{ matrix.xcode == 'Xcode_26.0' }}
run: |
xcodebuild -downloadComponent MetalToolchain

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import argparse
import subprocess
@ -14,9 +15,22 @@ def get_expected_version():
return file.read().rstrip()
def without_patch_version(value):
components = value.split(".")
return ".".join(components[:2])
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--relaxed", action="store_true", help="ignore patch version when comparing"
)
ns = parser.parse_args()
actual_version = get_actual_version()
expected_version = get_expected_version()
if ns.relaxed:
actual_version = without_patch_version(actual_version)
expected_version = without_patch_version(expected_version)
if actual_version != expected_version:
print(
f"Youre using {actual_version} but you should be using {expected_version}."