-
Notifications
You must be signed in to change notification settings - Fork 45
155 lines (140 loc) · 4.62 KB
/
build-language-bindings.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
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@v4
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@v3
with:
version: "27.2"
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@v4
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@v4
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@v4
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@v4
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@v4
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@v4
with:
name: bindings-golang
path: libs/sdk-bindings/ffi/golang/breez/breez_sdk/breez_sdk.go