Skip to content

🤖 Build Android

🤖 Build Android #3

Workflow file for this run

name: 🤖 Build Android
on: [workflow_call, workflow_dispatch]
jobs:
build-jni:
strategy:
matrix:
arch: ["arm64-v8a", "x86_64"]
name: Android ${{ matrix.arch }}
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
link-to-sdk: true
- name: Setup
run: |
python ./setup.py
- name: Android SDK/NDK Patch
run: |
echo "android_sdk_repository(name = \"androidsdk\")" >> mediapipe/WORKSPACE
echo "android_ndk_repository(name = \"androidndk\", api_level=21)" >> mediapipe/WORKSPACE
echo "bind(name = \"android/crosstool\", actual = \"@androidndk//:toolchain\")" >> mediapipe/WORKSPACE
- name: Build
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
source ./venv/bin/activate
python ./build.py android --android-skip-aar --arch ${{ matrix.arch }} --type release --output build/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact-android-${{ matrix.arch }}
path: |
build/${{ matrix.arch }}
build-aar:
name: Android AAR
runs-on: ubuntu-20.04
needs: build-jni
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Setup
run: |
python ./setup.py
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: build-artifact-android-*
- name: Copy JNI Libraries
run: |
cp -a build-artifact-android-*/* android/src/main/jniLibs
- name: Build
run: |
source ./venv/bin/activate
python ./build.py android --type release --output build/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact-android
path: |
build/*.aar