-
Notifications
You must be signed in to change notification settings - Fork 8
344 lines (287 loc) · 10.7 KB
/
main.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the "main" branch
push:
branches: [ main ]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
fmt:
name: Cargo Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Rust Formatting
run: |
cd lib
cargo fmt -- --check
cd ../cli
cargo fmt -- --check
clippy:
name: Cargo Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib -> target
cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Rust Clippy
run: |
cd lib
cargo clippy -- -D warnings
cd ../cli
cargo clippy -- -D warnings
tests:
name: Test sdk-core
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib -> target
cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run sdk-core tests
working-directory: lib/core
run: cargo test
build-bindings:
name: Test bindings
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib -> target
cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build bindings
working-directory: lib/bindings
run: cargo build
- name: Build C# bindings
working-directory: lib/bindings
run: |
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml
cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/csharp
- name: Build golang bindings
working-directory: lib/bindings
run: |
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml
cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/golang
cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.19.9'
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Run bindings tests
run: |
curl -o jna-5.12.1.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
export CLASSPATH=$(pwd)/jna-5.12.1.jar;
cd lib/bindings
cargo test
notification-plugin:
name: Check notification plugin
runs-on: macOS-14
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib -> target
cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Java 17
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: 17
- name: Build bindings
working-directory: lib/bindings
run: cargo build
- name: Build Android bindings
working-directory: lib/bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o langs/android/lib/src/main/kotlin
- name: Run Android build
working-directory: lib/bindings/langs/android
run: |
./gradlew build
- name: Build Swift bindings
working-directory: lib/bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid
mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/macos-arm64_x86_64/breez_sdk_liquidFFI.framework/Headers
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/flutter/breez_sdk_liquidFFI/include/
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap
- name: Run Swift build
working-directory: lib/bindings/langs/swift
run: |
swift build
react-native:
name: Check react native bindings
runs-on: macOS-14
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: React native codegen
working-directory: packages/react-native
run: |
yarn global add tslint typescript
brew install kotlin ktlint swiftformat
make react-native
- name: Check git status
env:
GIT_PAGER: cat
run: |
status=$(git status --porcelain)
if [[ -n "$status" ]]; then
echo "Git status has changes"
echo "$status"
git diff
exit 1
else
echo "No changes in git status"
fi
flutter:
name: Check Dart/Flutter bindings
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.22.3 # Pinned until resource linking issues on Android is resolved with 3.24
- run: flutter --version
- name: Set up just
uses: extractions/setup-just@v2
- name: Set up Melos
uses: bluefireteam/melos-action@v3
with:
run-bootstrap: false
- name: Initialize the workspace
working-directory: lib/bindings/langs/flutter/
run: |
just clean
just init
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install flutter_rust_bridge_codegen dependencies
working-directory: lib/bindings/langs/flutter/
run: just frb
- name: Generate Dart/Flutter bindings & Softlink C Headers
working-directory: lib/bindings/langs/flutter/
run: just codegen
- name: Build iOS Framework & Softlink C Headers
working-directory: lib/bindings/langs/flutter/
if: ${{ success() || failure() }}
run: just build-ios-framework
- name: Generate FFI bindings
working-directory: lib/bindings/langs/flutter/
if: ${{ success() || failure() }}
run: just ffigen
- name: Static Analysis
working-directory: lib/bindings/langs/flutter/
if: ${{ success() || failure() }}
run: melos analyze
- name: Check Formatting
working-directory: lib/bindings/langs/flutter/
run: melos check-format
# This step is added to ensure version recipe was run to update podspec files & CMake script.
# It does not catch the case where 'packages/flutter/pubspec.yaml' wasn't updated properly.
- name: Update version number on podspec files & CMake scripts
working-directory: lib/bindings/langs/flutter/
run: just version
- name: Check git status
env:
GIT_PAGER: cat
run: |
status=$(git status --porcelain)
if [[ -n "$status" ]]; then
echo "Git status has changes"
echo "$status"
git diff
exit 1
else
echo "No changes in git status"
fi
# Create a new plain Rust project, add the Liquid SDK as single dependency and try to compile it.
# This tests whether the SDK compiles with the latest version of the dependencies that can be updated.
#
# See discussion at https://github.com/breez/breez-sdk/pull/971
check-sdk-as-dependency:
name: Check SDK as Rust dependency in fresh project
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
lib -> target
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.2"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: test-new-project-with-sdk-dependency
run: |
mkdir new-project
cd new-project
cargo init --name test_project --vcs none
# A project might reference our SDK as a git repository
# cargo add --git https://github.com/breez/breez-sdk-liquid breez-sdk-liquid
# In this test, we reference the checked out repo (e.g. this PR branch)
cargo add --path ../lib/core breez-sdk-liquid
# Add the secp256k1-zkp patch: https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits
echo "[patch.crates-io]" >> Cargo.toml
echo "secp256k1-zkp = {git = 'https://github.com/sanket1729/rust-secp256k1-zkp.git', rev = '60e631c24588a0c9e271badd61959294848c665d'}" >> Cargo.toml
# Propagate the patch in Cargo.lock
rm Cargo.lock
cargo update --package secp256k1-zkp
cargo clippy -- -D warnings