Skip to content

Commit 889117d

Browse files
committed
Add iOS build/test CI job and set TARGET_OS_ANDROID for the Android build
The iOS job builds for the simulator platform and runs the test suite against a dynamically selected available iPhone simulator, so it doesn't depend on any particular simulator name existing on the runner image. The Android job now exports TARGET_OS_ANDROID=1 so Package.swift picks the embedded SQLite trait.
1 parent 0064457 commit 889117d

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

‎.github/workflows/swift.yml‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,34 @@ jobs:
7171
ANDROID_NDK_HOME="$ANDROID_HOME/ndk/${{ env.ANDROID_NDK_VERSION }}" \
7272
bash "$HOME/Library/org.swift.swiftpm/swift-sdks/swift-${{ env.SWIFT_VERSION }}-RELEASE_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh"
7373
- name: Build
74-
run: swift build --swift-sdk aarch64-unknown-linux-android28 -c ${{ matrix.config }}
74+
run: TARGET_OS_ANDROID=1 swift build --swift-sdk aarch64-unknown-linux-android28 -c ${{ matrix.config }}
75+
76+
ios:
77+
name: iOS
78+
runs-on: macos-26
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
config: ["debug", "release"]
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
- name: Select Simulator
87+
run: |
88+
DEVICE_ID=$(xcrun simctl list devices available -j | python3 -c "import json,sys; d=json.load(sys.stdin)['devices']; devices=[v for vs in d.values() for v in vs if 'iPhone' in v['name']]; print(devices[0]['udid'])")
89+
echo "DEVICE_ID=${DEVICE_ID}" >> "$GITHUB_ENV"
90+
- name: Build
91+
run: >
92+
xcodebuild build -scheme CoreModel-SQLite
93+
-destination "generic/platform=iOS Simulator"
94+
-configuration ${{ matrix.config == 'release' && 'Release' || 'Debug' }}
95+
-skipMacroValidation -skipPackagePluginValidation
96+
- name: Test
97+
run: >
98+
xcodebuild test -scheme CoreModel-SQLite
99+
-destination "id=${{ env.DEVICE_ID }}"
100+
-configuration ${{ matrix.config == 'release' && 'Release' || 'Debug' }}
101+
-skipMacroValidation -skipPackagePluginValidation
75102
76103
android-test:
77104
name: Android Test

0 commit comments

Comments
 (0)