2024-01-18 18:20:23 +01:00
|
|
|
name: Mobile build validation
|
2023-09-13 17:58:12 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
2024-03-12 19:06:16 +01:00
|
|
|
android_build:
|
2023-09-13 17:58:12 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
2024-01-08 12:25:35 +01:00
|
|
|
go-version: "1.21.x"
|
2023-09-13 17:58:12 +02:00
|
|
|
- name: Setup Android SDK
|
2024-01-12 12:31:14 +01:00
|
|
|
uses: android-actions/setup-android@v3
|
|
|
|
with:
|
|
|
|
cmdline-tools-version: 8512546
|
2024-01-11 12:21:58 +01:00
|
|
|
- name: Setup Java
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
2024-01-12 12:31:14 +01:00
|
|
|
java-version: "11"
|
2024-01-11 12:21:58 +01:00
|
|
|
distribution: "adopt"
|
2023-09-13 17:58:12 +02:00
|
|
|
- name: NDK Cache
|
|
|
|
id: ndk-cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /usr/local/lib/android/sdk/ndk
|
|
|
|
key: ndk-cache-23.1.7779620
|
|
|
|
- name: Setup NDK
|
2024-01-12 12:31:14 +01:00
|
|
|
run: /usr/local/lib/android/sdk/cmdline-tools/7.0/bin/sdkmanager --install "ndk;23.1.7779620"
|
2023-09-13 17:58:12 +02:00
|
|
|
- name: install gomobile
|
2024-04-23 10:20:09 +02:00
|
|
|
run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240404231514-09dbf07665ed
|
2023-09-13 17:58:12 +02:00
|
|
|
- name: gomobile init
|
|
|
|
run: gomobile init
|
2024-03-12 19:06:16 +01:00
|
|
|
- name: build android netbird lib
|
2023-09-13 17:58:12 +02:00
|
|
|
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
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|
2024-01-11 12:21:58 +01:00
|
|
|
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/23.1.7779620
|
2024-01-18 18:20:23 +01:00
|
|
|
ios_build:
|
|
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: "1.21.x"
|
|
|
|
- name: install gomobile
|
2024-04-23 10:20:09 +02:00
|
|
|
run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240404231514-09dbf07665ed
|
2024-01-18 18:20:23 +01:00
|
|
|
- name: gomobile init
|
|
|
|
run: gomobile init
|
2024-03-12 19:06:16 +01:00
|
|
|
- name: build iOS netbird lib
|
2024-04-23 10:20:09 +02:00
|
|
|
run: PATH=$PATH:$(go env GOPATH) gomobile bind -target=ios -bundleid=io.netbird.framework -ldflags="-X github.com/netbirdio/netbird/version.version=buildtest" -o ./NetBirdSDK.xcframework ./client/ios/NetBirdSDK
|
2024-01-18 18:20:23 +01:00
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|