-
Notifications
You must be signed in to change notification settings - Fork 43
275 lines (229 loc) · 7.26 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
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: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Format
run: |
cd libs
cargo fmt -- --check
cd ../tools/sdk-cli
cargo fmt -- --check
build-core:
name: Test sdk-core
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: libs/sdk-core -> ../target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run sdk-core tests
working-directory: libs/sdk-core
run: cargo test
build-bindings:
name: Test sdk-bindings
runs-on: macOS-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: libs/sdk-bindings -> ../target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build sdk-bindings
working-directory: libs/sdk-bindings
run: cargo build
- name: Build C# bindings
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
cp ../target/debug/libbreez_sdk_bindings.dylib ffi/csharp
- name: Build golang bindings
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
cp ../target/debug/libbreez_sdk_bindings.dylib ffi/golang
cp -r ffi/golang/breez/breez_sdk tests/bindings/golang/
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- 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 sdk-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 libs/sdk-bindings
cargo test
build-cli:
name: Test sdk-cli
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: tools/sdk-cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tools tests
working-directory: tools/sdk-cli
run: cargo test
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
libs -> target
tools/sdk-cli -> target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: clippy
run: |
cd libs
# Explicitly allow clippy::uninlined-format-args lint because it's present in the generated breez_sdk.uniffi.rs
cargo clippy -- -D warnings -A clippy::uninlined-format-args
cargo clippy --tests -- -D warnings -A clippy::uninlined-format-args
cd ../tools/sdk-cli
cargo clippy -- -D warnings
react-native:
name: Check react native
runs-on: macOS-14
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
libs -> target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: React native codegen
working-directory: libs/sdk-react-native
run: |
yarn global add tslint typescript
brew update
brew install kotlin ktlint swiftformat
make react-native-codegen
- 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 flutter
runs-on: macOS-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
libs -> target
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter bridge codegen
working-directory: libs/sdk-flutter
run: |
make init
make flutter_rust_bridge
- 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
- name: dart-analyze
run: dart analyze --fatal-infos
- name: dart-format
run: dart format -o none --set-exit-if-changed -l 110 .