| name: CI Android JNI | |
| on: [push, pull_request] | |
| 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-android-jni: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - 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-aom: "LOCAL" | |
| codec-dav1d: "LOCAL" | |
| - name: Setup JDK | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| distribution: "zulu" | |
| java-version: 17 | |
| - name: Download and Setup the Android SDK | |
| uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 | |
| - name: Install CMake in the Android SDK | |
| # This is the same version of cmake that is found in build.gradle. This | |
| # will be used to build libavif and the JNI bindings. | |
| run: sdkmanager "cmake;3.22.1" | |
| - name: Build the libavif JNI Wrapper | |
| working-directory: android_jni | |
| run: | | |
| ./gradlew --no-daemon assembleRelease \ | |
| -Pandroid.extraCMakeFlags="-DAVIF_ENABLE_WERROR=ON" | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |