Skip to content

Commit

Permalink
Put Android lib and app building into a single job
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPushkin committed May 19, 2022
1 parent 41b7e1d commit b834ab1
Showing 1 changed file with 4 additions and 53 deletions.
57 changes: 4 additions & 53 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
path: |
~/.cmodule
${{github.workspace}}/${{env.NATIVE_PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-native-build-cache-lib
key: ${{runner.os}}-native-build-cache

- name: Prepare OpenCV
env:
Expand All @@ -82,57 +82,8 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
- name: Build Android library
run: ./gradlew :sgbmandroid:build

build-app:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r23b
add-to-path: false

- name: Cache native-build-related files
uses: actions/cache@v3
with:
path: |
~/.cmodule
${{github.workspace}}/${{env.NATIVE_PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-native-build-cache-app

- name: Prepare OpenCV
env:
NDK: ${{steps.setup-ndk.outputs.ndk-path}}
working-directory: ${{env.NATIVE_PROJECT_SUBDIR}}
run: |
for ABI in $ABIS; do
if [ ! -f "${{env.BUILD_SUBDIR}}/opencv-build-$ABI/OpenCVConfig.cmake" ]; then
echo "Preparing OpenCV for $ABI"
cmake -D CMAKE_TOOLCHAIN_FILE="$NDK/$TOOLCHAIN_SUBPATH" \
-D CMAKE_C_COMPILER="$NDK/$C_COMPILER_SUBPATH" \
-D CMAKE_CXX_COMPILER="$NDK/$CXX_COMPILER_SUBPATH" \
-D ANDROID_ABI=$ABI \
-D BUILD_DIR_SUFFIX=$ABI \
-D ADD_ANDROID_ABI_CHECK=ON \
-P BuildOpenCV.cmake
else
echo "OpenCV for $ABI already prepared"
fi
done
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew :sgbmandroid:build :app:build
- name: Build Android app
run: ./gradlew :app:build

0 comments on commit b834ab1

Please sign in to comment.