Skip to content

Commit f875304

Browse files
authored
Add Android test build (netbirdio#1144)
Extend the CI with gomobile build. With this step we can validate that the code can run on Android
1 parent 8b0a642 commit f875304

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Android build validation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
- name: Install Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: "1.20.x"
23+
- name: Setup Android SDK
24+
uses: android-actions/setup-android@v2
25+
- name: NDK Cache
26+
id: ndk-cache
27+
uses: actions/cache@v3
28+
with:
29+
path: /usr/local/lib/android/sdk/ndk
30+
key: ndk-cache-23.1.7779620
31+
- name: Setup NDK
32+
run: /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;23.1.7779620"
33+
- name: install gomobile
34+
run: go install golang.org/x/mobile/cmd/[email protected]
35+
- name: gomobile init
36+
run: gomobile init
37+
- name: build android nebtird lib
38+
run: PATH=$PATH:$(go env GOPATH) gomobile bind -o $GITHUB_WORKSPACE/netbird.aar -javapkg=io.netbird.gomobile -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=buildtest" $GITHUB_WORKSPACE/client/android
39+
env:
40+
CGO_ENABLED: 0
41+
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/23.1.7779620

0 commit comments

Comments
 (0)