-
Notifications
You must be signed in to change notification settings - Fork 46
179 lines (156 loc) · 4.81 KB
/
build-bindings-android.yml
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build sdk-bindings for Android
on:
workflow_dispatch:
inputs:
ref:
description: 'commit/tag/branch reference'
required: true
type: string
workflow_call:
inputs:
repository:
description: 'sdk repository, defaults to current repository'
required: false
type: string
ref:
description: 'commit/tag/branch reference'
required: true
type: string
use-dummy-binaries:
description: 'If true, creates dummy binaries rather than real binaries'
required: false
type: boolean
default: false
jobs:
build:
if: ${{ !inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build ${{ matrix.target }}
strategy:
matrix:
target: [
aarch64-linux-android,
armv7-linux-androideabi,
i686-linux-android,
x86_64-linux-android,
]
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository || github.repository }}
- name: Install rust toolchain
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
rustup target add ${{ matrix.target }}
cargo install cargo-ndk
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26d
- name: Set ANDROID_NDK_HOME
run: echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: libs
- name: Build sdk-bindings
working-directory: libs/sdk-bindings
run: |
cargo ndk -t ${{ matrix.target }} build --release
- name: Copy build output
run: |
mkdir -p dist
cp libs/target/${{ matrix.target }}/release/libbreez_sdk_bindings.so dist
- name: Copy libc++_shared
if: ${{ matrix.target == 'armv7-linux-androideabi'}}
run: cp $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so dist
- name: Copy libc++_shared
if: ${{ matrix.target != 'armv7-linux-androideabi'}}
run: cp $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/${{ matrix.target }}/libc++_shared.so dist
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-${{ matrix.target }}
path: dist/*
jnilibs:
needs: build
runs-on: ubuntu-latest
name: build jniLibs
steps:
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-aarch64-linux-android
path: arm64-v8a
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-armv7-linux-androideabi
path: armeabi-v7a
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-i686-linux-android
path: x86
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-x86_64-linux-android
path: x86_64
- name: Archive jniLibs
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-android-jniLibs
path: ./*
build-dummies:
if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build android dummies
strategy:
matrix:
target: [
aarch64-linux-android,
armv7-linux-androideabi,
i686-linux-android,
x86_64-linux-android,
]
steps:
- name: Build Android ${{ matrix.target }} dummy
run: |
touch libbreez_sdk_bindings.so
touch libc++_shared.so.so
- name: Upload dummy Android ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-${{ matrix.target }}
path: ./*
jnilibs-dummy:
needs: build-dummies
runs-on: ubuntu-latest
name: build jniLibs dummy
steps:
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-aarch64-linux-android
path: arm64-v8a
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-armv7-linux-androideabi
path: armeabi-v7a
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-i686-linux-android
path: x86
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-x86_64-linux-android
path: x86_64
- name: Archive jniLibs
uses: actions/upload-artifact@v4
with:
name: sdk-bindings-android-jniLibs
path: ./*