Skip to content

Commit 7d4b8d1

Browse files
committed
Switch CI to run Android x86_64 tests in emulator on macOS, where hardware acceleration is available
1 parent 5a48add commit 7d4b8d1

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/sdks.yml

+26-3
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,42 @@ jobs:
305305
cp sdk-config/swift-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/lib*so pack/lib
306306
cp sdk-config/swift-${{ matrix.version }}*-android-x86_64-*${ANDROID_API_LEVEL}-sdk/usr/lib/swift/android/lib*so pack/lib/swift/android
307307
cp sdk-config/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so pack/lib/swift/android
308-
- name: Run tests on Android x86_64 emulator
308+
cp ~/termux-debug.apk pack
309+
- name: Upload test directory
309310
if: ${{ matrix.arch == 'x86_64' }}
311+
uses: actions/upload-artifact@v2
312+
with:
313+
name: tests-${{ matrix.version }}
314+
path: pack/
315+
retention-days: 3
316+
run-tests-on-android-x86_64-emulator:
317+
runs-on: macos-latest
318+
needs: build-sdk-and-tests
319+
strategy:
320+
fail-fast: false
321+
matrix:
322+
version: [5.4, 5.5, trunk]
323+
steps:
324+
- name: Download test directory
325+
uses: actions/download-artifact@v2
326+
with:
327+
name: tests-${{ matrix.version }}
328+
path: pack
329+
- name: Run tests on Android x86_64 emulator
310330
uses: reactivecircus/android-emulator-runner@v2
311331
with:
312332
api-level: 24
313333
arch: x86_64
314334
script: |
315-
adb install ~/termux-debug.apk
335+
adb install pack/termux-debug.apk
336+
chmod 755 pack/{math,repeat,roll,*.xctest}
316337
adb push pack /data/local/tmp
317338
318339
adb shell /data/local/tmp/pack/swift-argument-parserPackageTests.xctest
319340
adb shell /data/local/tmp/pack/swift-cryptoPackageTests.xctest
320-
if [ ${{ matrix.version }} = '5.4' ]; then adb shell "run-as com.termux cp -r /data/local/tmp/pack /data/data/com.termux/"; fi
341+
if [ ${{ matrix.version }} = '5.4' ]; then adb shell "run-as com.termux mkdir /data/data/com.termux/pack"; fi
342+
if [ ${{ matrix.version }} = '5.4' ]; then adb shell "run-as com.termux cp /data/local/tmp/pack/swift-nioPackageTests.xctest /data/data/com.termux/pack"; fi
343+
if [ ${{ matrix.version }} = '5.4' ]; then adb shell "run-as com.termux cp -r /data/local/tmp/pack/lib /data/data/com.termux/pack"; fi
321344
if [ ${{ matrix.version }} = '5.4' ]; then adb shell "run-as com.termux /data/data/com.termux/pack/swift-nioPackageTests.xctest"; fi
322345
adb shell /data/local/tmp/pack/swift-numericsPackageTests.xctest
323346
adb shell /data/local/tmp/pack/swift-systemPackageTests.xctest

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ You can copy these executables and the SDK to [an emulator or a USB
7878
debugging-enabled device with adb](https://github.com/apple/swift/blob/release/5.4/docs/Android.md#4-deploying-the-build-products-to-the-device),
7979
or put them on an Android device with [a terminal emulator app like Termux](https://termux.com).
8080
I test aarch64 with Termux so I'll show how to run the test runner there, but
81-
the process is similar with adb, [as can be seen on the CI](https://github.com/buttaface/swift-android-sdk/blob/main/.github/workflows/sdks.yml#L316).
81+
the process is similar with adb, [as can be seen on the CI](https://github.com/buttaface/swift-android-sdk/blob/main/.github/workflows/sdks.yml#L337).
8282

8383
Copy the test executables to the same directory as the SDK:
8484
```
@@ -184,7 +184,6 @@ readelf -d libicuuc.so.68.2
184184
mv libicuuc.so.68.2 libicuuc.so
185185
patchelf --set-soname libicuuc.so libicuuc.so
186186
patchelf --replace-needed libicudata.so.68 libicudata.so libicuuc.so
187-
cd ../../../
188187
```
189188
The libcurl and libxml2 packages are [only needed for the FoundationNetworking
190189
and FoundationXML libraries respectively](https://github.com/apple/swift-corelibs-foundation/blob/release/5.4/Docs/ReleaseNotes_Swift5.md),

0 commit comments

Comments
 (0)