-
-
Notifications
You must be signed in to change notification settings - Fork 773
856 lines (825 loc) · 36.6 KB
/
core.yml
File metadata and controls
856 lines (825 loc) · 36.6 KB
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
name: Core
on:
pull_request:
types:
- opened
- reopened
- synchronize # branch head update
- labeled
workflow_dispatch:
schedule:
- cron: '15 23 * * *' # every day @ 23:15
push:
branches:
- 'release/**'
- 'secfix/**'
# cancel any previous runs on the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
id-token: write # for fetching the OIDC token
contents: read # for actions/checkout
pull-requests: write # for dflook comments on PR
env:
SDL_VIDEODRIVER: dummy
PULL_COMMENT_PATH: ${{ github.workspace }}/tests/core-pull-comment.md
TREZOR_PYTEST_LOGS_DIR: ${{ github.workspace }}/tests/
jobs:
param:
name: Determine pipeline parameters
runs-on: ubuntu-latest
outputs:
test_lang: ${{ steps.set_vars.outputs.test_lang }}
asan: ${{ steps.set_vars.outputs.asan }}
steps:
- id: set_vars
name: Set variables
run: |
echo test_lang=${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'translations'))) && '[\"en\", \"cs\", \"fr\", \"de\", \"es\", \"pt\"]' || '[\"en\"]' }} >> $GITHUB_OUTPUT
# TODO: fix ASAN tests on nightly CI runs (#5143)
echo asan=${{ '[\"noasan\"]' }} >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
core_firmware:
name: Build firmware (${{ matrix.model }}, ${{ matrix.coins }}, ${{ matrix.type }}${{matrix.n4w1 && ', n4w1' || '' }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
model: ${{ fromJSON(github.event_name == 'push' && '["T2B1", "T2T1", "T3B1", "T3T1", "T3W1"]' || '["T2T1", "T3B1", "T3T1", "T3W1"]') }}
coins: [universal, btconly]
type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink", "production"]' || '["normal", "debuglink"]') }}
n4w1: [false]
include:
- model: D001
coins: universal
type: normal
- model: T2B1
coins: universal
type: normal
- model: T3W1
coins: universal
type: debuglink
n4w1: true # currently N4W1 is not supported for normal builds
exclude:
- model: T3W1
type: production
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
N4W1: ${{ matrix.n4w1 && '1' || '0' }}
PRODUCTION: ${{ matrix.type == 'production' && '1' || '0' }}
BOOTLOADER_DEVEL: ${{ matrix.model == 'T3W1' && '1' || '0' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core build_boardloader"
if: matrix.coins == 'universal' && matrix.type != 'debuglink'
- run: nix-shell --run "uv run make -C core build_bootloader"
if: matrix.coins == 'universal' && matrix.type != 'debuglink'
- run: nix-shell --run "uv run make -C core build_bootloader_ci"
if: matrix.coins == 'universal' && matrix.type != 'debuglink' && matrix.model == 'T2T1'
- run: nix-shell --run "uv run make -C core build_prodtest"
if: matrix.coins == 'universal' && matrix.type != 'debuglink'
- run: nix-shell --run "uv run make -C core build_prodtest_emu"
if: matrix.coins == 'universal' && matrix.type != 'debuglink' && matrix.model == 'T3W1'
- run: nix-shell --run "uv run make -C core build_firmware"
- run: nix-shell --run "uv run ./tools/print-rust-stack-sizes.py | sort -k1 -n | tail -n 50"
# - run: nix-shell --run "uv run ./tools/print-rust-type-sizes.sh core/build/firmware/rust-type-sizes.log" | awk '$1 >= 1000' | sort -k1 -n
- run: nix-shell --run "uv run ./tools/check-bitcoin-only core/build-xtask/artifacts/latest/firmware.bin"
if: matrix.coins == 'btconly' && matrix.type != 'debuglink'
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-firmware-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}${{ matrix.n4w1 && '-n4w1' || '' }}
path: |
core/build-xtask/artifacts/latest/*.bin
core/build-xtask/artifacts/latest/*.elf
core/build-xtask/artifacts/pub/*
retention-days: 7
core_emu:
name: Build emu (${{ matrix.model }}, ${{ matrix.coins }}, ${{ matrix.type }}, ${{ matrix.asan }}${{matrix.n4w1 && ', n4w1' || '' }})
runs-on: ubuntu-latest
needs: param
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
coins: [universal, btconly]
# type: [normal, debuglink]
type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink"]' || '["debuglink"]') }}
asan: ${{ fromJSON(needs.param.outputs.asan) }}
n4w1: [false]
exclude:
- type: normal
asan: asan
include:
- model: T3W1
coins: universal
type: debuglink
asan: noasan
n4w1: true # currently N4W1 is not supported for normal builds
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
N4W1: ${{ matrix.n4w1 && '1' || '0' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
DISABLE_TROPIC: 0
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core build_bootloader_emu"
if: matrix.coins == 'universal' && matrix.asan == 'noasan'
- run: nix-shell --run "uv run make -C core build_unix_frozen"
- name: Start Tropic model
if: ${{ matrix.model == 'T3W1' }}
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- run: nix-shell --run "uv run make -C core test_emu_sanity"
- run: cp core/build-xtask/artifacts/latest/firmware-emu core/build-xtask/artifacts/latest/firmware-emu-${{ matrix.model }}-${{ matrix.coins }}${{ matrix.n4w1 && '-n4w1' || '' }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }}${{ matrix.n4w1 && '-n4w1' || '' }}
path: |
core/build-xtask/artifacts/latest/firmware-emu*
core/build-xtask/artifacts/latest/bootloader-emu
core/build-xtask/artifacts/latest/mpy-files/**/*.i
retention-days: 7
core_emu_arm:
if: github.event_name == 'schedule'
name: Build emu ARM (${{ matrix.model }}, ${{ matrix.coins }}, ${{ matrix.type }}, ${{ matrix.asan }}${{matrix.n4w1 && ', n4w1' || '' }})
runs-on: ubuntu-latest-arm64
needs: param
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
coins: [universal]
type: [debuglink]
asan: [noasan]
n4w1: [false]
include:
- model: T3W1
coins: universal
type: debuglink
asan: noasan
n4w1: true # currently N4W1 is not supported for normal builds
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
N4W1: ${{ matrix.n4w1 && '1' || '0' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core build_bootloader_emu"
if: matrix.coins == 'universal'
- run: nix-shell --run "uv run make -C core build_unix_frozen"
- run: mv core/build-xtask/artifacts/latest/firmware-emu core/build-xtask/artifacts/latest/firmware-emu-arm-${{ matrix.model }}-${{ matrix.coins }}${{ matrix.n4w1 && '-n4w1' || '' }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-emu-arm-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }}${{ matrix.n4w1 && '-n4w1' || '' }}
path: |
core/build-xtask/artifacts/latest/firmware-emu*
core/build-xtask/artifacts/latest/bootloader-emu
retention-days: 2
core_unit_python_test:
name: Python unit tests (${{ matrix.model }}, ${{ matrix.coins }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs: param
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
coins: ${{ fromJSON(github.event_name == 'schedule' && '["universal", "btconly"]' || '["universal"]') }}
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
DISABLE_TROPIC: 0
PYOPT: 0
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core build_unix"
- name: Start Tropic model
if: ${{ matrix.model == 'T3W1' }}
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- run: nix-shell --run "uv run make -C core test"
- run: nix-shell --run "uv run make -C core test_emu_sanity" # sanity check non-frozen emulator
core_unit_rust_test:
name: Rust unit tests (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_MODEL: ${{ matrix.model }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
RUSTC_BOOTSTRAP: ${{ matrix.asan == 'asan' && '1' || '0' }}
RUSTFLAGS: ${{ matrix.asan == 'asan' && '-Z sanitizer=address' || '' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core -f Makefile.scons build_unix"
# Ensure that "cargo build" works when NOT executed through our makefiles,
# indicating that it does not rely on particular envvars or other flags.
# This makes sure that rust-analyzer will work on our codebase.
- run: nix-shell --run "cd core/embed/rust && cargo build"
if: matrix.asan == 'noasan'
- run: nix-shell --run "uv run make -C core -f Makefile.scons test_rust"
- run: nix-shell --run "uv run make -C core clippy"
- run: nix-shell --run "uv run make -C core audit_rust"
core_rust_client_test:
name: Rust trezor-client tests
runs-on: ubuntu-latest
needs: core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-noasan
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run core/emu.py --headless -q --temporary-profile --slip0014 --command cargo test --manifest-path rust/trezor-client/Cargo.toml"
# Device tests for Core. Running device tests and also comparing screens
# with the expected UI result.
# See artifacts for a comprehensive report of UI.
# See [docs/tests/ui-tests](../tests/ui-tests.md) for more info.
core_device_test:
name: Device tests (${{ matrix.model }}, ${{ matrix.coins }}, ${{ matrix.asan }}, ${{ matrix.lang }}${{ matrix.n4w1 && ', n4w1' || '' }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
coins: [universal, btconly]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
lang: ${{ fromJSON(needs.param.outputs.test_lang) }}
n4w1: [false]
include:
- model: T3W1
coins: universal
asan: noasan
lang: en
n4w1: true
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
TREZOR_MODEL: ${{ matrix.model }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
PYTEST_TIMEOUT: ${{ matrix.asan == 'asan' && 600 || 400 }}
ACTIONS_DO_UI_TEST: ${{ matrix.coins == 'universal' && matrix.asan == 'noasan' }}
TEST_LANG: ${{ matrix.lang }}
TESTOPTS: "--durations 10 --session-timeout ${{ matrix.model == 'T3W1' && '3000' || '1800' }}" # pytest global timeout
timeout-minutes: ${{ matrix.model == 'T3W1' && 60 || 40 }} # CI job timeout
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-debuglink-${{ matrix.asan }}${{ matrix.n4w1 && '-n4w1' || '' }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- name: Start Tropic model
if: ${{ env.TREZOR_MODEL == 'T3W1' && env.ACTIONS_DO_UI_TEST != 'true' }} # ACTIONS_DO_UI_TEST refers to the test_emu_ui_multicore below which uses --control-emulators and starts tvl internally
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- name: Run device tests
if: ${{ !matrix.n4w1 }}
run: nix-shell --run "uv run make -C core ${{ env.ACTIONS_DO_UI_TEST == 'true' && 'test_emu_ui_multicore' || 'test_emu' }}"
- name: Run device tests (N4W1)
if: ${{ matrix.n4w1 }} # TODO(N4W1): test N4W1 UI fixtures as well
run: nix-shell --run "uv run make -C core ${{ env.ACTIONS_DO_UI_TEST == 'true' && 'test_emu_multicore' || 'test_emu' }}"
- run: tail -v -n50 tests/trezor*.log || true
if: failure()
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-device-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.lang }}-${{ matrix.asan }}${{ matrix.n4w1 && '-n4w1' || '' }}
path: tests/trezor*.log
retention-days: 7
if: always()
- uses: ./.github/actions/ui-report
with:
model: ${{ matrix.model }}
lang: ${{ matrix.lang }}
status: ${{ job.status }}
if: ${{ always() && env.ACTIONS_DO_UI_TEST == 'true' && !matrix.n4w1 }}
continue-on-error: true
- uses: ./.github/actions/upload-coverage
if: ${{ !matrix.n4w1 }}
# Click tests - UI.
# See [docs/tests/click-tests](../tests/click-tests.md) for more info.
core_click_test:
name: Click tests (${{ matrix.model }}, ${{ matrix.asan }}, ${{ matrix.lang }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
lang: ${{ fromJSON(needs.param.outputs.test_lang) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
# MULTICORE: 4 # more could interfere with other jobs
PYTEST_TIMEOUT: 400
TEST_LANG: ${{ matrix.lang }}
TESTOPTS: "--durations 10"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core test_emu_click_ui_multicore"
if: ${{ matrix.asan == 'noasan' }}
- run: nix-shell --run "uv run make -C core test_emu_click"
if: ${{ matrix.asan == 'asan' }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-click-${{ matrix.model }}-${{ matrix.lang }}-${{ matrix.asan }}
path: tests/trezor*.log
retention-days: 7
if: always()
- uses: ./.github/actions/ui-report
with:
model: ${{ matrix.model }}
lang: ${{ matrix.lang }}
status: ${{ job.status }}
if: always()
continue-on-error: true
- uses: ./.github/actions/upload-coverage
# Upgrade tests.
# See [docs/tests/upgrade-tests](../tests/upgrade-tests.md) for more info.
core_upgrade_test:
name: Upgrade tests (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
# FIXME: T3B1 https://github.com/trezor/trezor-firmware/issues/2724
# FIXME: T3T1 https://github.com/trezor/trezor-firmware/issues/3595
model: [T2T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
PYTEST_TIMEOUT: 20
TESTOPTS: "--durations 10"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- name: Set upgrade selector
run: |
echo "TREZOR_UPGRADE_TEST=${{ matrix.model }}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
with:
full-deps: "true"
- run: nix-shell --arg fullDeps true --run "tests/download_emulators.sh ${{ matrix.model }}"
- run: nix-shell --arg fullDeps true --run "uv run pytest tests/upgrade_tests"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-upgrade-${{ matrix.model }}-${{ matrix.asan }}
path: |
tests/trezor*.log
retention-days: 7
if: always()
# Persistence tests - UI.
core_persistence_test:
name: Persistence tests (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
PYTEST_TIMEOUT: 400
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- name: Set upgrade selector
run: |
echo "TREZOR_UPGRADE_TEST=${{ matrix.model }}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- name: Start Tropic model
if: ${{ matrix.model == 'T3W1' }}
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- run: nix-shell --run "uv run make -C core test_emu_persistence_ui"
if: ${{ matrix.asan == 'noasan' }}
- run: nix-shell --run "uv run make -C core test_emu_persistence"
if: ${{ matrix.asan == 'asan' }}
- uses: ./.github/actions/ui-report
with:
model: ${{ matrix.model }}
lang: en
status: ${{ job.status }}
if: always()
continue-on-error: true
- uses: ./.github/actions/upload-coverage
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-persistence-${{ matrix.model }}-${{ matrix.asan }}
path: |
tests/trezor*.log
retention-days: 7
if: always()
core_hwi_test:
name: HWI tests
if: false # XXX currently failing
continue-on-error: true
runs-on: ubuntu-latest
needs: core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-noasan
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
with:
full-deps: "true"
- run: nix-shell --run "git clone --depth=1 https://github.com/bitcoin-core/HWI.git"
- run: nix-shell --arg fullDeps true --run "cd HWI && poetry install && poetry run ./test/test_trezor.py --model_t ../core/build-xtask/artifacts/latest/firmware-emu bitcoind"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-hwi-${{ matrix.model }}
path: HWI/trezor-t-emulator.stdout
retention-days: 7
core_memory_profile:
name: Memory allocation report
if: false # NOTE manual job, comment out to run
runs-on: ubuntu-latest
env:
TREZOR_MODEL: T2T1
TREZOR_MEMPERF: 1
PYOPT: 0
PYTEST_TIMEOUT: 900
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run make -C core build_unix_frozen"
- run: nix-shell --run "uv run make -C core test_emu"
- run: nix-shell --run "mkdir core/prof/memperf-html"
- run: nix-shell --run "uv run core/tools/alloc.py --alloc-data=core/src/alloc_data.txt html core/prof/memperf-html"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-memperf-${{ matrix.model }}
path: |
tests/trezor*.log
core/prof/memperf-html
retention-days: 7
if: always()
# Flash size profiling
# Finds out how much flash space we have left in the firmware build
# Fails if the free space is less than certain threshold
core_flash_size_check:
name: Flash size check
runs-on: ubuntu-latest
needs: core_firmware
strategy:
fail-fast: false
matrix:
model: [T2T1] # FIXME: checker.py lacks awareness of U5 flash layout
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-firmware-${{ matrix.model }}-universal-normal # FIXME: s/normal/debuglink/
path: core/build-xtask/artifacts
- uses: ./.github/actions/environment
- run: nix-shell --run "uv run core/tools/size/checker.py core/build-xtask/artifacts/latest/firmware.elf"
# Monero tests.
core_monero_test:
name: Monero test (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
PYTEST_TIMEOUT: 400
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
with:
full-deps: "true"
- run: nix-shell --arg fullDeps true --run "uv run make -C core test_emu_monero"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-monero-${{ matrix.model }}-${{ matrix.asan }}
path: |
tests/trezor*.log
core/tests/trezor_monero_tests.log
retention-days: 7
if: always()
- uses: ./.github/actions/upload-coverage
# Tests for U2F and HID.
core_u2f_test:
name: U2F test (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
PYTEST_TIMEOUT: 400
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- name: Start Tropic model
if: ${{ matrix.model == 'T3W1' }}
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- run: nix-shell --run "uv run make -C tests/fido_tests/u2f-tests-hid"
- run: nix-shell --run "uv run make -C core test_emu_u2f"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-u2f-${{ matrix.model }}-${{ matrix.asan }}
path: tests/trezor*.log
retention-days: 7
if: always()
- uses: ./.github/actions/upload-coverage
# FIDO2 device tests.
core_fido2_test:
name: FIDO2 test (${{ matrix.model }}, ${{ matrix.asan }})
runs-on: ubuntu-latest
needs:
- param
- core_emu
strategy:
fail-fast: false
matrix:
model: [T2T1, T3T1, T3W1] # XXX T3B1 https://github.com/trezor/trezor-firmware/issues/2724
asan: ${{ fromJSON(needs.param.outputs.asan) }}
env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
PYTEST_TIMEOUT: 400
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}
path: core/build-xtask/artifacts/latest
- run: chmod +x core/build-xtask/artifacts/latest/firmware-emu*
- uses: ./.github/actions/environment
- name: Start Tropic model
if: ${{ matrix.model == 'T3W1' }}
run: nix-shell --run "uv run model_server tcp -c tests/tropic_model/config.yml > tests/trezor-tropic-model.log 2>&1 &"
- run: nix-shell --run "uv run make -C core test_emu_fido2"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-test-fido2-${{ matrix.model }}-${{ matrix.asan }}
path: |
tests/trezor*.log
retention-days: 7
if: always()
- uses: ./.github/actions/upload-coverage
core_coverage_report:
name: Coverage report
runs-on: ubuntu-latest
needs:
- core_emu
- core_click_test
- core_persistence_test
- core_device_test
- core_monero_test
- core_u2f_test
- core_fido2_test
strategy:
fail-fast: false
matrix:
model: [T2T1, T3B1, T3T1, T3W1]
env:
COVERAGE_THRESHOLD: 85
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
submodules: recursive
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
pattern: core-coverage-${{ matrix.model }}-*
path: core
merge-multiple: true
# Reuse the frozen-build artifact produced by `core_emu` (noasan variant
# matches the test jobs that set TREZOR_PROFILING=1) so the preprocessed
# .i sources are available without rebuilding.
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
name: core-emu-${{ matrix.model }}-universal-debuglink-noasan
path: core/build-xtask/artifacts/latest
- uses: ./.github/actions/environment
# `make coverage` uses .i files downloaded above
- run: nix-shell --run "uv run make -C core coverage"
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # actions/upload-artifact@v7.0.0
with:
name: core-coverage-report-${{ matrix.model }}
path: core/htmlcov
retention-days: 7
include-hidden-files: true
if: always()
binaries_size_report:
name: Binaries' size report
runs-on: ubuntu-latest
needs:
- core_firmware
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
pattern: core-firmware-*
path: artifacts
- run: |
for build_type in normal debuglink
do
(echo '##' ${build_type}; \
echo '```'; \
find artifacts/core-firmware-*-${build_type}/ -name '*-*-*.bin' -printf "%-40f %10s\n" | sort; \
echo '```') >> $GITHUB_STEP_SUMMARY
done
core_ui_comment:
name: Post comment with UI diff URLs
# run UI comment job only for 'trezor/trezor-firmware' scheduled workflows and internal PRs (see #5381)
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.repository == 'trezor/trezor-firmware'
runs-on: ubuntu-latest
needs:
- param
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
- run: sleep 1m # try avoiding github api rate limit
- run: |
python ci/make_pull_comment.py "${{ github.run_id }}" '${{ needs.param.outputs.test_lang }}' > ${{ env.PULL_COMMENT_PATH }}
cat ${{ env.PULL_COMMENT_PATH }} >> $GITHUB_STEP_SUMMARY
- uses: ./.github/actions/ui-comment
if: github.event_name == 'pull_request'
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # aws-actions/configure-aws-credentials@v6.0.0
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
- run: python ci/make_summary_htmls.py "index" '${{ needs.param.outputs.test_lang }}' "tests/ui_tests/reporting/"
- run: python ci/make_summary_htmls.py "diff" '${{ needs.param.outputs.test_lang }}' "tests/ui_tests/reporting/"
- name: Upload per-language HTML summaries to S3
run: |
cd tests/ui_tests/reporting/
for F in *.html
do
aws s3 cp $F s3://data.trezor.io/dev/firmware/ui_report/${{ github.run_id }}/$F
done
core_upload_emu:
name: Upload emulator binaries
if: github.event_name == 'schedule' && github.repository == 'trezor/trezor-firmware'
runs-on: ubuntu-latest
needs:
- core_emu
- core_emu_arm
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
pattern: core-emu*debuglink-noasan*
merge-multiple: true
path: emulators
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # aws-actions/configure-aws-credentials@v6.0.0
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Upload nightly artifacts
run: |
rm -rf emulators/{bootloader,firmware}-emu emulators/mpy-files emulators/*.json
pushd emulators
for F in firmware-emu-*; do NEWF=`echo $F | sed s/firmware-emu/trezor-emu-core/`; mv $F $NEWF; done
popd
tree
aws s3 sync --only-show-errors emulators s3://data.trezor.io/dev/firmware/emu-nightly
core_upload_emu_branch:
name: Upload emulator binaries for the current branch
# Not building it for nightly CI
if: github.event_name != 'schedule' && github.repository == 'trezor/trezor-firmware'
runs-on: ubuntu-latest
needs:
# Do not include ARM, they are only built on nightly
- core_emu
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # actions/download-artifact@v8.0.0
with:
pattern: core-emu*debuglink-noasan*
merge-multiple: true
path: emulators
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # aws-actions/configure-aws-credentials@v6.0.0
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Determine branch name
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
branch_name=${{ github.head_ref }}
else
branch_name=${{ github.ref_name }}
fi
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Upload artifacts to branch directory
run: |
rm -rf emulators/{bootloader,firmware}-emu emulators/mpy-files emulators/*.json
pushd emulators
for F in firmware-emu-*; do NEWF=`echo $F | sed s/firmware-emu/trezor-emu-core/`; mv $F $NEWF; done
popd
tree
aws s3 sync --only-show-errors emulators s3://data.trezor.io/dev/firmware/emu-branches/$branch_name
# Connect
# TODO: core_connect_test