-
Notifications
You must be signed in to change notification settings - Fork 71
286 lines (237 loc) · 7.28 KB
/
ci-workflow.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
name: CI
on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
job_build:
name: Compilation for X, S+, Stax and Flex
strategy:
matrix:
include:
- model: nanox
SDK: "$NANOX_SDK"
- model: nanosp
SDK: "$NANOSP_SDK"
- model: stax
SDK: "$STAX_SDK"
- model: flex
SDK: "$FLEX_SDK"
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Build
run: |
make DEBUG=0 COIN=bitcoin BOLOS_SDK=${{ matrix.SDK }} && mv bin/ bitcoin-bin/
make clean
make DEBUG=0 COIN=bitcoin_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ bitcoin-testnet-bin/
- name: Upload Bitcoin app binary
uses: actions/upload-artifact@v4
with:
name: bitcoin-app-${{ matrix.model }}
path: bitcoin-bin
- name: Upload Bitcoin Testnet app binary
uses: actions/upload-artifact@v4
with:
name: bitcoin-testnet-app-${{ matrix.model }}
path: bitcoin-testnet-bin
job_build_app_perftest:
name: Compile the UX-less version of the app on Nano S+ for performance tests
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Build
run: |
make DEBUG=0 COIN=bitcoin_testnet BOLOS_SDK="$NANOSP_SDK" AUTOAPPROVE_FOR_PERF_TESTS=1
- name: Upload Bitcoin Testnet app binary
uses: actions/upload-artifact@v4
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin
job_unit_test:
name: Unit test
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Build unit tests
run: |
cd unit-tests/
cmake -Bbuild -H. && make -C build && make -C build test
- name: Generate code coverage
run: |
cd unit-tests/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base && \
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture && \
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info && \
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
genhtml coverage.info -o coverage
- uses: actions/upload-artifact@v4
with:
name: code-coverage
path: unit-tests/coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./unit-tests/coverage.info
flags: unittests
name: codecov-app-bitcoin
fail_ci_if_error: true
verbose: true
- name: HTML documentation
run: doxygen .doxygen/Doxyfile
- uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/html
job_test_mainnet:
name: Tests on mainnet
strategy:
matrix:
include:
- model: nanox
- model: nanosp
- model: stax
- model: flex
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download Bitcoin app binary
uses: actions/download-artifact@v4
with:
name: bitcoin-app-${{matrix.model}}
path: bin
- name: Run tests
run: |
cd tests_mainnet
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300
job_test_python_lib_legacyapp:
name: Tests with the Python library and legacy Bitcoin app
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Run tests
run: |
cd bitcoin_client/tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 --model=nanos
job_perftests:
name: Performance report
needs: job_build_app_perftest
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download Bitcoin app binary for perftests
uses: actions/download-artifact@v4
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin
- name: Run tests
run: |
cd tests_perf
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=nanosp --benchmark-json=benchmarks.json
- name: Upload benchmarks summary
uses: actions/upload-artifact@v4
with:
name: benchmarks-log
path: tests_perf/benchmarks.json
job_test_js_lib:
name: Tests with the JS library
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install yarn
run: |
npm install -g yarn
- name: Download Bitcoin Testnet app binary
uses: actions/download-artifact@v4
with:
name: bitcoin-testnet-app-nanosp
path: bin
- name: Run tests
run: |
cd bitcoin_client_js
yarn install
LOG_SPECULOS=1 LOG_APDUS=1 SPECULOS="/speculos/speculos.py" yarn test
job_test_rust_client:
name: Tests for rust client library
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Run tests
run: |
cd bitcoin_client_rs/
cargo test --no-default-features --features="async"