From 28f03480b92bea825fcb8fd5c9f440c9351881b2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Thu, 12 Dec 2024 14:38:42 +0800 Subject: [PATCH] Update CI to build aar --- .github/workflows/android.yaml | 49 +++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index ebe9cd90f..5e0a9906a 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -32,7 +32,7 @@ concurrency: jobs: build-android-libs: - name: Android for ${{ matrix.os }} + name: Android libs runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -44,6 +44,11 @@ jobs: with: fetch-depth: 0 + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }}-android-jni + - name: Display NDK HOME shell: bash run: | @@ -53,6 +58,9 @@ jobs: - name: build android arm64-v8a shell: bash run: | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME ./build-android-arm64-v8a.sh mkdir -p jniLibs/arm64-v8a/ @@ -62,6 +70,9 @@ jobs: - name: build android armv7-eabi shell: bash run: | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME ./build-android-armv7-eabi.sh mkdir -p ./jniLibs/armeabi-v7a/ @@ -71,6 +82,9 @@ jobs: - name: build android x86_64 shell: bash run: | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME ./build-android-x86-64.sh mkdir -p ./jniLibs/x86_64 @@ -80,6 +94,9 @@ jobs: - name: build android x86 shell: bash run: | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME ./build-android-x86.sh mkdir -p ./jniLibs/x86 @@ -143,3 +160,33 @@ jobs: file_glob: true overwrite: true file: sherpa-onnx-*-android.tar.bz2 + + build-android-aar: + needs: [build-android-libs] + name: Android AAR + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Display NDK HOME + shell: bash + run: | + echo "ANDROID_NDK_LATEST_HOME: ${ANDROID_NDK_LATEST_HOME}" + ls -lh ${ANDROID_NDK_LATEST_HOME} + + - name: Retrieve artifact + uses: actions/download-artifact@v4 + with: + name: sherpa-onnx-android-libs + path: /tmp/jniLibs + + - name: Show jni libs + shell: bash + run: | + ls -lh /tmp/jniLibs