@@ -121,50 +121,12 @@ jobs:
121121 name : Build (Android)
122122 runs-on : ubuntu-latest
123123 timeout-minutes : 30
124- # Cross-compiles SwiftTimecodeCore for Android (aarch64) using the Swift.org Android SDK
125- # bundle. Requires the open-source Swift 6.3 toolchain (NOT Xcode's bundled Swift) and the
126- # Android Swift SDK artifact bundle, which provides the cross-compiled stdlib + Foundation
127- # for android28+. Tests are not executed (would require a device/emulator); the build alone
128- # is enough to catch missing canImport(Android) arms or unconditional Apple-only imports.
124+ env :
125+ TARGET_TRIPLE : aarch64-unknown-linux-android28
129126 steps :
130127 - uses : actions/checkout@main
131- - name : Install Swift 6.3 toolchain (open-source)
132- # Pinned to "6.3.0" rather than the floating "6.3" — the Android SDK artifactbundle
133- # (also pinned to 6.3-RELEASE) ships pre-built `.swiftmodule` files which can ONLY
134- # be loaded by the exact same compiler version. With "6.3" floating, swiftly picks
135- # up 6.3.1 once it's released, and CI breaks with:
136- # "module compiled with Swift 6.3 cannot be imported by the Swift 6.3.1 compiler"
137- # Bump this in lockstep when a 6.3.1 (or 6.4) Android SDK bundle is published.
138- uses : vapor/swiftly-action@v0.2
128+ - uses : orchetect/setup-swift-android-sdk@v1
139129 with :
140- toolchain : " 6.3.0"
141- - name : Install Android NDK r27d
142- # `swift sdk install` only fetches the Swift-side stdlib + Foundation for Android.
143- # The NDK supplies the C sysroot (libc, libm, semaphore.h, …) that the SwiftOverlayShims
144- # C module needs to compile. Without these the cross-compile errors with
145- # 'semaphore.h' file not found … could not build C module 'SwiftOverlayShims'
146- # mid-build. r27d matches the swift-6.3-RELEASE Android SDK bundle's expected NDK
147- # version — bump in lockstep with the SDK URL above.
148- run : |
149- wget -q "https://dl.google.com/android/repository/android-ndk-r27d-linux.zip" -O /tmp/ndk.zip
150- unzip -q /tmp/ndk.zip -d /opt
151- echo "ANDROID_NDK_HOME=/opt/android-ndk-r27d" >> "$GITHUB_ENV"
152- - name : Install Android Swift SDK
153- run : |
154- swift sdk install \
155- https://download.swift.org/swift-6.3-release/android-sdk/swift-6.3-RELEASE/swift-6.3-RELEASE_android.artifactbundle.tar.gz \
156- --checksum 2f2942c4bcea7965a08665206212c66991dabe23725aeec7c4365fc91acad088
157- # The bundle ships a setup script that wires NDK_HOME paths into the SDK's
158- # destination JSON. Without running it, the compiler can find the Swift
159- # stdlib but not the NDK's C headers — yielding the SwiftOverlayShims error.
160- # On ubuntu-latest runners the bundle lands under ~/.config/swiftpm/swift-sdks/
161- # (vs. ~/.swiftpm/swift-sdks/ in containerised runs).
162- SETUP_SCRIPT=$(find "$HOME/.config/swiftpm/swift-sdks" "$HOME/.swiftpm/swift-sdks" -name "setup-android-sdk.sh" 2>/dev/null | head -1)
163- if [ -z "$SETUP_SCRIPT" ]; then
164- echo "setup-android-sdk.sh not found. Searched paths:"
165- find "$HOME/.config/swiftpm" "$HOME/.swiftpm" 2>/dev/null | head -20
166- exit 1
167- fi
168- bash "$SETUP_SCRIPT"
169- - name : Build for Android (aarch64)
170- run : swift build --target SwiftTimecodeCore --swift-sdk aarch64-unknown-linux-android28
130+ target-triple : ${{ env.TARGET_TRIPLE }}
131+ - name : Build
132+ run : swift build --swift-sdk "$TARGET_TRIPLE" --static-swift-stdlib
0 commit comments