From 13df9def26d79f9b9b926fa34303a81868810bcd Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Fri, 1 May 2026 12:33:57 +0200 Subject: [PATCH 1/3] ci: add Android cross-compile job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cross-compiles for aarch64 and x86_64 against android28 using the official Swift 6.3.1 Android SDK bundle. No on-device test run — the build alone catches the usual Darwin-only / Foundation drift. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/swift.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9736ac6..89fce04 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -107,3 +107,38 @@ jobs: run: swift build --build-tests -v - name: Test (Windows) run: swift test -v --skip-build + + # Cross-compile only — there's no Android runner, and emulating an + # Android device on a GitHub runner to actually run the tests is out + # of scope for now. A clean cross-build is enough to catch the usual + # Darwin-only / Foundation-on-Linux drift before it reaches users. + # See https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html + build-android: + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + arch: [aarch64, x86_64] + container: + image: swift:6.3-jammy + steps: + - uses: actions/checkout@v6 + - name: Verify Swift version + run: swift --version + # The official Android Swift SDK bundle ships matched to a single + # toolchain release. Keep the URL + checksum pinned to the same + # 6.3.1 release the host swift:6.3-jammy image carries; if the + # base image is bumped, bump these together. + - name: Install Swift SDK for Android + run: | + swift sdk install \ + https://download.swift.org/swift-6.3.1-release/android-sdk/swift-6.3.1-RELEASE/swift-6.3.1-RELEASE_android.artifactbundle.tar.gz \ + --checksum 8193a4e96538635131a154736c8896fba0e5a1c30e065524f00ed78719bac35a + swift sdk list + - name: Build (Android ${{ matrix.arch }}) + run: | + swift build \ + --swift-sdk ${{ matrix.arch }}-unknown-linux-android28 \ + --build-tests \ + -v From 9c4d07cb160ee7c86a5d3bf0e5eac58a078c60bc Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Fri, 1 May 2026 12:37:53 +0200 Subject: [PATCH 2/3] ci: switch Android job to skiptools/swift-android-action Replaces the hand-rolled swift sdk install + NDK download with the skiptools/swift-android-action, which wraps the same SDK setup AND runs the SwiftPM test suite on an x86_64 Android emulator. Drops the container/matrix because the emulator step needs nested KVM on the bare ubuntu-* runner image. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/swift.yml | 43 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 89fce04..eaacd1b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -108,37 +108,20 @@ jobs: - name: Test (Windows) run: swift test -v --skip-build - # Cross-compile only — there's no Android runner, and emulating an - # Android device on a GitHub runner to actually run the tests is out - # of scope for now. A clean cross-build is enough to catch the usual - # Darwin-only / Foundation-on-Linux drift before it reaches users. - # See https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html + # Uses skiptools/swift-android-action which wraps the swift.org Android + # SDK setup AND runs the SwiftPM tests on an x86_64 Android emulator. + # No `container:` here — the action provisions its own toolchain and + # the emulator setup needs nested KVM, which only works on the bare + # ubuntu-* runner image. build-android: runs-on: ubuntu-latest - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - arch: [aarch64, x86_64] - container: - image: swift:6.3-jammy + timeout-minutes: 45 steps: - uses: actions/checkout@v6 - - name: Verify Swift version - run: swift --version - # The official Android Swift SDK bundle ships matched to a single - # toolchain release. Keep the URL + checksum pinned to the same - # 6.3.1 release the host swift:6.3-jammy image carries; if the - # base image is bumped, bump these together. - - name: Install Swift SDK for Android - run: | - swift sdk install \ - https://download.swift.org/swift-6.3.1-release/android-sdk/swift-6.3.1-RELEASE/swift-6.3.1-RELEASE_android.artifactbundle.tar.gz \ - --checksum 8193a4e96538635131a154736c8896fba0e5a1c30e065524f00ed78719bac35a - swift sdk list - - name: Build (Android ${{ matrix.arch }}) - run: | - swift build \ - --swift-sdk ${{ matrix.arch }}-unknown-linux-android28 \ - --build-tests \ - -v + - name: Build & test (Android emulator) + uses: skiptools/swift-android-action@v2 + with: + swift-version: "6.3" + # The default GitHub Linux runner has ~14 GiB free; the SDK, + # NDK, and emulator together push past that without cleanup. + free-disk-space: true From 73c040faa9fbefd7744e209d2b1ae1a2d9c89eaf Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Fri, 1 May 2026 13:58:15 +0200 Subject: [PATCH 3/3] ci: split Android job into separate build and test steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the other platforms' pattern — invokes skiptools/swift-android-action twice, once with run-tests:false to build, and once with build-package:false / build-tests:false to run the emulator tests. The second invocation hits the SDK/NDK/AVD caches populated by the first. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/swift.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index eaacd1b..b0706e2 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -113,15 +113,27 @@ jobs: # No `container:` here — the action provisions its own toolchain and # the emulator setup needs nested KVM, which only works on the bare # ubuntu-* runner image. + # + # Split into two action invocations to surface build vs. test timing + # separately in the Actions UI (mirrors the other platforms' pattern). + # The second invocation reuses the SDK + NDK + AVD caches the first + # populated, so the marginal cost is just the emulator boot + tests. build-android: runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: actions/checkout@v6 - - name: Build & test (Android emulator) + - name: Build (Android) uses: skiptools/swift-android-action@v2 with: swift-version: "6.3" # The default GitHub Linux runner has ~14 GiB free; the SDK, # NDK, and emulator together push past that without cleanup. free-disk-space: true + run-tests: false + - name: Test (Android emulator) + uses: skiptools/swift-android-action@v2 + with: + swift-version: "6.3" + build-package: false + build-tests: false