From 1d691cfc48d56eabad7a6af8d8bcfc488ab56693 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Mon, 2 Dec 2024 15:35:23 +0100 Subject: [PATCH] build(ci): add thp builds and tests --- .github/workflows/core.yml | 73 ++++++++++++++++++++++++++++---------- ci/build.yml | 1 + docs/ci/jobs.md | 34 +++++++++--------- 3 files changed, 72 insertions(+), 36 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 66187d01bf..401ba95ecd 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -57,10 +57,19 @@ jobs: model: [T2T1, T3B1, T3T1, T3W1] coins: [universal, btconly] type: ${{ fromJSON(github.event_name == 'schedule' && '["normal", "debuglink", "production"]' || '["normal", "debuglink"]') }} + protocol: [v1] include: - model: D001 coins: universal type: normal + - model: T2T1 + coins: universal + type: debuglink + protocol: v2 + - model: T2T1 + coins: btconly + type: debuglink + protocol: v2 exclude: - model: T3W1 type: production @@ -70,6 +79,7 @@ jobs: PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }} PRODUCTION: ${{ matrix.type == 'production' && '1' || '0' }} BOOTLOADER_DEVEL: ${{ matrix.model == 'T3W1' && '1' || '0' }} + THP: ${{ matrix.protocol == 'v2' && '1' || '0'}} steps: - uses: actions/checkout@v4 with: @@ -90,7 +100,7 @@ jobs: if: matrix.coins == 'btconly' && matrix.type != 'debuglink' - uses: actions/upload-artifact@v4 with: - name: core-firmware-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }} + name: core-firmware-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-protocol_${{ matrix.protocol }} path: | core/build/boardloader/*.bin core/build/bootloader/*.bin @@ -112,15 +122,28 @@ jobs: # type: [normal, debuglink] type: [debuglink] asan: ${{ fromJSON(needs.param.outputs.asan) }} + protocol: [v1] exclude: - type: normal asan: asan + include: + - model: T2T1 + coins: universal + type: debuglink + asan: noasan + protocol: v2 + - model: T2T1 + coins: btconly + type: debuglink + asan: noasan + protocol: v2 env: TREZOR_MODEL: ${{ matrix.model }} BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }} PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }} ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt" + THP: ${{ matrix.protocol == 'v2' && '1' || '0'}} steps: - uses: actions/checkout@v4 with: @@ -132,7 +155,7 @@ jobs: - run: cp core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-${{ matrix.model }}-${{ matrix.coins }} - uses: actions/upload-artifact@v4 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: | core/build/unix/trezor-emu-core* core/build/bootloader_emu/bootloader.elf @@ -177,7 +200,7 @@ jobs: retention-days: 2 core_unit_python_test: - name: Python unit tests + name: Python unit tests (${{ matrix.model }}, ${{ matrix.asan }}, protocol_${{ matrix.protocol}}) runs-on: ubuntu-latest needs: param strategy: @@ -185,10 +208,12 @@ jobs: matrix: model: [T2T1, T3B1, T3T1, T3W1] asan: ${{ fromJSON(needs.param.outputs.asan) }} + protocol: [v1, v2] env: TREZOR_MODEL: ${{ matrix.model }} ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt" + THP: ${{ matrix.protocol == 'v2' && '1' || '0'}} steps: - uses: actions/checkout@v4 with: @@ -198,7 +223,7 @@ jobs: - run: nix-shell --run "poetry run make -C core test" core_unit_rust_test: - name: Rust unit tests + name: Rust unit tests (${{ matrix.model }}, ${{ matrix.asan }}, protocol_${{ matrix.protocol}}) runs-on: ubuntu-latest needs: - param @@ -208,12 +233,14 @@ jobs: matrix: model: [T2T1, T3B1, T3T1, T3W1] asan: ${{ fromJSON(needs.param.outputs.asan) }} + protocol: [v1, v2] 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" + THP: ${{ matrix.protocol == 'v2' && '1' || '0'}} steps: - uses: actions/checkout@v4 with: @@ -237,7 +264,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-noasan + name: core-emu-${{ matrix.model }}-universal-debuglink-noasan-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -260,6 +287,13 @@ jobs: coins: [universal, btconly] asan: ${{ fromJSON(needs.param.outputs.asan) }} lang: ${{ fromJSON(needs.param.outputs.test_lang) }} + protocol: [v1] + include: + - model: T2T1 + coins: universal + asan: noasan + lang: en + protocol: v2 env: TREZOR_PROFILING: ${{ matrix.asan == 'noasan' && '1' || '0' }} TREZOR_MODEL: ${{ matrix.model }} @@ -268,13 +302,14 @@ jobs: PYTEST_TIMEOUT: ${{ matrix.asan == 'asan' && 600 || 400 }} ACTIONS_DO_UI_TEST: ${{ matrix.coins == 'universal' && matrix.asan == 'noasan' }} TEST_LANG: ${{ matrix.lang }} + THP: ${{ matrix.protocol == 'v2' && '1' || '0'}} steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: actions/download-artifact@v4 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 - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -283,7 +318,7 @@ jobs: if: failure() - uses: actions/upload-artifact@v4 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 retention-days: 7 if: always() @@ -322,7 +357,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -332,7 +367,7 @@ jobs: if: ${{ matrix.asan == 'asan' }} - uses: actions/upload-artifact@v4 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 retention-days: 7 if: always() @@ -370,7 +405,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -400,7 +435,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -433,7 +468,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-noasan + name: core-emu-${{ matrix.model }}-universal-debuglink-noasan-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment # XXX poetry maybe not needed @@ -491,7 +526,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 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 - uses: ./.github/actions/environment - run: nix-shell --run "poetry run core/tools/size/checker.py core/build/firmware/firmware.elf" @@ -515,7 +550,7 @@ jobs: fetch-depth: 0 - uses: actions/download-artifact@v4 with: - name: core-firmware-${{ matrix.model }}-universal-normal + name: core-firmware-${{ matrix.model }}-universal-normal-protocol_v1 path: core/build - 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" @@ -546,7 +581,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: cachix/install-nix-action@v23 @@ -587,7 +622,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -622,7 +657,7 @@ jobs: submodules: recursive - uses: actions/download-artifact@v4 with: - name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }} + name: core-emu-${{ matrix.model }}-universal-debuglink-${{ matrix.asan }}-protocol_v1 path: core/build - run: chmod +x core/build/unix/trezor-emu-core* - uses: ./.github/actions/environment @@ -728,7 +763,7 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: core-emu*debuglink-noasan + pattern: core-emu*debuglink-noasan-protocol_v* merge-multiple: true - name: Configure aws credentials uses: aws-actions/configure-aws-credentials@v4 @@ -751,7 +786,7 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: core-emu*debuglink-noasan + pattern: core-emu*debuglink-noasan-protocol_v* merge-multiple: true - name: Configure aws credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/ci/build.yml b/ci/build.yml index 8faa98da55..3f2861edf0 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -307,6 +307,7 @@ core unix frozen debug build: needs: [] variables: PYOPT: "0" + THP: "1" script: - $NIX_SHELL --run "poetry run make -C core build_unix_frozen" artifacts: diff --git a/docs/ci/jobs.md b/docs/ci/jobs.md index 7a57340f24..2325549c2a 100644 --- a/docs/ci/jobs.md +++ b/docs/ci/jobs.md @@ -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. **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. -### [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. **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. 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)