From 322d9ffeeba85c9f7c4984b39422ec7cc3c56597 Mon Sep 17 00:00:00 2001 From: Johan Kool Date: Mon, 9 Dec 2024 19:15:14 +0100 Subject: [PATCH] Android support (#80) * Need newer version than swift-collections-benchmark specifies to compile for Android * Compile for Android on CI --- .github/workflows/ci.yml | 45 +++++++++++++++++ Package.resolved | 106 +++++++++++++++++++++------------------ 2 files changed, 102 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d93373..9832c50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - '*' + workflow_dispatch: jobs: build: @@ -53,3 +54,47 @@ jobs: - name: Run tests (debug only) if: ${{ matrix.config == 'debug' }} run: swift test + + android: + name: Android (Swift 6.0.2) + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Install Swift + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE" + swift-id: "swift-6.0.2-RELEASE-ubuntu22.04" + - name: Check Swift + run: swift --version + - name: Install Android SDK + run: + swift sdk install https://github.com/finagolfin/swift-android-sdk/releases/download/6.0.2/swift-6.0.2-RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum d75615eac3e614131133c7cc2076b0b8fb4327d89dce802c25cd53e75e1881f4 + - name: Check Android SDK + run: + swift sdk configure --show-configuration swift-6.0.2-RELEASE-android-24-0.1 x86_64-unknown-linux-android24 + - name: Build Tests + run: + OMIT_MACRO_TESTS=1 swift build --build-tests --swift-sdk x86_64-unknown-linux-android24 -Xswiftc -Xclang-linker -Xswiftc -fuse-ld=lld + - name: Prepare Android Emulator Test Script + run: | + mkdir pack + cp .build/x86_64-unknown-linux-android24/debug/swift-identified-collectionsPackageTests.xctest pack + + cp /home/runner/.config/swiftpm/swift-sdks/swift-6.0.2-RELEASE-android-24-0.1.artifactbundle/swift-6.0.2-release-android-24-sdk/android-27c-sysroot/usr/lib/x86_64-linux-android/24/lib*.so pack + rm pack/lib{c,dl,log,m,z}.so + + set -x + cat > ~/test-toolchain.sh << EOF + adb push pack /data/local/tmp + adb shell /data/local/tmp/pack/swift-identified-collectionsPackageTests.xctest + EOF + + chmod +x ~/test-toolchain.sh + - name: Run Tests on Android Emulator + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 29 + arch: x86_64 + script: ~/test-toolchain.sh \ No newline at end of file diff --git a/Package.resolved b/Package.resolved index 7c3079f..f5196e5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,52 +1,60 @@ { - "object": { - "pins": [ - { - "package": "swift-argument-parser", - "repositoryURL": "https://github.com/apple/swift-argument-parser", - "state": { - "branch": null, - "revision": "9f39744e025c7d377987f30b03770805dcb0bcd1", - "version": "1.1.4" - } - }, - { - "package": "swift-collections", - "repositoryURL": "https://github.com/apple/swift-collections", - "state": { - "branch": null, - "revision": "f504716c27d2e5d4144fa4794b12129301d17729", - "version": "1.0.3" - } - }, - { - "package": "swift-collections-benchmark", - "repositoryURL": "https://github.com/apple/swift-collections-benchmark", - "state": { - "branch": null, - "revision": "e8b88af0d678eacd65da84e99ccc1f0f402e9a97", - "version": "0.0.3" - } - }, - { - "package": "SwiftDocCPlugin", - "repositoryURL": "https://github.com/apple/swift-docc-plugin", - "state": { - "branch": null, - "revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6", - "version": "1.0.0" - } - }, - { - "package": "swift-system", - "repositoryURL": "https://github.com/apple/swift-system", - "state": { - "branch": null, - "revision": "025bcb1165deab2e20d4eaba79967ce73013f496", - "version": "1.2.1" - } + "originHash" : "38b71f86fd41a82358743f4f48fd130326986d1dd93baccd398525a4ac8196fd", + "pins" : [ + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "41982a3656a71c768319979febd796c6fd111d5c", + "version" : "1.5.0" } - ] - }, - "version": 1 + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections", + "state" : { + "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7", + "version" : "1.1.4" + } + }, + { + "identity" : "swift-collections-benchmark", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections-benchmark", + "state" : { + "revision" : "e8b88af0d678eacd65da84e99ccc1f0f402e9a97", + "version" : "0.0.3" + } + }, + { + "identity" : "swift-docc-plugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-plugin", + "state" : { + "revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64", + "version" : "1.4.3" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", + "version" : "1.0.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system", + "state" : { + "revision" : "c8a44d836fe7913603e246acab7c528c2e780168", + "version" : "1.4.0" + } + } + ], + "version" : 3 }