-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (131 loc) · 4.27 KB
/
Copy pathandroid-bindgen.yml
File metadata and controls
148 lines (131 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Android Bindgen
on:
pull_request:
paths:
- '.cargo/**'
- '.github/workflows/android-bindgen.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/bindings/android/**'
- '**/build*.sh'
- '**/build.rs'
- '**/*.gradle*'
- '**/*.rs'
- '**/*.udl'
- '**/gradle/**'
- '**/gradle.properties'
- '**/gradlew*'
- '**/settings.gradle*'
- '**/uniffi*.toml'
- 'rust-toolchain*'
- 'vendor/**'
push:
branches:
- master
- main
paths:
- '.cargo/**'
- '.github/workflows/android-bindgen.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/bindings/android/**'
- '**/build*.sh'
- '**/build.rs'
- '**/*.gradle*'
- '**/*.rs'
- '**/*.udl'
- '**/gradle/**'
- '**/gradle.properties'
- '**/gradlew*'
- '**/settings.gradle*'
- '**/uniffi*.toml'
- 'rust-toolchain*'
- 'vendor/**'
workflow_dispatch:
inputs:
ref:
description: "Branch, tag, or SHA to build"
required: false
default: ""
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
android-bindgen:
name: Android Bindgen
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: false
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: temurin
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config protobuf-compiler zip unzip
- name: Set up Android SDK
uses: android-actions/setup-android@v4
with:
packages: ''
- name: Set up Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r28c
add-to-path: true
- name: Export Android NDK paths
run: |
echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
echo "ANDROID_NDK_PATH=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
echo "NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
- name: Generate Android bindings and native libraries
run: ./build_android.sh
- name: Verify Android outputs
shell: bash
run: |
set -euo pipefail
required=(
bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.android.kt
bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.common.kt
bindings/android/lib/src/main/jniLibs/arm64-v8a/libbitkitcore.so
bindings/android/lib/src/main/jniLibs/armeabi-v7a/libbitkitcore.so
bindings/android/lib/src/main/jniLibs/x86/libbitkitcore.so
bindings/android/lib/src/main/jniLibs/x86_64/libbitkitcore.so
bindings/android/native-debug-symbols.zip
)
for path in "${required[@]}"; do
if [ ! -s "$path" ]; then
echo "::error::Missing or empty generated Android output: $path"
exit 1
fi
done
aar_count=$(find bindings/android/lib/build/outputs/aar -name '*release.aar' -type f | wc -l | tr -d ' ')
if [ "$aar_count" -eq 0 ]; then
echo "::error::Missing generated Android release AAR"
exit 1
fi
- name: Upload Android generated artifacts
uses: actions/upload-artifact@v4
with:
name: bitkit-core-android-bindgen
path: |
bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/*.kt
bindings/android/lib/src/main/jniLibs/**/libbitkitcore.so
bindings/android/native-debug-symbols.zip
bindings/android/lib/build/outputs/aar/*release.aar
if-no-files-found: error