Skip to content

Conversation

@marcprux
Copy link
Contributor

The Android CI added in #172 will build against the Swift SDK for Android using the scripts/install-and-build-with-sdk.sh support for building with cross-compilation SDKs, but it does't actually test the package. This PR adds a scripts/android/android-emulator-tests.sh script that will install and configure an Android emulator and then transfer the test cases over to it and run the tests on the emulator.

Notes:

  • In addition to the build-only enable_android_sdk_build input to workflows/swift_package_test.yml, we now have an enable_android_sdk_checks boolean which will additionally run a package's test cases.
  • The Android emulator requires KVM to be enabled for acceleration, which is not possible in a nested docker container. I saw no reason why the SDK build needs to take place in a nested container, so I moved it to run on the top-level ubuntu-latest container.
  • The emulator will only run on x86_64; since we support building against multiple triples (currently defaulting to aarch64-unknown-linux-android28 and x86_64-unknown-linux-android28 in workflows/swift_package_test.yml), we will still build against each of these archs, but only test against x86_64.
  • As mentioned previously (Add Android emulator testing to workflow #179 (comment)), not all package testing will pass out of the box, since some tests rely on hardcoded #filePath references to test data (e.g., in swift-crypto), which will not work when the tests are run in an emulator with a separate filesystem. I expect that some of these packages will need to be updated if we are to enable enable_android_sdk_checks for them.

A successful run can be seen at https://github.com/swift-android-sdk/github-workflows/actions/runs/20244304679/job/58120240667

Closes #179 and #83

CC: @finagolfin, @justice-adams-apple, @etcwilde, @shahmishal

@marcprux marcprux requested a review from a team as a code owner December 15, 2025 20:05
@marcprux marcprux requested a review from finagolfin December 17, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Android emulator testing to workflow

2 participants