Skip to content

Commit b5e73a4

Browse files
committed
Compile for Android on CI
1 parent a3f634d commit b5e73a4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- '*'
10+
workflow_dispatch:
1011

1112
concurrency:
1213
group: ci-${{ github.ref }}
@@ -139,3 +140,47 @@ jobs:
139140
run: swift build -c ${{ matrix.config }}
140141
- name: Run tests (debug only)
141142
run: swift test
143+
144+
android:
145+
name: Android (Swift 6.0.2)
146+
runs-on: ubuntu-22.04
147+
steps:
148+
- name: Checkout Repository
149+
uses: actions/checkout@v4
150+
- name: Install Swift
151+
uses: tayloraswift/swift-install-action@master
152+
with:
153+
swift-prefix: swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE
154+
swift-id: swift-6.0.2-RELEASE-ubuntu22.04
155+
- name: Check Swift
156+
run: swift --version
157+
- name: Install Android SDK
158+
run:
159+
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
160+
- name: Check Android SDK
161+
run:
162+
swift sdk configure --show-configuration swift-6.0.2-RELEASE-android-24-0.1 x86_64-unknown-linux-android24
163+
- name: Build Tests
164+
run:
165+
swift build --build-tests --swift-sdk x86_64-unknown-linux-android24 -Xswiftc -Xclang-linker -Xswiftc -fuse-ld=lld
166+
- name: Prepare Android Emulator Test Script
167+
run: |
168+
mkdir pack
169+
cp .build/x86_64-unknown-linux-android24/debug/xctest-dynamic-overlayPackageTests.xctest pack
170+
171+
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
172+
rm pack/lib{c,dl,log,m,z}.so
173+
174+
set -x
175+
cat > ~/test-toolchain.sh << EOF
176+
adb push pack /data/local/tmp
177+
adb shell /data/local/tmp/pack/xctest-dynamic-overlayPackageTests.xctest
178+
EOF
179+
180+
chmod +x ~/test-toolchain.sh
181+
- name: Run Tests on Android Emulator
182+
uses: reactivecircus/android-emulator-runner@v2
183+
with:
184+
api-level: 29
185+
arch: x86_64
186+
script: ~/test-toolchain.sh

0 commit comments

Comments
 (0)