-
Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathaction.yml
More file actions
54 lines (45 loc) · 1.72 KB
/
Copy pathaction.yml
File metadata and controls
54 lines (45 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 'Install Simulators if Needed'
description: 'Downloads and installs simulator runtimes for non-default Xcode versions'
inputs:
xcode_version:
description: 'The Xcode version being used'
required: true
type: string
platform:
description: 'The platform to install simulators for'
required: true
type: string
runs:
using: "composite"
steps:
- name: Install Simulators if Needed
shell: bash
run: |
XCODE_VERSION="${{ inputs.xcode_version }}"
PLATFORM="${{ inputs.platform }}"
DEFAULT_XCODE_VERSION="26.5"
# Skip for macOS as it doesn't need simulators
if [[ "$PLATFORM" == "macOS" ]]; then
echo "macOS doesn't need simulator downloads"
exit 0
fi
# Skip for the default Xcode version — simulators are pre-installed
if [[ "$XCODE_VERSION" == "$DEFAULT_XCODE_VERSION" ]]; then
echo "Using default Xcode ${DEFAULT_XCODE_VERSION}, simulators are pre-installed"
exit 0
fi
# Switch to the target Xcode version
XCODE_PATH="/Applications/Xcode_${XCODE_VERSION}.app"
if [[ ! -d "$XCODE_PATH" ]]; then
echo "Xcode not found at $XCODE_PATH"
exit 1
fi
echo "Switching to Xcode ${XCODE_VERSION}..."
sudo xcode-select -switch "${XCODE_PATH}/Contents/Developer"
xcodebuild -version
echo "Simulators before download:"
xcrun simctl list runtimes || true
echo "Downloading $PLATFORM runtime for Xcode ${XCODE_VERSION}..."
sudo xcodebuild -downloadPlatform "$PLATFORM" || echo "Failed to download $PLATFORM platform"
echo "Simulators after download:"
xcrun simctl list runtimes || true