Skip to content

Build Language bindings #5

Build Language bindings

Build Language bindings #5

name: Build Language bindings
on:
workflow_dispatch:
inputs:
ref:
description: 'commit/tag/branch reference'
required: true
type: string
kotlin:
required: false
type: boolean
default: false
swift:
required: false
type: boolean
default: false
python:
required: false
type: boolean
default: false
csharp:
required: false
type: boolean
default: false
golang:
required: false
type: boolean
default: false
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
kotlin:
required: false
type: boolean
default: false
swift:
required: false
type: boolean
default: false
python:
required: false
type: boolean
default: false
csharp:
required: false
type: boolean
default: false
golang:
required: false
type: boolean
default: false
jobs:
build-language-bindings:
runs-on: ubuntu-latest
steps:
- name: Checkout breez-sdk repo
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Kotlin binding
if: ${{ inputs.kotlin }}
working-directory: libs/sdk-bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk.udl --language kotlin -o ffi/kotlin
- name: Archive Kotlin binding
if: ${{ inputs.kotlin }}
uses: actions/upload-artifact@v3
with:
name: bindings-kotlin
path: libs/sdk-bindings/ffi/kotlin/breez_sdk/breez_sdk.kt
- name: Archive KMM bindings
if: ${{ inputs.kotlin }}
uses: actions/upload-artifact@v3
with:
name: bindings-kmm
path: libs/sdk-bindings/ffi/kmm/*
- name: Build Swift binding
if: ${{ inputs.swift }}
working-directory: libs/sdk-bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk.udl --no-format --language swift --out-dir bindings-swift/Sources/BreezSDK
mv bindings-swift/Sources/BreezSDK/breez_sdk.swift bindings-swift/Sources/BreezSDK/BreezSDK.swift
- name: Archive Swift binding
if: ${{ inputs.swift }}
uses: actions/upload-artifact@v3
with:
name: bindings-swift
path: libs/sdk-bindings/bindings-swift/Sources/BreezSDK/*
- name: Build Python binding
if: ${{ inputs.python }}
working-directory: libs/sdk-bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk.udl --language python -o ffi/python
- name: Archive Python binding
if: ${{ inputs.python }}
uses: actions/upload-artifact@v3
with:
name: bindings-python
path: libs/sdk-bindings/ffi/python/breez_sdk.py
- name: Build C# binding
if: ${{ inputs.csharp }}
working-directory: libs/sdk-bindings
run: |
cargo install uniffi-bindgen-cs --git https://github.com/breez/uniffi-bindgen-cs --branch namespace
uniffi-bindgen-cs src/breez_sdk.udl -o ffi/csharp -c ./uniffi.toml
- name: Archive C# binding
if: ${{ inputs.csharp }}
uses: actions/upload-artifact@v3
with:
name: bindings-csharp
path: libs/sdk-bindings/ffi/csharp/breez_sdk.cs
- name: Build golang binding
if: ${{ inputs.golang }}
working-directory: libs/sdk-bindings
run: |
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.1.5+v0.23.0
uniffi-bindgen-go src/breez_sdk.udl -o ffi/golang -c ./uniffi.toml
- name: Archive golang binding
if: ${{ inputs.golang }}
uses: actions/upload-artifact@v3
with:
name: bindings-golang
path: libs/sdk-bindings/ffi/golang/breez/breez_sdk/breez_sdk.go