Skip to content

[Action] Fix for failure case #19

[Action] Fix for failure case

[Action] Fix for failure case #19

Workflow file for this run

name: Build test/ Android NDK r25c
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-22.04
name: Android NDK build on Ubuntu for arm64-v8a
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: -${{ github.event.pull_request.commits }}
- name: Check if rebuild required
uses: ./.github/actions/check-rebuild
with:
mode: android
- if: env.rebuild == '1'
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
link-to-sdk: true
## @todo Make cache works (daily update cache on main branch / restore the cache on each PR (w/o saving))
- name: Prepare Build
if: env.rebuild == '1'
run: |
echo "::group::Install required packages"
sudo apt-get update
sudo apt-get install tar wget gzip libglib2.0-dev libjson-glib-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev googletest liborc-0.4-dev flex bison libopencv-dev pkg-config python3-dev python3-numpy python3
echo "::endgroup::"
if [[ -d ~/android/gst_root_android/arm64 ]] && [[ -f ~/android/gst_root_android/arm64/lib/libgstreamer-1.0.so ]]; then
echo "Gst-Root-Android cached."
else
echo "::group::Download prebuilt Android-Gstreamer libraries"
mkdir -p ~/android/gst_root_android/
pushd ~/android/gst_root_android/
wget https://gstreamer.freedesktop.org/pkg/android/1.24.0/gstreamer-1.0-android-universal-1.24.0.tar.xz
tar -xf gstreamer-1.0-android-universal-1.24.0.tar.xz
popd
echo "::endgroup::"
fi
- name: NDK Build
if: env.rebuild == '1'
run: |
export GSTREAMER_ROOT_ANDROID=~/android/gst_root_android
export TARGET_ARCH_ABI=arm64-v8a
export ANDROID_ABI=arm64-v8a
export APP_ALLOW_MISSING_DEPS=true
export NNSTREAMER_ROOT=$(pwd)
target_host=aarch64-linux-android
export AR=$target_host-ar
export AS=$target_host-clang
export CC=$target_host-clang
export CXX=$target_host-clang++
export LD=$target_host-ld
export STRIP=$target_host-strip
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/android/gst_root_android/arm64/lib/
cd jni
echo "::group::Build NNStreamer with ndk-build"
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android-nnstreamer.mk NDK_APPLICATION_MK=./Application.mk -j$(nproc)
echo "::endgroup::"
ls -la ./libs/arm64-v8a/
cp ./libs/arm64-v8a/libnnstreamer.so $GSTREAMER_ROOT_ANDROID/arm64/lib/gstreamer-1.0/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./libs/arm64-v8a
echo "::group::Build a test application"
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android-app.mk NDK_APPLICATION_MK=./Application.mk -j$(nproc)
echo "::endgroup::"
cd ..