diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 00b313d..84fc50d 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -30,7 +30,7 @@ jobs: - name: Choose available iPhone simulator run: | xcrun simctl list devices available --json > /tmp/musicbridge-simulators.json - python3 tools/select_simulator.py /tmp/musicbridge-simulators.json >> "$GITHUB_ENV" + python3 tools/select_simulator.py /tmp/musicbridge-simulators.json "$(xcrun --sdk iphonesimulator --show-sdk-version)" >> "$GITHUB_ENV" - name: Build and run XCTest shell: bash run: | diff --git a/tools/select_simulator.py b/tools/select_simulator.py index f198cda..5d35e25 100644 --- a/tools/select_simulator.py +++ b/tools/select_simulator.py @@ -5,11 +5,13 @@ import uuid with open(sys.argv[1], encoding="utf-8") as stream: runtimes = json.load(stream)["devices"] +sdk_version = sys.argv[2] if len(sys.argv) > 2 else None for runtime in sorted(runtimes, reverse=True): - if ".iOS-" not in runtime: + if ".iOS-" not in runtime or (sdk_version and not runtime.endswith(".iOS-" + sdk_version.replace(".", "-"))): continue for device in runtimes[runtime]: if device.get("isAvailable") and device.get("name", "").startswith("iPhone"): - print("SIMULATOR_ID=" + str(uuid.UUID(device["udid"]))) + uuid.UUID(device["udid"]) # Validate without changing the case expected by xcodebuild. + print("SIMULATOR_ID=" + device["udid"]) sys.exit(0) sys.exit("No available iPhone simulator in selected Xcode runtime.")