| name: CI Android Emulator Tests |
| on: |
| push: |
| paths: |
| - 'android_jni/**' |
| pull_request: |
| paths: |
| - '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: macos-latest |
| strategy: |
| fail-fast: false |
| |
| steps: |
| - name: Checkout the repository |
| uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 |
| - name: Download and Setup the Android NDK |
| uses: nttld/setup-ndk@6a7e9c5494a25c4842ca1011f710300132eacd94 # v1.4.2 |
| id: setup-ndk |
| with: |
| # r25c is the same as 25.2.9519653. |
| ndk-version: r25c |
| add-to-path: false |
| - name: Setup ninja |
| uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 |
| - name: Setup cmake |
| uses: jwlawson/actions-setup-cmake@959f1116cf9f1ae42fff8ec1a4aaae6d4a0e348b # v2.0.1 |
| with: |
| cmake-version: "3.19.x" |
| - name: Setup python |
| uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 |
| with: |
| python-version: '3.x' |
| - name: Setup meson |
| run: pip install meson |
| - name: Setup nasm |
| uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 |
| - name: Setup JDK |
| uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 |
| with: |
| java-version: '11' |
| distribution: 'zulu' |
| - name: Run Instrumented Tests on the Emulator |
| uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 |
| with: |
| working-directory: android_jni |
| api-level: 30 |
| force-avd-creation: false |
| # This is the same version of cmake that is found in build.gradle. |
| # This will be used to build libavif and the JNI bindings. |
| cmake: 3.22.1 |
| ndk: 25.2.9519653 |
| arch: x86_64 |
| script: ./gradlew cAT |