test: build ci #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: iOS CI | |
| on: | |
| pull_request: | |
| env: | |
| SCHEME: DevLog | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| build: | |
| runs-on: macos-14 # iOS 17 시뮬레이터 런타임 포함 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: latest | |
| - name: Select iOS Simulator Runtime (>= 17.0) | |
| id: pick_ios | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| MIN_IOS="17.0" | |
| # 설치된 iOS Simulator 런타임 버전들 추출 (예: 17.2, 18.0 ...) | |
| # 출력 포맷이 달라질 수 있어, "iOS <version>" 패턴에서 숫자만 뽑습니다. | |
| versions=() | |
| while IFS= read -r v; do | |
| versions+=("$v") | |
| done < <( | |
| xcrun simctl runtime list 2>/dev/null \ | |
| | grep -Eo 'iOS ([0-9]+(\.[0-9]+)?)' \ | |
| | awk '{print $2}' \ | |
| | sort -V \ | |
| | uniq | |
| ) | |
| if [ "${#versions[@]}" -eq 0 ]; then | |
| echo "No iOS simulator runtimes detected." >&2 | |
| exit 1 | |
| fi | |
| # MIN_IOS 이상 중 가장 낮은 버전 선택 (우선 MIN_IOS) | |
| if printf '%s\n' "${versions[@]}" | grep -qx "$MIN_IOS"; then | |
| chosen="$MIN_IOS" | |
| else | |
| chosen=$(printf '%s\n' "${versions[@]}" | awk -v min="$MIN_IOS" '$0+0 >= min+0 {print}' | sort -V | head -n 1 || true) | |
| fi | |
| if [ -z "${chosen:-}" ]; then | |
| echo "No iOS runtime >= ${MIN_IOS} found. Available: ${versions[*]}" >&2 | |
| exit 1 | |
| fi | |
| echo "Detected runtimes: ${versions[*]:-<none>}" | |
| echo "Chosen iOS runtime version: $chosen" | |
| echo "ios_version=$chosen" >> "$GITHUB_OUTPUT" | |
| - name: Build | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| set -x | |
| IOS_VER="${{ steps.pick_ios.outputs.ios_version }}" | |
| xcodebuild -version | |
| echo "Using scheme: $SCHEME" | |
| # 선택된 iOS 런타임에서 'iPhone'이 포함된 첫 번째 시뮬레이터 이름 선택 | |
| DEVICE_NAME=$(xcrun simctl list devices available | awk -v ver="$IOS_VER" ' | |
| $0 ~ "^== iOS " ver " ==" {in=1; next} | |
| $0 ~ "^== " {in=0} | |
| in && $0 ~ /^[[:space:]]/ && $0 ~ /iPhone/ { | |
| sub(/^[[:space:]]+/, "", $0) | |
| gsub(/ \(.*/, "", $0) | |
| print $0 | |
| exit | |
| } | |
| ') | |
| if [ -z "${DEVICE_NAME:-}" ]; then | |
| echo "No available simulator device found for iOS ${IOS_VER}." >&2 | |
| exit 1 | |
| fi | |
| echo "Using simulator: $DEVICE_NAME (iOS ${IOS_VER})" | |
| # 예시: 시뮬레이터 대상으로 빌드/테스트 시 destination에서 OS 지정 | |
| set -o pipefail | |
| xcodebuild \ | |
| -scheme "$SCHEME" \ | |
| -configuration Debug \ | |
| -destination "platform=iOS Simulator,OS=${IOS_VER},name=${DEVICE_NAME}" \ | |
| -showBuildTimingSummary \ | |
| build \ | |
| | cat |