forked from bitcoin-core/HWI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
404 lines (382 loc) · 12.7 KB
/
.cirrus.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
env:
EMAIL: [email protected]
python_version_matrix_template: &PYTHON_VERSION_MATRIX_TEMPLATE
- container:
dockerfile: ci/py37.Dockerfile
env:
PYTHON: 3.7
- container:
dockerfile: ci/cirrus.Dockerfile
env:
PYTHON: 3.8
- container:
dockerfile: ci/py39.Dockerfile
env:
PYTHON: 3.9
- container:
dockerfile: ci/py310.Dockerfile
env:
PYTHON: 3.10
- container:
dockerfile: ci/py311.Dockerfile
env:
PYTHON: 3.11
device_matrix_template: &DEVICE_MATRIX_TEMPLATE
- env:
DEVICE: --trezor-1
depends_on:
- Trezor 1 Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Trezor 1 Sim Builder/sim/trezor-firmware.tar.gz"
- tar -xvf "trezor-firmware.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --trezor-t
depends_on:
- Trezor T Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Trezor T Sim Builder/sim/trezor-firmware.tar.gz"
- tar -xvf "trezor-firmware.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --onekey-1
depends_on:
- Onekey Legacy Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Onekey Legacy Sim Builder/sim/onekey-firmware.tar.gz"
- tar -xvf "onekey-firmware.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --onekey-t
depends_on:
- Onekey Touch Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Onekey Touch Sim Builder/sim/onekey-firmware.tar.gz"
- tar -xvf "onekey-firmware.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --coldcard
depends_on:
- Coldcard Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Coldcard Sim Builder/sim/coldcard-mpy.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
sim_install_script:
- pushd test/work; git clone --recursive https://github.com/Coldcard/firmware.git; popd
- tar -xvf "coldcard-mpy.tar.gz"
- pushd test/work/firmware; git am ../../data/coldcard-multisig.patch; popd
- poetry run pip install -r test/work/firmware/requirements.txt
- pip install -r test/work/firmware/requirements.txt
- env:
DEVICE: --bitbox01
depends_on:
- Bitbox01 Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Bitbox01 Sim Builder/sim/mcu.tar.gz"
- tar -xvf "mcu.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --jade
depends_on:
- Jade Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Jade Sim Builder/sim/jade.tar.gz"
- tar -xvf "jade.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --ledger
depends_on:
- Ledger Sim Builder
- Ledger App Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Ledger Sim Builder/sim/speculos.tar.gz"
- tar -xvf "speculos.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
fetch_ledger_app_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Ledger App Builder/built_ledger_app/app-bitcoin-new/bin/app.elf"
- mv app.elf test/work/speculos/apps/btc-test.elf
sim_install_script:
- poetry run pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- env:
DEVICE: --ledger-legacy
depends_on:
- Ledger Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Ledger Sim Builder/sim/speculos.tar.gz"
- tar -xvf "speculos.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
sim_install_script:
- poetry run pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- env:
DEVICE: --keepkey
depends_on:
- Keepkey Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Keepkey Sim Builder/sim/keepkey-firmware.tar.gz"
- tar -xvf "keepkey-firmware.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
task:
container:
image: python:latest
install_script:
- pip install poetry
- poetry install
matrix:
- name: Type Check
type_check_script: >
poetry run
mypy
hwi.py
hwilib/_base58.py
hwilib/_bech32.py
hwilib/_cli.py
hwilib/commands.py
hwilib/common.py
hwilib/descriptor.py
hwilib/devices/bitbox02.py
hwilib/devices/coldcard.py
hwilib/devices/digitalbitbox.py
hwilib/devices/jade.py
hwilib/devices/__init__.py
hwilib/devices/keepkey.py
hwilib/devices/ledger.py
hwilib/devices/trezor.py
hwilib/devices/onekey.py
hwilib/errors.py
hwilib/_script.py
hwilib/_serialize.py
hwilib/tx.py
hwilib/hwwclient.py
hwilib/__init__.py
hwilib/key.py
hwilib/udevinstaller.py
- name: Non-Device Tests
test_script: cd test; poetry run ./run_tests.py; cd ..
- name: lint
test_script: poetry run flake8
wine_builder_task:
container:
dockerfile: contrib/build-wine.Dockerfile
build_script:
- contrib/build_wine.sh
- find dist -type f -exec sha256sum {} \;
bitcoind_builder_task:
container:
dockerfile: ci/cirrus.Dockerfile
bitcoind_cache:
folder: test/work/bitcoin
ccache_cache:
folder: /root/.ccache
env:
BUILD_BITCOIND: 1
build_script:
- cd test; ./setup_environment.sh --bitcoind; cd ..
- tar -czf bitcoin.tar.gz test/work/bitcoin
bitcoin_artifacts:
path: "bitcoin.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --trezor-1
name: Trezor 1 Sim Builder
sim_work_cache:
folder: test/work/trezor-firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf trezor-firmware.tar.gz test/work/trezor-firmware
sim_artifacts:
path: "trezor-firmware.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --trezor-t
name: Trezor T Sim Builder
sim_work_cache:
folder: test/work/trezor-firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf trezor-firmware.tar.gz test/work/trezor-firmware
sim_artifacts:
path: "trezor-firmware.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --onekey-1
name: Onekey Legacy Sim Builder
sim_work_cache:
folder: test/work/onekey-firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf onekey-firmware.tar.gz test/work/onekey-firmware
sim_artifacts:
path: "onekey-firmware.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --onekey-t
name: Onekey Touch Sim Builder
sim_work_cache:
folder: test/work/onekey-firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf onekey-firmware.tar.gz test/work/onekey-firmware
sim_artifacts:
path: "onekey-firmware.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --coldcard
name: Coldcard Sim Builder
sim_work_cache:
folder: test/work/firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf coldcard-mpy.tar.gz test/work/firmware/external/micropython/ports/unix/coldcard-mpy test/work/firmware/unix/coldcard-mpy test/work/firmware/unix/l-mpy test/work/firmware/unix/l-port
sim_artifacts:
path: "coldcard-mpy.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --bitbox01
name: Bitbox01 Sim Builder
sim_work_cache:
folder: test/work/mcu
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf mcu.tar.gz test/work/mcu
sim_artifacts:
path: "mcu.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --jade
name: Jade Sim Builder
sim_work_cache:
folder: test/work/jade
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf jade.tar.gz test/work/jade/simulator
sim_artifacts:
path: "jade.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --ledger
name: Ledger Sim Builder
sim_work_cache:
folder: test/work/speculos
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf speculos.tar.gz test/work/speculos
sim_artifacts:
path: "speculos.tar.gz"
task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --keepkey
name: Keepkey Sim Builder
sim_work_cache:
folder: test/work/keepkey-firmware
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf keepkey-firmware.tar.gz test/work/keepkey-firmware/bin
sim_artifacts:
path: "keepkey-firmware.tar.gz"
dist_builder_task:
container:
dockerfile: contrib/build.Dockerfile
build_script:
- contrib/build_bin.sh
- contrib/build_dist.sh
- find dist -type f -exec sha256sum {} \;
built_dist_artifacts:
path: "dist/*"
ledger_app_builder_task:
name: Ledger App Builder
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
build_script:
- git clone https://github.com/LedgerHQ/app-bitcoin-new.git
- cd app-bitcoin-new
- make DEBUG=1
built_ledger_app_artifacts:
path: app-bitcoin-new/bin/app.elf
task:
matrix:
<< : *PYTHON_VERSION_MATRIX_TEMPLATE
matrix:
<< : *DEVICE_MATRIX_TEMPLATE
fetch_dist_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/dist_builder/built_dist.zip"
- unzip built_dist.zip
matrix:
- name: Python $PYTHON $DEVICE Wheel
install_script: pip install dist/*.whl
test_script: cd test; ./run_tests.py $DEVICE --interface=cli --device-only; cd ..
- name: Python $PYTHON $DEVICE Sdist
install_script: pip install $(find dist -name "*.tar.gz" -a -not -name "*linux*")
test_script: cd test; ./run_tests.py $DEVICE --interface=cli --device-only; cd ..
- name: Python $PYTHON $DEVICE Bindist
install_script: poetry install
untar_bindist_script: cd dist; tar -xvf hwi*linux*.tar.gz; cd ..
test_script: cd test; poetry run ./run_tests.py $DEVICE --interface=bindist --device-only; cd ..
on_failure:
failed_script: tail -v -n +1 test/*.std*
task:
matrix:
<< : *PYTHON_VERSION_MATRIX_TEMPLATE
install_script: poetry install
matrix:
<< : *DEVICE_MATRIX_TEMPLATE
matrix:
- env:
INTERFACE: library
- env:
INTERFACE: cli
- env:
INTERFACE: stdin
name: Python $PYTHON $DEVICE $INTERFACE
test_script: cd test; poetry run ./run_tests.py $DEVICE --interface=$INTERFACE --device-only; cd ..
on_failure:
failed_script: tail -v -n +1 test/*.std*