Skip to content

Commit cb2230b

Browse files
committed
Update build.yml
1 parent 78cb080 commit cb2230b

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,23 @@ jobs:
7676
7777
echo "Using scheme: $SCHEME"
7878
79-
# 선택된 iOS 런타임에서 'iPhone'이 포함된 첫 번째 시뮬레이터 이름 선택
80-
DEVICE_NAME=$(xcrun simctl list devices available | awk -v ver="$IOS_VER" '
81-
$0 ~ "^== iOS " ver "(\\.[0-9]+)* ==" {flag=1; next}
82-
$0 ~ "^== " {flag=0}
83-
flag && $0 ~ /^[[:space:]]/ && $0 ~ /iPhone/ {
84-
sub(/^[[:space:]]+/, "", $0)
85-
gsub(/ \(.*/, "", $0)
86-
print $0
87-
exit
88-
}
89-
')
79+
# 선택된 iOS 런타임에서 'iPhone'이 포함된 첫 번째 시뮬레이터 이름 선택 (JSON 파싱)
80+
DEVICE_NAME=$(python3 - <<'PY'
81+
import json, os, subprocess, sys
82+
ios_ver = os.environ['IOS_VER']
83+
prefix = f"com.apple.CoreSimulator.SimRuntime.iOS-{ios_ver.replace('.', '-') }"
84+
data = subprocess.check_output(["xcrun", "simctl", "list", "devices", "available", "-j"], text=True)
85+
j = json.loads(data)
86+
for runtime, devices in j.get("devices", {}).items():
87+
if not runtime.startswith(prefix):
88+
continue
89+
for d in devices:
90+
if d.get("isAvailable") and "iPhone" in d.get("name", ""):
91+
print(d["name"])
92+
sys.exit(0)
93+
sys.exit(1)
94+
PY
95+
)
9096
9197
if [ -z "${DEVICE_NAME:-}" ]; then
9298
echo "No available simulator device found for iOS ${IOS_VER}." >&2

0 commit comments

Comments
 (0)