From 062ecd3e0e5fd75d148a0b00d4cb566638ebfc28 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Thu, 20 Nov 2025 10:16:45 -0500 Subject: [PATCH] Xcode 26.2 Beta 2 (#307) * Xcode 26.2 Beta 2 Plus wait for simulators to become available. * Update expected runtimes for Xcode 26.2 Beta 2 * Try to wait an hour * Cleanup LLM generated script * Add `exex-script.pkr.hcl` template and adjust simulator wait logic * Finalize * Fixed script name * Fixed typo * Use scrript option. --- .ci/cirrus.runner.yml | 10 ++++- data/expected.tahoe.runtimes.txt | 8 ++-- scripts/finalize-tahoe.sh | 72 ++++++++++++++++++++++++++++++++ templates/exex-script.pkr.hcl | 39 +++++++++++++++++ templates/xcode.pkr.hcl | 18 -------- 5 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 scripts/finalize-tahoe.sh create mode 100644 templates/exex-script.pkr.hcl diff --git a/.ci/cirrus.runner.yml b/.ci/cirrus.runner.yml index 67b6c26..7c2450e 100644 --- a/.ci/cirrus.runner.yml +++ b/.ci/cirrus.runner.yml @@ -12,7 +12,7 @@ task: XCODE_COMPONENTS: "\"MetalToolchain\"" DISK_SIZE: 400 - MACOS_VERSION: tahoe - XCODE_VERSIONS: "\"26.1.1\",\"26.0.1\",\"26.2-beta\"" + XCODE_VERSIONS: "\"26.1.1\",\"26.0.1\",\"26.2-beta-2\"" XCODE_COMPONENTS: "\"MetalToolchain\"" ADDITIONAL_IOS_BUILDS: "18.6" DISK_SIZE: 290 @@ -30,6 +30,14 @@ task: -var xcode_components="[$XCODE_COMPONENTS]" \ -var expected_runtimes_file="data/expected.$MACOS_VERSION.runtimes.txt" \ templates/xcode.pkr.hcl + finalize_script: | + if [[ -f "scripts/finalize-$MACOS_VERSION.sh" ]]; then + packer build -var vm_name="$MACOS_VERSION-xcode:runner" \ + -var script_path="scripts/finalize-$MACOS_VERSION.sh" \ + templates/exex-script.pkr.hcl + else + echo "Skipping prepare script for $MACOS_VERSION" + fi push_script: | if [[ -z "$CIRRUS_PR" ]]; then tart push "$MACOS_VERSION-xcode:runner" ghcr.io/cirruslabs/macos-runner:$MACOS_VERSION diff --git a/data/expected.tahoe.runtimes.txt b/data/expected.tahoe.runtimes.txt index da62daa..d57e44d 100644 --- a/data/expected.tahoe.runtimes.txt +++ b/data/expected.tahoe.runtimes.txt @@ -2,13 +2,13 @@ iOS 18.6 (18.6 - 22G86) - com.apple.CoreSimulator.SimRuntime.iOS-18-6 iOS 26.0 (26.0.1 - 23A8464) - com.apple.CoreSimulator.SimRuntime.iOS-26-0 iOS 26.1 (26.1 - 23B86) - com.apple.CoreSimulator.SimRuntime.iOS-26-1 -iOS 26.2 (26.2 - 23C5027f) - com.apple.CoreSimulator.SimRuntime.iOS-26-2 +iOS 26.2 (26.2 - 23C5044b) - com.apple.CoreSimulator.SimRuntime.iOS-26-2 tvOS 26.0 (26.0 - 23J352) - com.apple.CoreSimulator.SimRuntime.tvOS-26-0 tvOS 26.1 (26.1 - 23J579) - com.apple.CoreSimulator.SimRuntime.tvOS-26-1 -tvOS 26.2 (26.2 - 23K5029e) - com.apple.CoreSimulator.SimRuntime.tvOS-26-2 +tvOS 26.2 (26.2 - 23K5046a) - com.apple.CoreSimulator.SimRuntime.tvOS-26-2 watchOS 26.0 (26.0 - 23R353) - com.apple.CoreSimulator.SimRuntime.watchOS-26-0 watchOS 26.1 (26.1 - 23S36) - com.apple.CoreSimulator.SimRuntime.watchOS-26-1 -watchOS 26.2 (26.2 - 23S5280e) - com.apple.CoreSimulator.SimRuntime.watchOS-26-2 +watchOS 26.2 (26.2 - 23S5297b) - com.apple.CoreSimulator.SimRuntime.watchOS-26-2 visionOS 26.0 (26.0 - 23M336) - com.apple.CoreSimulator.SimRuntime.xrOS-26-0 visionOS 26.1 (26.1 - 23N47) - com.apple.CoreSimulator.SimRuntime.xrOS-26-1 -visionOS 26.2 (26.2 - 23N5279e) - com.apple.CoreSimulator.SimRuntime.xrOS-26-2 +visionOS 26.2 (26.2 - 23N5296a) - com.apple.CoreSimulator.SimRuntime.xrOS-26-2 diff --git a/scripts/finalize-tahoe.sh b/scripts/finalize-tahoe.sh new file mode 100644 index 0000000..cefef3a --- /dev/null +++ b/scripts/finalize-tahoe.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +source ~/.zprofile + +# Set shell options to enable fail-fast behavior +# +# * -e: fail the script when an error occurs or command fails +# * -u: fail the script when attempting to reference unset parameters +# * -o pipefail: by default an exit status of a pipeline is that of its +# last command, this fails the pipe early if an error in +# any of its commands occurs +# +set -euo pipefail + +# Wait until `xcrun simctl list devices -v` no longer reports any devices as "unavailable". +# +# Exit codes: +# 0 - Success: no devices are marked as unavailable within the timeout window +# 1 - Failure: timed out waiting for devices to become available +# 2 - Failure: prerequisites missing (e.g., xcrun not found) + +DEFAULT_TIMEOUT_MINUTES=60 +TIMEOUT_MINUTES=${1:-$DEFAULT_TIMEOUT_MINUTES} + +if ! [[ "$TIMEOUT_MINUTES" =~ ^[0-9]+$ ]]; then + echo "[wait-simulators] ERROR: TIMEOUT_MINUTES must be an integer number of minutes (got: '$TIMEOUT_MINUTES')." >&2 + exit 2 +fi + +SECONDS_TOTAL=$(( TIMEOUT_MINUTES * 60 )) +DEADLINE=$(( $(date +%s) + SECONDS_TOTAL )) +SLEEP_SECONDS=15 + +# Print a one-line status snapshot of current unavailable devices (if any) +print_status() { + if xcrun simctl list devices -v | grep -qi "unavailable"; then + echo "[wait-simulators] Still seeing 'unavailable' devices at $(date '+%Y-%m-%d %H:%M:%S')" + # Show a concise list of unavailable lines for debugging + xcrun simctl list devices -v | grep -i "unavailable" | sed 's/^/[wait-simulators] /' + else + echo "[wait-simulators] No 'unavailable' devices detected at $(date '+%Y-%m-%d %H:%M:%S')" + fi +} + +trap 'echo "[wait-simulators] Interrupted" >&2; exit 130' INT TERM + +echo "[wait-simulators] Waiting up to ${TIMEOUT_MINUTES} minute(s) for simulators to become available..." + +while true; do + if ! xcrun simctl list devices -v | grep -qi "unavailable"; then + echo "[wait-simulators] All simulators are available." + exit 0 + fi + + NOW=$(date +%s) + if (( NOW >= DEADLINE )); then + echo "[wait-simulators] TIMEOUT after ${TIMEOUT_MINUTES} minute(s). Some simulators remain 'unavailable'." >&2 + echo "[wait-simulators] Final snapshot of unavailable devices:" >&2 + xcrun simctl list devices -v | grep -i "unavailable" | sed 's/^/[wait-simulators] /' >&2 + exit 1 + fi + + print_status + REMAIN=$(( DEADLINE - NOW )) + # Sleep in chunks to allow quicker exit when they become available + SLEEP=$SLEEP_SECONDS + if (( REMAIN < SLEEP_SECONDS )); then SLEEP=$REMAIN; fi + sleep "$SLEEP" + # Loop and re-check +done + + diff --git a/templates/exex-script.pkr.hcl b/templates/exex-script.pkr.hcl new file mode 100644 index 0000000..fa4a631 --- /dev/null +++ b/templates/exex-script.pkr.hcl @@ -0,0 +1,39 @@ +packer { + required_plugins { + tart = { + version = ">= 1.12.0" + source = "github.com/cirruslabs/tart" + } + } +} + +variable "vm_name" { + type = string +} + +variable "script_path" { + type = string + description = "Path to a local script that should be uploaded and executed inside the VM." +} + +variable "pause_before" { + type = string + default = "60s" + description = "How long Packer should wait before running the uploaded script." +} + +source "tart-cli" "tart" { + vm_name = "${var.vm_name}" + ssh_password = "admin" + ssh_username = "admin" + ssh_timeout = "120s" +} + +build { + sources = ["source.tart-cli.tart"] + + provisioner "shell" { + script = var.script_path + pause_before = var.pause_before + } +} diff --git a/templates/xcode.pkr.hcl b/templates/xcode.pkr.hcl index ecb7125..a42297c 100644 --- a/templates/xcode.pkr.hcl +++ b/templates/xcode.pkr.hcl @@ -341,30 +341,12 @@ build { # # [1]: https://apple.stackexchange.com/questions/412101/update-dyld-sim-shared-cache-is-taking-up-a-lot-of-memory # [2]: https://stackoverflow.com/a/68394101/9316533 - provisioner "shell" { - inline = [ - "source ~/.zprofile", - "xcrun simctl runtime dyld_shared_cache update --all || sleep 180", - "xcrun simctl list -v", - ] - } - - // Restart the VM - provisioner "shell" { - inline = [ - "sudo shutdown -r now" - ] - expect_disconnect = true - } - - // Wait for VM to come back up and run simctl commands again provisioner "shell" { inline = [ "source ~/.zprofile", "xcrun simctl runtime dyld_shared_cache update --all || sleep 180", "xcrun simctl list -v" ] - pause_before = "60s" } # Compatibility with GitHub Actions Runner Images, where