Skip to content

Commit 8082954

Browse files
authored
ci: add workflow to build and release native library
1 parent 51aa348 commit 8082954

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build Native Library
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: 21
21+
22+
- name: Set up Android SDK & NDK
23+
uses: android-actions/setup-android@v3
24+
25+
- name: Install NDK
26+
run: sdkmanager "ndk;26.1.10909125"
27+
28+
- name: Build for all architectures
29+
run: |
30+
NDK=$ANDROID_SDK_ROOT/ndk/26.1.10909125
31+
32+
for ABI in arm64-v8a armeabi-v7a x86_64 x86; do
33+
echo "Building for $ABI..."
34+
mkdir -p build/$ABI
35+
cd build/$ABI
36+
37+
cmake ../.. \
38+
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
39+
-DANDROID_ABI=$ABI \
40+
-DANDROID_PLATFORM=android-24 \
41+
-DCMAKE_BUILD_TYPE=Release
42+
43+
cmake --build . --parallel
44+
cd ../..
45+
done
46+
47+
- name: Package artifacts
48+
run: |
49+
mkdir -p dist/jniLibs
50+
for ABI in arm64-v8a armeabi-v7a x86_64 x86; do
51+
mkdir -p dist/jniLibs/$ABI
52+
cp build/$ABI/libcoverart.so dist/jniLibs/$ABI/
53+
done
54+
cd dist && zip -r ../libcoverart-jniLibs.zip jniLibs
55+
56+
- name: Upload build artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: libcoverart-jniLibs
60+
path: dist/jniLibs

0 commit comments

Comments
 (0)