Skip to content

Commit 85719e3

Browse files
committed
Add Android Swift SDK cross-build CI job
Adds a Linux-container job that installs the official swift-6.3.2-RELEASE_android Swift SDK, sets up the Android NDK (r27d) via the SDK's setup-android-sdk.sh script, and cross-compiles for aarch64-unknown-linux-android28 and x86_64-unknown-linux-android28 using swift build --swift-sdk <triple> --static-swift-stdlib, as documented at swift.org/documentation/articles/swift-sdk-for-android-getting-started.html. This complements the existing Skip-toolchain-based Android job.
1 parent 2cfe061 commit 85719e3

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

‎.github/workflows/swift.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,41 @@ jobs:
5555
brew install skiptools/skip/skip || (brew update && brew install skiptools/skip/skip)
5656
skip android sdk install --version ${{ matrix.swift }}
5757
ANDROID_NDK_ROOT="" skip android build --arch ${{ matrix.arch }}
58+
59+
android-sdk:
60+
name: Android (Swift SDK, ${{ matrix.triple }})
61+
runs-on: ubuntu-latest
62+
container: swift:6.3.2
63+
timeout-minutes: 30
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
triple: ["aarch64-unknown-linux-android28", "x86_64-unknown-linux-android28"]
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
- name: Swift Version
72+
run: swift --version
73+
- name: Install dependencies
74+
run: apt-get update -y && apt-get install -y curl unzip
75+
- name: Install Android Swift SDK
76+
run: |
77+
set -eux
78+
url="https://download.swift.org/swift-6.3.2-release/android-sdk/swift-6.3.2-RELEASE/swift-6.3.2-RELEASE_android.artifactbundle.tar.gz"
79+
curl -fsSL "$url" -o android.artifactbundle.tar.gz
80+
swift sdk install android.artifactbundle.tar.gz
81+
swift sdk list
82+
- name: Install and configure the Android NDK
83+
run: |
84+
set -eux
85+
unset ANDROID_NDK_ROOT
86+
cd ~/.swiftpm/swift-sdks/swift-6.3.2-RELEASE_android.artifactbundle/swift-android/
87+
curl -fSL -o ndk.zip "https://dl.google.com/android/repository/android-ndk-r27d-Linux.zip"
88+
unzip -qo ndk.zip
89+
echo "ANDROID_NDK_HOME=$PWD/android-ndk-r27d" >> "$GITHUB_ENV"
90+
ANDROID_NDK_HOME="$PWD/android-ndk-r27d" ./scripts/setup-android-sdk.sh
91+
- name: Build
92+
run: |
93+
set -eux
94+
unset ANDROID_NDK_ROOT
95+
swift build --swift-sdk ${{ matrix.triple }} --static-swift-stdlib

0 commit comments

Comments
 (0)