Skip to content

Fixes

Fixes #3

Workflow file for this run

name: Test Swift Package on iOS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test Swift 6.0 on iOS (${{ matrix.config }})
runs-on: macos-latest # iOS testing requires macOS
strategy:
matrix:
config: [debug, release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Select Xcode (latest)
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'
- name: Setup Swift 6.0
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '6.0' # Use quotes to ensure correct version parsing
- name: Check Swift version
run: swift --version
- name: Find an iOS Simulator
id: find_simulator
run: |
# Find an available iOS simulator runtime and device
RUNTIME_ID=$(xcrun simctl list runtimes ios --json | jq -r '.runtimes[0].identifier')
if [ -z "$RUNTIME_ID" ] || [ "$RUNTIME_ID" == "null" ]; then
echo "::error::No iOS runtime found."
exit 1
fi
DEVICE_ID=$(xcrun simctl list devices --json | jq -r --arg RT_ID "$RUNTIME_ID" '.devices[$RT_ID] | map(select(.isAvailable)) | .[0].udid')
if [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" == "null" ]; then
echo "::error::No available iOS simulator device found for runtime $RUNTIME_ID."
exit 1
fi
echo "Found iOS Simulator Runtime: $RUNTIME_ID"
echo "Found iOS Simulator Device UDID: $DEVICE_ID"
echo "SIMULATOR_DESTINATION=platform=iOS Simulator,id=$DEVICE_ID" >> $GITHUB_OUTPUT
- name: Build and Test (${{ matrix.config }})
run: |
echo "Using simulator destination: ${{ steps.find_simulator.outputs.SIMULATOR_DESTINATION }}"
xcodebuild build -scheme NotchMyProblem -sdk $(xcrun --sdk iphonesimulator --show-sdk-path) -destination "${{ steps.find_simulator.outputs.SIMULATOR_DESTINATION }}" SWIFT_VERSION=6.0