Skip to content

Commit ef94dab

Browse files
committed
Add Android build job to CI
Installs the matching NDK and Swift Android SDK artifact bundle on a macOS runner, then builds debug and release for aarch64-android.
1 parent 6890be2 commit ef94dab

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/swift.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,32 @@ jobs:
3737
run: swift build -c ${{ matrix.config }}
3838
- name: Test
3939
run: swift test -c ${{ matrix.config }}
40+
41+
android:
42+
name: Android
43+
runs-on: macos-15
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
config: ["debug", "release"]
48+
env:
49+
SWIFT_VERSION: "6.3.2"
50+
ANDROID_NDK_VERSION: "27.2.12479018"
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
- name: Install Swift
55+
uses: swift-actions/setup-swift@v2
56+
with:
57+
swift-version: ${{ env.SWIFT_VERSION }}
58+
- name: Install Android NDK
59+
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ env.ANDROID_NDK_VERSION }}"
60+
- name: Install Swift SDK for Android
61+
run: |
62+
curl -L -o android-sdk.artifactbundle.tar.gz "https://download.swift.org/swift-${{ env.SWIFT_VERSION }}-release/android-sdk/swift-${{ env.SWIFT_VERSION }}-RELEASE/swift-${{ env.SWIFT_VERSION }}-RELEASE_android.artifactbundle.tar.gz"
63+
CHECKSUM=$(swift package compute-checksum android-sdk.artifactbundle.tar.gz)
64+
swift sdk install android-sdk.artifactbundle.tar.gz --checksum "$CHECKSUM"
65+
ANDROID_NDK_HOME="$ANDROID_HOME/ndk/${{ env.ANDROID_NDK_VERSION }}" \
66+
bash "$HOME/Library/org.swift.swiftpm/swift-sdks/swift-${{ env.SWIFT_VERSION }}-RELEASE_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh"
67+
- name: Build
68+
run: swift build --swift-sdk aarch64-unknown-linux-android28 -c ${{ matrix.config }}

0 commit comments

Comments
 (0)