Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions scripts/gha/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,22 @@ def _create_and_boot_simulator(apple_platform, device_name, device_os):

if not device_id:
# download and create device
os.environ["GEM_HOME"] = "$HOME/.gem"
args = ["gem", "install", "xcode-install"]
logging.info("Download xcode-install: %s", " ".join(args))
args = ["brew", "install", "xcodesorg/made/xcodes"]
logging.info("Download xcodes: %s", " ".join(args))
subprocess.run(args=args, check=True)

args = ["xcversion", "simulators", "--install=%s %s" % (apple_platform, device_os)]
# Get the set of available versions for the given Apple platform
args = ["xcodes", "runtimes"]
runtimes = subprocess.run(args=args, capture_output=True, text=True, check=True)
available_versions = re.findall('{0} ([\d|.]+)'.format(apple_platform), runtimes.stdout.strip())
logging.info("Found available versions for %s: %s", apple_platform, ", ".join(available_versions))

# If the requested version is available, use it, otherwise default to the latest
if (device_os not in available_versions):
logging.warning("Unable to find version %s, will fall back to %s", device_os, available_versions[-1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If running in GitHub mode (--ci), print this out in the GitHub warning format to surface it to the overall log.

device_os = available_versions[-1]

args = ["xcodes", "runtimes", "install", "%s %s" % (apple_platform, device_os)]
logging.info("Download simulator: %s", " ".join(args))
subprocess.run(args=args, check=False)

Expand Down