| name: CI Android Emulator Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/actions/**" | |
| - ".github/workflows/ci-android-emulator-tests.yml" | |
| - "android_jni/**" | |
| pull_request: | |
| paths: | |
| - ".github/actions/**" | |
| - ".github/workflows/ci-android-emulator-tests.yml" | |
| - "android_jni/**" | |
| permissions: | |
| contents: read | |
| # Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build-and-run-android-jni-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # This is needed for faster emulators. See: | |
| # https://github.com/ReactiveCircus/android-emulator-runner?tab=readme-ov-file#running-hardware-accelerated-emulators-on-linux-runners | |
| - name: Enable KVM group perms | |
| run: | | |
| 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 | |
| - name: Download and Setup the Android NDK | |
| uses: nttld/setup-ndk@ed92fe6cadad69be94a966a7ee3271275e62f779 # v1.6.0 | |
| id: setup-ndk | |
| with: | |
| # r25c is the same as 25.2.9519653. | |
| ndk-version: r25c | |
| add-to-path: false | |
| - uses: ./.github/actions/setup-linux | |
| with: | |
| codec-dav1d: "LOCAL" | |
| libyuv: "LOCAL" | |
| oldest-cmake: true | |
| - name: Setup JDK | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Run Instrumented Tests on the Emulator | |
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0 | |
| with: | |
| working-directory: android_jni | |
| api-level: 31 | |
| force-avd-creation: false | |
| ndk: 25.2.9519653 | |
| arch: x86_64 | |
| script: ./gradlew cAT |