Skip to content

Commit

Permalink
[build] Add Android build action to GitHub CI (#2149)
Browse files Browse the repository at this point in the history
Also corrected the 'build-android.sh' script.

Co-authored-by: Sergei Ignatov <sergeiignatov@users.noreply.github.com>
  • Loading branch information
maxsharabayko and sergeiignatov committed Oct 13, 2021
1 parent 15f33d4 commit 2da63dc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Android

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
name: NDK-R23
runs-on: ubuntu-18.04

steps:
- name: Setup Android NDK R23
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r23
add-to-path: false
- uses: actions/checkout@v2
- name: build
run: |
cd ./scripts/build-android/
echo ${{ steps.setup-ndk.outputs.ndk-path }}
source ./build-android -n ${{ steps.setup-ndk.outputs.ndk-path }}
16 changes: 4 additions & 12 deletions scripts/build-android/build-android
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ echo_help()
echo " -e Encryption library to be used. Possible options: openssl (default) mbedtls"
echo " -o OpenSSL version. E.g. 1.1.1l"
echo " -m Mbed TLS version. E.g. v2.26.0"
echo " -s SRT version. E.g. v1.4.4"
echo
echo "Example: ./build-android -n /home/username/Android/Sdk/ndk/23.0.7599858 -a 28 -t \"arm64-v8a x86_64\""
echo
Expand All @@ -21,7 +20,6 @@ NDK_ROOT=""
API_LEVEL=28
BUILD_TARGETS="armeabi-v7a arm64-v8a x86 x86_64"
OPENSSL_VERSION=1.1.1l
SRT_VERSION=""
ENC_LIB=openssl
MBEDTLS_VERSION=v2.26.0

Expand Down Expand Up @@ -56,10 +54,8 @@ SCRIPT_DIR=$(pwd)
HOST_TAG='unknown'
unamestr=$(uname -s)
if [ "$unamestr" = 'Linux' ]; then
SCRIPT_DIR=$(readlink -f $0 | xargs dirname)
HOST_TAG='linux-x86_64'
elif [ "$unamestr" = 'Darwin' ]; then
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
if [ $(uname -p) = 'arm' ]; then
echo "NDK does not currently support ARM64"
exit 128
Expand Down Expand Up @@ -93,12 +89,8 @@ else
exit 128
fi

if [ ! -d $BASE_DIR/srt ]; then
git clone https://github.com/Haivision/srt srt
if [ ! -z "$SRT_VERSION" ]; then
git -C $BASE_DIR/srt checkout $SRT_VERSION
fi
fi
# Build working copy of srt repository
REPO_DIR="../.."

for build_target in $BUILD_TARGETS; do
LIB_DIR=$BASE_DIR/$build_target/lib
Expand All @@ -113,7 +105,7 @@ for build_target in $BUILD_TARGETS; do
cp $LIB_DIR/libmbedx509.so $JNI_DIR/libmbedx509.so
fi

git -C $BASE_DIR/srt clean -fd
$SCRIPT_DIR/mksrt -n $NDK_ROOT -a $API_LEVEL -t $build_target -e $ENC_LIB -s $BASE_DIR/srt -i $BASE_DIR/$build_target
git -C $REPO_DIR clean -fd -e scripts
$SCRIPT_DIR/mksrt -n $NDK_ROOT -a $API_LEVEL -t $build_target -e $ENC_LIB -s $REPO_DIR -i $BASE_DIR/$build_target
cp $LIB_DIR/libsrt.so $JNI_DIR/libsrt.so
done

0 comments on commit 2da63dc

Please sign in to comment.