From 415d62bc662447e3c68f3ea9d2d2bb0d6b907a35 Mon Sep 17 00:00:00 2001 From: vdovhanych Date: Mon, 29 Jul 2024 12:02:07 +0200 Subject: [PATCH] ci: add arm emulator build in github actions --- .github/workflows/core.yml | 42 +++++++++++++++++++++++++++++++++++- .github/workflows/legacy.yml | 36 ++++++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index a80ce85c9..184d28945 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -126,6 +126,44 @@ jobs: core/build/bootloader_emu/bootloader.elf retention-days: 7 + core_emu_arm: + if: github.event_name == 'schedule' + name: Build emu arm + runs-on: ubuntu-latest-arm64 + needs: param + strategy: + fail-fast: false + matrix: + model: [T2T1, T2B1, T3T1] + coins: [universal] + type: [debuglink] + asan: [noasan] + exclude: + - type: normal + asan: asan + env: + TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || matrix.model == 'T2B1' && 'R' || 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" + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: ./.github/actions/environment + - run: nix-shell --run "poetry run make -C core build_bootloader_emu" + if: matrix.coins == 'universal' + - run: nix-shell --run "poetry run make -C core build_unix_frozen" + - run: mv core/build/unix/trezor-emu-core core/build/unix/trezor-emu-arm-core-${{ matrix.model }}-${{ matrix.coins }} + - uses: actions/upload-artifact@v4 + with: + name: core-emu-arm-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }} + path: | + core/build/unix/trezor-emu-* + core/build/bootloader_emu/bootloader.elf + retention-days: 2 + core_unit_python_test: name: Python unit tests runs-on: ubuntu-latest @@ -708,7 +746,9 @@ jobs: name: Upload emulator binaries if: github.event_name == 'schedule' runs-on: ubuntu-latest - needs: core_emu + needs: + - core_emu + - core_emu_arm steps: - uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/legacy.yml b/.github/workflows/legacy.yml index 779307663..a9a51efd1 100644 --- a/.github/workflows/legacy.yml +++ b/.github/workflows/legacy.yml @@ -74,6 +74,34 @@ jobs: legacy/firmware/trezor-emu-legacy* retention-days: 7 + legacy_emu_arm: + if: github.event_name == 'schedule' + name: Emulator arm + runs-on: ubuntu-latest-arm64 + strategy: + matrix: + coins: [universal] + type: [debuglink] + asan: ${{ fromJSON(github.event_name == 'schedule' && '["noasan", "asan"]' || '["noasan"]') }} + env: + EMULATOR: 1 + BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }} + DEBUG_LINK: ${{ matrix.type == 'debuglink' && '1' || '0' }} + ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: ./.github/actions/environment + - run: nix-shell --run "poetry run legacy/script/cibuild" + - run: mv legacy/firmware/trezor.elf legacy/firmware/trezor-emu-arm-legacy-T1B1-${{ matrix.coins }} + - uses: actions/upload-artifact@v4 + with: + name: legacy-emu-arm-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }} + path: | + legacy/firmware/trezor-emu-arm-legacy* + retention-days: 7 + legacy_device_test: name: Device test runs-on: ubuntu-latest @@ -202,11 +230,13 @@ jobs: # TODO: always run if comment already exists if: ${{ steps.check-fixtures-changed.outputs.FIXTURES_CHANGED == '1' }} - core_upload_emu: + legacy_upload_emu: name: Upload emulator binaries if: github.event_name == 'schedule' runs-on: ubuntu-latest - needs: legacy_emu + needs: + - legacy_emu + - legacy_emu_arm steps: - uses: actions/download-artifact@v4 with: @@ -220,5 +250,5 @@ jobs: continue-on-error: true - run: | mkdir emulators - cp trezor-emu-legacy* emulators + cp trezor-emu-* emulators aws s3 sync --no-progress emulators s3://data.trezor.io/dev/firmware/emu-nightly