1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 21:48:17 +00:00

build(ci): add thp builds and tests

This commit is contained in:
M1nd3r 2024-12-02 15:35:23 +01:00
parent 8f4268229a
commit d575a22930
3 changed files with 72 additions and 36 deletions

View File

@ -54,10 +54,19 @@ jobs:
model: [T2T1, T3B1, T3T1, T3W1] model: [T2T1, T3B1, T3T1, T3W1]
coins: [universal, btconly] coins: [universal, btconly]
type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink", "production"]' || '["normal", "debuglink"]') }} type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink", "production"]' || '["normal", "debuglink"]') }}
protocol: [v1]
include: include:
- model: D001 - model: D001
coins: universal coins: universal
type: normal type: normal
- model: T2T1
coins: universal
type: debuglink
protocol: v2
- model: T2T1
coins: btconly
type: debuglink
protocol: v2
exclude: exclude:
- model: T3W1 - model: T3W1
type: production type: production
@ -67,6 +76,7 @@ jobs:
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }} PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
PRODUCTION: ${{ matrix.type == 'production' && '1' || '0' }} PRODUCTION: ${{ matrix.type == 'production' && '1' || '0' }}
BOOTLOADER_DEVEL: ${{ matrix.model == 'T3W1' && '1' || '0' }} BOOTLOADER_DEVEL: ${{ matrix.model == 'T3W1' && '1' || '0' }}
THP: ${{ matrix.protocol == 'v2' && '1' || '0'}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -87,7 +97,7 @@ jobs:
if: matrix.coins == 'btconly' && matrix.type != 'debuglink' if: matrix.coins == 'btconly' && matrix.type != 'debuglink'
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: core-firmware-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }} name: core-firmware-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-protocol_${{ matrix.protocol }}
path: | path: |
core/build/boardloader/*.bin core/build/boardloader/*.bin
core/build/bootloader/*.bin core/build/bootloader/*.bin
@ -109,15 +119,28 @@ jobs:
# type: [normal, debuglink] # type: [normal, debuglink]
type: [debuglink] type: [debuglink]
asan: ${{ fromJSON(needs.param.outputs.asan) }} asan: ${{ fromJSON(needs.param.outputs.asan) }}
protocol: [v1]
exclude: exclude:
- type: normal - type: normal
asan: asan asan: asan
include:
- model: T2T1
coins: universal
type: debuglink
asan: noasan
protocol: v2
- model: T2T1
coins: btconly
type: debuglink
asan: noasan
protocol: v2
env: env:
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }} TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }} BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }} PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt" LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
THP: ${{ matrix.protocol == 'v2' && '1' || '0'}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -129,7 +152,7 @@ jobs:
- run: cp core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-${{ matrix.model }}-${{ matrix.coins }} - run: cp core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-${{ matrix.model }}-${{ matrix.coins }}
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }}-protocol_${{ matrix.protocol }}
path: | path: |
core/build/unix/trezor-emu-core* core/build/unix/trezor-emu-core*
core/build/bootloader_emu/bootloader.elf core/build/bootloader_emu/bootloader.elf
@ -174,7 +197,7 @@ jobs:
retention-days: 2 retention-days: 2
core_unit_python_test: core_unit_python_test:
name: Python unit tests name: Python unit tests (${{ matrix.model }}, ${{ matrix.asan }}, protocol_${{ matrix.protocol}})
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: param needs: param
strategy: strategy:
@ -182,10 +205,12 @@ jobs:
matrix: matrix:
model: [T2T1, T3B1, T3T1, T3W1] model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }} asan: ${{ fromJSON(needs.param.outputs.asan) }}
protocol: [v1, v2]
env: env:
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }} TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt" LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
THP: ${{ matrix.protocol == 'v2' && '1' || '0'}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -195,7 +220,7 @@ jobs:
- run: nix-shell --run "poetry run make -C core test" - run: nix-shell --run "poetry run make -C core test"
core_unit_rust_test: core_unit_rust_test:
name: Rust unit tests name: Rust unit tests (${{ matrix.model }}, ${{ matrix.asan }}, protocol_${{ matrix.protocol}})
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- param - param
@ -205,12 +230,14 @@ jobs:
matrix: matrix:
model: [T2T1, T3B1, T3T1, T3W1] model: [T2T1, T3B1, T3T1, T3W1]
asan: ${{ fromJSON(needs.param.outputs.asan) }} asan: ${{ fromJSON(needs.param.outputs.asan) }}
protocol: [v1, v2]
env: env:
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }} TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
RUSTC_BOOTSTRAP: ${{ matrix.asan == 'asan' && '1' || '0' }} RUSTC_BOOTSTRAP: ${{ matrix.asan == 'asan' && '1' || '0' }}
RUSTFLAGS: ${{ matrix.asan == 'asan' && '-Z sanitizer=address' || '' }} RUSTFLAGS: ${{ matrix.asan == 'asan' && '-Z sanitizer=address' || '' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt" LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
THP: ${{ matrix.protocol == 'v2' && '1' || '0'}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -234,7 +261,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-noasan name: core-emu-${{ matrix.model }}-universal-debuglink-noasan-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -257,6 +284,13 @@ jobs:
coins: [universal, btconly] coins: [universal, btconly]
asan: ${{ fromJSON(needs.param.outputs.asan) }} asan: ${{ fromJSON(needs.param.outputs.asan) }}
lang: ${{ fromJSON(needs.param.outputs.test_lang) }} lang: ${{ fromJSON(needs.param.outputs.test_lang) }}
protocol: [v1]
include:
- model: T2T1
coins: universal
asan: noasan
lang: en
protocol: v2
env: env:
TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }} TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }}
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }} TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model }}
@ -265,13 +299,14 @@ jobs:
PYTEST_TIMEOUT: ${{ matrix.asan == 'asan' && 600 || 400 }} PYTEST_TIMEOUT: ${{ matrix.asan == 'asan' && 600 || 400 }}
ACTIONS_DO_UI_TEST: ${{ matrix.coins == 'universal' && matrix.asan == 'noasan' }} ACTIONS_DO_UI_TEST: ${{ matrix.coins == 'universal' && matrix.asan == 'noasan' }}
TEST_LANG: ${{ matrix.lang }} TEST_LANG: ${{ matrix.lang }}
THP: ${{ matrix.protocol == 'v2' && '1' || '0'}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-debuglink-${{ matrix.asan }}-protocol_${{ matrix.protocol }}
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -280,7 +315,7 @@ jobs:
if: failure() if: failure()
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: core-test-device-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.lang }}-${{ matrix.asan }} name: core-test-device-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.lang }}-${{ matrix.asan }}-protocol_${{ matrix.protocol }}
path: tests/trezor.log path: tests/trezor.log
retention-days: 7 retention-days: 7
if: always() if: always()
@ -319,7 +354,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -329,7 +364,7 @@ jobs:
if: ${{ matrix.asan == 'asan' }} if: ${{ matrix.asan == 'asan' }}
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: core-test-click-${{ matrix.model }}-${{ matrix.lang }}-${{ matrix.asan }} name: core-test-click-${{ matrix.model }}-${{ matrix.lang }}-${{ matrix.asan }}-protocol_v1
path: tests/trezor.log path: tests/trezor.log
retention-days: 7 retention-days: 7
if: always() if: always()
@ -367,7 +402,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -397,7 +432,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -430,7 +465,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-noasan name: core-emu-${{ matrix.model }}-universal-debuglink-noasan-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment # XXX poetry maybe not needed - uses: ./.github/actions/environment # XXX poetry maybe not needed
@ -488,7 +523,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-firmware-${{ matrix.model }}-universal-normal # FIXME: s/normal/debuglink/ name: core-firmware-${{ matrix.model }}-universal-normal-protocol_v1 # FIXME: s/normal/debuglink/
path: core/build path: core/build
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
- run: nix-shell --run "poetry run core/tools/size/checker.py core/build/firmware/firmware.elf" - run: nix-shell --run "poetry run core/tools/size/checker.py core/build/firmware/firmware.elf"
@ -512,7 +547,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-firmware-${{ matrix.model }}-universal-normal name: core-firmware-${{ matrix.model }}-universal-normal-protocol_v1
path: core/build path: core/build
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
- run: nix-shell --run "poetry run core/tools/size/compare_master.py core/build/firmware/firmware.elf -r firmware_elf_size_report.txt" - run: nix-shell --run "poetry run core/tools/size/compare_master.py core/build/firmware/firmware.elf -r firmware_elf_size_report.txt"
@ -543,7 +578,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: cachix/install-nix-action@v23 - uses: cachix/install-nix-action@v23
@ -584,7 +619,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -619,7 +654,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1
path: core/build path: core/build
- run: chmod +x core/build/unix/trezor-emu-core* - run: chmod +x core/build/unix/trezor-emu-core*
- uses: ./.github/actions/environment - uses: ./.github/actions/environment
@ -724,7 +759,7 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
pattern: core-emu*debuglink-noasan pattern: core-emu*debuglink-noasan-protocol_v*
merge-multiple: true merge-multiple: true
- name: Configure aws credentials - name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4 uses: aws-actions/configure-aws-credentials@v4
@ -747,7 +782,7 @@ jobs:
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
pattern: core-emu*debuglink-noasan pattern: core-emu*debuglink-noasan-protocol_v*
merge-multiple: true merge-multiple: true
- name: Configure aws credentials - name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4 uses: aws-actions/configure-aws-credentials@v4

View File

@ -307,6 +307,7 @@ core unix frozen debug build:
needs: [] needs: []
variables: variables:
PYOPT: "0" PYOPT: "0"
THP: "1"
script: script:
- $NIX_SHELL --run "poetry run make -C core build_unix_frozen" - $NIX_SHELL --run "poetry run make -C core build_unix_frozen"
artifacts: artifacts:

View File

@ -106,44 +106,44 @@ Frozen version. That means you do not need any other files to run it,
it is just a single binary file that you can execute directly. it is just a single binary file that you can execute directly.
**Are you looking for a Trezor T emulator? This is most likely it.** **Are you looking for a Trezor T emulator? This is most likely it.**
### [core unix frozen R debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L317) ### [core unix frozen R debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L318)
### [core unix frozen T3T1 debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L332) ### [core unix frozen T3T1 debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L333)
### [core unix frozen R debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L346) ### [core unix frozen R debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L347)
### [core unix frozen T3T1 debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L369) ### [core unix frozen T3T1 debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L370)
### [core unix frozen debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L392) ### [core unix frozen debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L393)
### [core unix frozen debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L408) ### [core unix frozen debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L409)
### [core macos frozen regular build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L430) ### [core macos frozen regular build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L431)
### [crypto build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L455) ### [crypto build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L456)
Build of our cryptographic library, which is then incorporated into the other builds. Build of our cryptographic library, which is then incorporated into the other builds.
### [legacy fw regular build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L485) ### [legacy fw regular build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L486)
### [legacy fw regular debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L501) ### [legacy fw regular debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L502)
### [legacy fw btconly build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L518) ### [legacy fw btconly build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L519)
### [legacy fw btconly debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L537) ### [legacy fw btconly debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L538)
### [legacy emu regular debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L558) ### [legacy emu regular debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L559)
Regular version (not only Bitcoin) of above. Regular version (not only Bitcoin) of above.
**Are you looking for a Trezor One emulator? This is most likely it.** **Are you looking for a Trezor One emulator? This is most likely it.**
### [legacy emu regular debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L573) ### [legacy emu regular debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L574)
### [legacy emu regular debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L591) ### [legacy emu regular debug build arm](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L592)
### [legacy emu btconly debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L617) ### [legacy emu btconly debug build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L618)
Build of Legacy into UNIX emulator. Use keyboard arrows to emulate button presses. Build of Legacy into UNIX emulator. Use keyboard arrows to emulate button presses.
Bitcoin-only version. Bitcoin-only version.
### [legacy emu btconly debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L634) ### [legacy emu btconly debug asan build](https://github.com/trezor/trezor-firmware/blob/master/ci/build.yml#L635)
--- ---
## TEST stage - [test.yml](https://github.com/trezor/trezor-firmware/blob/master/ci/test.yml) ## TEST stage - [test.yml](https://github.com/trezor/trezor-firmware/blob/master/ci/test.yml)