mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-18 13:34:22 +01:00
209 lines
6.1 KiB
YAML
209 lines
6.1 KiB
YAML
name: Build 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
|
|
uniffi-25:
|
|
description: 'If true, builds additional bindings for Uniffi 0.25'
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: set-matrix
|
|
run: |
|
|
if [ ${{ inputs.uniffi-25 }} == true ]; then
|
|
echo "::set-output name=matrix::['', '-uniffi-25']"
|
|
else
|
|
echo "::set-output name=matrix::['']"
|
|
fi
|
|
outputs:
|
|
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
build:
|
|
if: ${{ !inputs.use-dummy-binaries }}
|
|
runs-on: ubuntu-latest
|
|
name: build ${{ matrix.target }}${{ matrix.uniffi }}
|
|
needs: setup
|
|
strategy:
|
|
matrix:
|
|
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-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: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: ${{ matrix.uniffi }}
|
|
workspaces: lib
|
|
|
|
- name: Build bindings
|
|
if: matrix.uniffi != '-uniffi-25'
|
|
working-directory: lib/bindings
|
|
run: cargo ndk -t ${{ matrix.target }} build --release
|
|
|
|
- name: Build bindings Uniffi 0.25
|
|
if: matrix.uniffi == '-uniffi-25'
|
|
working-directory: lib/bindings
|
|
run: cargo ndk -t ${{ matrix.target }} build --no-default-features --features=uniffi-25 --release
|
|
|
|
- name: Copy build output
|
|
run: |
|
|
mkdir -p dist
|
|
cp lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_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: bindings-${{ matrix.target }}${{ matrix.uniffi }}
|
|
path: dist/*
|
|
|
|
jnilibs:
|
|
needs:
|
|
- setup
|
|
- build
|
|
runs-on: ubuntu-latest
|
|
name: build jniLibs${{ matrix.uniffi }}
|
|
strategy:
|
|
matrix:
|
|
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-aarch64-linux-android${{ matrix.uniffi }}
|
|
path: arm64-v8a
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-armv7-linux-androideabi${{ matrix.uniffi }}
|
|
path: armeabi-v7a
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-i686-linux-android${{ matrix.uniffi }}
|
|
path: x86
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-x86_64-linux-android${{ matrix.uniffi }}
|
|
path: x86_64
|
|
|
|
- name: Archive jniLibs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bindings-android-jniLibs${{ matrix.uniffi }}
|
|
path: ./*
|
|
|
|
build-dummies:
|
|
if: ${{ inputs.use-dummy-binaries }}
|
|
runs-on: ubuntu-latest
|
|
name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
|
|
needs: setup
|
|
strategy:
|
|
matrix:
|
|
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-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_liquid_bindings.so
|
|
touch libc++_shared.so.so
|
|
|
|
- name: Upload dummy Android ${{ matrix.target }} artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
|
|
path: ./*
|
|
|
|
jnilibs-dummy:
|
|
needs:
|
|
- setup
|
|
- build-dummies
|
|
runs-on: ubuntu-latest
|
|
name: build jniLibs dummy ${{ matrix.target }}${{ matrix.uniffi }}
|
|
strategy:
|
|
matrix:
|
|
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-aarch64-linux-android${{ matrix.uniffi }}
|
|
path: arm64-v8a
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-armv7-linux-androideabi${{ matrix.uniffi }}
|
|
path: armeabi-v7a
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-i686-linux-android${{ matrix.uniffi }}
|
|
path: x86
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: bindings-x86_64-linux-android${{ matrix.uniffi }}
|
|
path: x86_64
|
|
|
|
- name: Archive jniLibs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bindings-android-jniLibs${{ matrix.uniffi }}
|
|
path: ./* |