Skip to content

Commit 7256c6f

Browse files
committed
Update build.yml
1 parent e8f694c commit 7256c6f

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,34 @@ jobs:
7373
IOS_VER="${{ steps.pick_ios.outputs.ios_version }}"
7474
7575
xcodebuild -version
76-
ls -la
7776
7877
echo "Using scheme: $SCHEME"
7978
79+
# 선택된 iOS 런타임에서 'iPhone'이 포함된 첫 번째 시뮬레이터 이름 선택
80+
DEVICE_NAME=$(xcrun simctl list devices available | awk -v ver="$IOS_VER" '
81+
$0 ~ "^== iOS " ver " ==" {in=1; next}
82+
$0 ~ "^== " {in=0}
83+
in && $0 ~ /^[[:space:]]/ && $0 ~ /iPhone/ {
84+
sub(/^[[:space:]]+/, "", $0)
85+
gsub(/ \(.*/, "", $0)
86+
print $0
87+
exit
88+
}
89+
')
90+
91+
if [ -z "${DEVICE_NAME:-}" ]; then
92+
echo "No available simulator device found for iOS ${IOS_VER}." >&2
93+
exit 1
94+
fi
95+
96+
echo "Using simulator: $DEVICE_NAME (iOS ${IOS_VER})"
97+
8098
# 예시: 시뮬레이터 대상으로 빌드/테스트 시 destination에서 OS 지정
8199
set -o pipefail
82100
xcodebuild \
83101
-scheme "$SCHEME" \
84102
-configuration Debug \
85-
-destination "platform=iOS Simulator,OS=${IOS_VER},name=iPhone 14" \
103+
-destination "platform=iOS Simulator,OS=${IOS_VER},name=${DEVICE_NAME}" \
86104
-showBuildTimingSummary \
87105
build \
88106
| cat

0 commit comments

Comments
 (0)