Merge branch 'swiftlang:main' into android-apis #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android API Testing | |
| on: | |
| push: | |
| branches: [ '*' ] | |
| workflow_dispatch: | |
| pull_request: | |
| jobs: | |
| android: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api: | |
| - '28' | |
| # Cannot run against 29 and 30 without bootstrapping JavaVirtualMachine.setShared | |
| # https://github.com/swiftlang/swift-java/issues/419 | |
| - '29' | |
| - '30' | |
| - '31' | |
| #- '32' | |
| #- '33' | |
| #- '34' | |
| #- '35' | |
| - '36' | |
| sdk: | |
| - 'nightly-6.3' | |
| ndk: | |
| - 'r27d' | |
| #- 'r28c' | |
| #- 'r29' | |
| runs-on: 'ubuntu-24.04' | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # Manual emulator setup until we can customize github-workflows API levels | |
| # https://github.com/swiftlang/github-workflows/issues/226 | |
| - uses: skiptools/actions/setup-skip@v1 | |
| - name: "Install Swift SDK for Android" | |
| run: | | |
| skip android sdk install --version "${{ matrix.sdk }}" --ndk-version "${{ matrix.ndk }}" | |
| - name: "Build Swift Package for Android" | |
| run: | | |
| ANDROID_NDK_ROOT="" ANDROID_SDK_VERSION="${{ matrix.api }}" skip android build --arch "x86_64" --android-api-level "${{ matrix.api }}" | |
| - name: "Create and Launch Android emulator" | |
| run: | | |
| if [ "${RUNNER_OS}" == 'Linux' ]; then | |
| # set up hardware acceleration for emulator | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| # need to free disk space or the emulator fails to launch sometimes | |
| sudo rm -rf /opt/microsoft /opt/google /opt/az /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/local/julia* /opt/hostedtoolcache/CodeQL /usr/local/share/boost | |
| fi | |
| export ANDROID_USER_HOME=$HOME/.android | |
| export ANDROID_EMULATOR_HOME=$ANDROID_USER_HOME | |
| export ANDROID_AVD_HOME=$ANDROID_EMULATOR_HOME/avd | |
| skip android emulator create --android-api-level "${{ matrix.api }}" | |
| skip android emulator list --verbose | |
| skip android emulator launch --background | |
| - name: "Test Swift package on emulator" | |
| run: | | |
| skip android test --arch "x86_64" --apk --verbose | |