parent
cd8a0ea690
commit
1ff789101b
@ -0,0 +1,138 @@
|
|||||||
|
name: Hardware tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '15 23 * * *' # every day @ 23:15
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# [Device tests](../tests/device-tests.md) that run against an actual physical Trezors.
|
||||||
|
# The device needs to have special bootloader, found in `core/embed/bootloader_ci`, that
|
||||||
|
# makes it possible to flash firmware without confirmation on the touchscreen.
|
||||||
|
#
|
||||||
|
# All hardware tests are run nightly on the `main` branch,
|
||||||
|
# and also can be started manually.
|
||||||
|
#
|
||||||
|
# Currently it's not possible to run all regular TT tests without getting into
|
||||||
|
# a state where the micropython heap is too fragmented and allocations fail
|
||||||
|
# (often manifesting as a stuck test case). For that reason some tests are
|
||||||
|
# skipped.
|
||||||
|
# See also: https://github.com/trezor/trezor-firmware/issues/1371
|
||||||
|
jobs:
|
||||||
|
core_device_test:
|
||||||
|
name: Device tests
|
||||||
|
runs-on:
|
||||||
|
- self-hosted
|
||||||
|
- ${{ matrix.model == 'T2B1' && 'runner3' || 'hw-t2t1' }}
|
||||||
|
# runner4 does not work at the moment
|
||||||
|
# - ${{ matrix.model == 'T2B1' && 'hw-t2b1' || 'hw-t2t1' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
model: [T2T1, T2B1]
|
||||||
|
coins: [universal, btconly]
|
||||||
|
env:
|
||||||
|
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || 'R' }}
|
||||||
|
TREZOR_PYTEST_SKIP_ALTCOINS: ${{ matrix.coins == 'btconly' && '1' || '0' }}
|
||||||
|
PYTEST_TIMEOUT: 1200
|
||||||
|
PYOPT: 0
|
||||||
|
DISABLE_OPTIGA: 1
|
||||||
|
BOOTLOADER_DEVEL: ${{ matrix.model == 'T2B1' && '1' || '0' }}
|
||||||
|
TESTOPTS: "-k 'not authenticate and not recovery and not lots'"
|
||||||
|
TT_UHUB_PORT: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- uses: ./.github/actions/environment
|
||||||
|
- run: nix-shell --arg hardwareTest true --run uhubctl
|
||||||
|
- run: nix-shell --run "poetry run make -C core build_firmware"
|
||||||
|
- run: nix-shell --arg hardwareTest true --run "poetry run python ci/hardware_tests/bootstrap.py ${{ matrix.model }} core/build/firmware/firmware.bin"
|
||||||
|
- run: nix-shell --run "poetry run trezorctl list"
|
||||||
|
- run: nix-shell --run "poetry run trezorctl get-features"
|
||||||
|
- run: |
|
||||||
|
# log serial console to file; sleep is used because tio needs stdin that is not /dev/null
|
||||||
|
nix-shell --arg hardwareTest true --run "sleep 8h | tio --no-autoconnect /dev/ttyTREZOR &> trezor.log" &
|
||||||
|
nix-shell --run "poetry run pytest -v tests/device_tests"
|
||||||
|
- run: tail -n50 trezor.log || true
|
||||||
|
if: failure()
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: core-hardware-${{ matrix.model }}-${{ matrix.coins }}
|
||||||
|
path: trezor.log
|
||||||
|
retention-days: 7
|
||||||
|
if: always()
|
||||||
|
|
||||||
|
core_monero_test:
|
||||||
|
name: Monero tests
|
||||||
|
runs-on:
|
||||||
|
- self-hosted
|
||||||
|
- ${{ matrix.model == 'T2B1' && 'runner3' || 'hw-t2t1' }}
|
||||||
|
# runner4 does not work at the moment
|
||||||
|
# - ${{ matrix.model == 'T2B1' && 'hw-t2b1' || 'hw-t2t1' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
model: [T2T1, T2B1]
|
||||||
|
env:
|
||||||
|
TREZOR_MODEL: ${{ matrix.model == 'T2T1' && 'T' || 'R' }}
|
||||||
|
PYTEST_TIMEOUT: 1200
|
||||||
|
PYOPT: 0
|
||||||
|
DISABLE_OPTIGA: 1
|
||||||
|
BOOTLOADER_DEVEL: ${{ matrix.model == 'T2B1' && '1' || '0' }}
|
||||||
|
TT_UHUB_PORT: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- uses: ./.github/actions/environment
|
||||||
|
- run: nix-shell --arg hardwareTest true --run uhubctl
|
||||||
|
- run: nix-shell --run "poetry run make -C core build_firmware"
|
||||||
|
- run: nix-shell --arg hardwareTest true --run "poetry run python ci/hardware_tests/bootstrap.py ${{ matrix.model }} core/build/firmware/firmware.bin"
|
||||||
|
- run: nix-shell --run "poetry run trezorctl list"
|
||||||
|
- run: nix-shell --run "poetry run trezorctl get-features"
|
||||||
|
- run: |
|
||||||
|
# log serial console to file; sleep is used because tio needs stdin that is not /dev/null
|
||||||
|
nix-shell --arg hardwareTest true --run "sleep 8h | tio --no-autoconnect /dev/ttyTREZOR &> trezor.log" &
|
||||||
|
nix-shell --arg fullDeps true --run "./core/tests/run_tests_device_emu_monero.sh $TESTOPTS"
|
||||||
|
- run: tail -n50 trezor.log || true
|
||||||
|
if: failure()
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: core-hardware-monero-${{ matrix.model }}
|
||||||
|
path: trezor.log
|
||||||
|
retention-days: 7
|
||||||
|
if: always()
|
||||||
|
|
||||||
|
legacy_device_test:
|
||||||
|
name: Device tests T1B1
|
||||||
|
runs-on:
|
||||||
|
- self-hosted
|
||||||
|
- hw-t1b1
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
coins: [universal, btconly]
|
||||||
|
env:
|
||||||
|
TREZOR_PYTEST_SKIP_ALTCOINS: ${{ matrix.coins == 'btconly' && '1' || '0' }}
|
||||||
|
PYTEST_TIMEOUT: 1200
|
||||||
|
T1_UHUB_LOCATION: 3-1
|
||||||
|
T1_UHUB_PORT: 2
|
||||||
|
T1_CAMERA: /dev/video0 # camera device
|
||||||
|
T1_ARDUINO_SERIAL: /dev/ttyTPMB # arduino that pushes T1 buttons
|
||||||
|
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
|
||||||
|
DEBUG_LINK: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- uses: ./.github/actions/environment
|
||||||
|
- run: nix-shell --arg hardwareTest true --run uhubctl
|
||||||
|
- run: nix-shell --run "poetry run legacy/script/setup"
|
||||||
|
- run: nix-shell --run "export PRODUCTION=0 && poetry run legacy/script/cibuild"
|
||||||
|
- run: nix-shell --arg hardwareTest true --run "ci/hardware_tests/t1_hw_test.sh"
|
||||||
|
- uses: actions/upload-artifact@v4.3.1
|
||||||
|
with:
|
||||||
|
name: legacy-hardware-${{ matrix.coins }}
|
||||||
|
path: ci/hardware_tests/*.mp4
|
||||||
|
retention-days: 7
|
||||||
|
if: always()
|
@ -1,16 +0,0 @@
|
|||||||
# location of the uhub, can be found out by running `uhubctl`
|
|
||||||
T1_UHUB_LOCATION="3-2"
|
|
||||||
# to which port of the uhub the device is connected
|
|
||||||
T1_UHUB_PORT="2"
|
|
||||||
|
|
||||||
# camera device
|
|
||||||
T1_CAMERA="/dev/video0"
|
|
||||||
|
|
||||||
# arduino that pushes T1 buttons
|
|
||||||
T1_ARDUINO_SERIAL="/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_8573332373935181A0C0-if00"
|
|
||||||
|
|
||||||
# location of the uhub, can be found out by running `uhubctl`
|
|
||||||
TT_UHUB_LOCATION="3-2"
|
|
||||||
# to which port of the uhub the device is connected
|
|
||||||
TT_UHUB_PORT="3"
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
HERE=`dirname "$0"`
|
||||||
|
SHA=${GITHUB_SHA:-unknown}
|
||||||
|
cd $HERE
|
||||||
|
|
||||||
function finish {
|
function finish {
|
||||||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} stop
|
./record_video.sh ${T1_CAMERA} ${SHA} stop
|
||||||
ls -l *.mp4
|
|
||||||
}
|
}
|
||||||
trap finish EXIT
|
trap finish EXIT
|
||||||
|
|
||||||
set -e # exit on nonzero exitcode
|
set -e # exit on nonzero exitcode
|
||||||
set -x # trace commands
|
set -x # trace commands
|
||||||
|
|
||||||
# export variables defined in the file
|
./record_video.sh ${T1_CAMERA} ${SHA} start
|
||||||
set -a
|
|
||||||
source hardware.cfg
|
|
||||||
set +a
|
|
||||||
|
|
||||||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} start
|
|
||||||
(cd ../.. && poetry install)
|
(cd ../.. && poetry install)
|
||||||
poetry run python bootstrap.py t1
|
#poetry run python bootstrap.py T1B1 # install official firmware first
|
||||||
poetry run python bootstrap.py t1 ../../firmware-T1*.bin
|
poetry run python bootstrap.py T1B1 ../../firmware-T1*.bin
|
||||||
poetry run pytest ../../tests/device_tests
|
poetry run pytest ../../tests/device_tests
|
||||||
|
@ -1,159 +0,0 @@
|
|||||||
image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix
|
|
||||||
|
|
||||||
# Caching
|
|
||||||
.gitlab_caching: &gitlab_caching
|
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_SLUG"
|
|
||||||
paths:
|
|
||||||
- .venv/
|
|
||||||
|
|
||||||
# Hardware
|
|
||||||
|
|
||||||
# [Device tests](../tests/device-tests.md) that run against an actual physical Trezor T.
|
|
||||||
# The device needs to have special bootloader, found in `core/embed/bootloader_ci`, that
|
|
||||||
# makes it possible to flash firmware without confirmation on the touchscreen.
|
|
||||||
#
|
|
||||||
# All hardware tests are run nightly on the `master` branch, as well as on push to branches
|
|
||||||
# with whitelisted prefix. If you want hardware tests ran on your branch, make sure its
|
|
||||||
# name starts with `hw/`.
|
|
||||||
#
|
|
||||||
# Currently it's not possible to run all regular TT tests without getting into
|
|
||||||
# a state where the micropython heap is too fragmented and allocations fail
|
|
||||||
# (often manifesting as a stuck test case). For that reason some tests are
|
|
||||||
# skipped.
|
|
||||||
# See also: https://github.com/trezor/trezor-firmware/issues/1371
|
|
||||||
hardware core regular device test:
|
|
||||||
stage: test
|
|
||||||
only:
|
|
||||||
- schedules # nightly build
|
|
||||||
- /^legacy\//
|
|
||||||
- /^release\//
|
|
||||||
- /^secfix\//
|
|
||||||
- /^hw\//
|
|
||||||
tags:
|
|
||||||
- tpmb
|
|
||||||
needs:
|
|
||||||
- core fw regular debug build
|
|
||||||
variables:
|
|
||||||
PYTEST_TIMEOUT: "1200"
|
|
||||||
script:
|
|
||||||
- cd ci/hardware_tests
|
|
||||||
- set -a
|
|
||||||
- source hardware.cfg
|
|
||||||
- set +a
|
|
||||||
- $NIX_SHELL --run "cd ../.. && poetry install"
|
|
||||||
- $NIX_SHELL --run "poetry run python bootstrap.py tt ../../firmware-T2*.bin | ts -s"
|
|
||||||
- $NIX_SHELL --run "poetry run pytest ../../tests/device_tests | ts -s"
|
|
||||||
timeout: 6h
|
|
||||||
artifacts:
|
|
||||||
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
|
|
||||||
expire_in: 2 days
|
|
||||||
when: always
|
|
||||||
|
|
||||||
# Also device tests on physical Trezor T but with Bitcoin-only firmware.
|
|
||||||
hardware core btconly device test:
|
|
||||||
stage: test
|
|
||||||
only:
|
|
||||||
- schedules # nightly build
|
|
||||||
- /^legacy\//
|
|
||||||
- /^release\//
|
|
||||||
- /^secfix\//
|
|
||||||
- /^hw\//
|
|
||||||
tags:
|
|
||||||
- tpmb
|
|
||||||
needs:
|
|
||||||
- core fw btconly debug build
|
|
||||||
variables:
|
|
||||||
TREZOR_PYTEST_SKIP_ALTCOINS: 1
|
|
||||||
PYTEST_TIMEOUT: "1200"
|
|
||||||
script:
|
|
||||||
- cd ci/hardware_tests
|
|
||||||
- set -a
|
|
||||||
- source hardware.cfg
|
|
||||||
- set +a
|
|
||||||
- $NIX_SHELL --run "cd ../.. && poetry install"
|
|
||||||
- $NIX_SHELL --run "poetry run python bootstrap.py tt ../../firmware-T2*.bin | ts -s"
|
|
||||||
- $NIX_SHELL --run "poetry run pytest ../../tests/device_tests | ts -s"
|
|
||||||
timeout: 4h
|
|
||||||
artifacts:
|
|
||||||
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
|
|
||||||
expire_in: 2 days
|
|
||||||
when: always
|
|
||||||
|
|
||||||
hardware core monero test:
|
|
||||||
stage: test
|
|
||||||
only:
|
|
||||||
- schedules # nightly build
|
|
||||||
- /^release\//
|
|
||||||
- /^secfix\//
|
|
||||||
- /^hw\//
|
|
||||||
tags:
|
|
||||||
- tpmb
|
|
||||||
needs:
|
|
||||||
- core fw regular debug build
|
|
||||||
variables:
|
|
||||||
TESTOPTS: --trezor-path webusb
|
|
||||||
script:
|
|
||||||
- cd ci/hardware_tests
|
|
||||||
- set -a
|
|
||||||
- source hardware.cfg
|
|
||||||
- set +a
|
|
||||||
- $NIX_SHELL --run "cd ../.. && poetry install"
|
|
||||||
- $NIX_SHELL --run "poetry run python bootstrap.py tt ../../firmware-T2*.bin | ts -s"
|
|
||||||
- $NIX_SHELL --arg fullDeps true --run "cd ../../core/tests && ./run_tests_device_emu_monero.sh $TESTOPTS | ts -s"
|
|
||||||
timeout: 1h
|
|
||||||
artifacts:
|
|
||||||
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
|
|
||||||
expire_in: 2 days
|
|
||||||
when: always
|
|
||||||
|
|
||||||
# [Device tests](../tests/device-tests.md) executed on physical Trezor 1.
|
|
||||||
# This works thanks to [tpmb](https://github.com/mmahut/tpmb), which is a small arduino
|
|
||||||
# device capable of pushing an actual buttons on the device.
|
|
||||||
hardware legacy regular device test:
|
|
||||||
stage: test
|
|
||||||
only:
|
|
||||||
- schedules # nightly build
|
|
||||||
- /^legacy\//
|
|
||||||
- /^release\//
|
|
||||||
- /^secfix\//
|
|
||||||
- /^hw\//
|
|
||||||
tags:
|
|
||||||
- tpmb
|
|
||||||
needs:
|
|
||||||
- legacy fw regular debug build
|
|
||||||
script:
|
|
||||||
- cd ci/hardware_tests
|
|
||||||
- $NIX_SHELL --run "./t1_hw_test.sh | ts -s"
|
|
||||||
timeout: 1h20m
|
|
||||||
artifacts:
|
|
||||||
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
|
|
||||||
paths:
|
|
||||||
- ci/hardware_tests/*.mp4
|
|
||||||
expire_in: 2 days
|
|
||||||
when: always
|
|
||||||
|
|
||||||
# Also device tests on physical Trezor 1 but with Bitcoin-only firmware.
|
|
||||||
hardware legacy btconly device test:
|
|
||||||
stage: test
|
|
||||||
variables:
|
|
||||||
TREZOR_PYTEST_SKIP_ALTCOINS: 1
|
|
||||||
only:
|
|
||||||
- schedules # nightly build
|
|
||||||
- /^legacy\//
|
|
||||||
- /^release\//
|
|
||||||
- /^secfix\//
|
|
||||||
- /^hw\//
|
|
||||||
tags:
|
|
||||||
- tpmb
|
|
||||||
needs:
|
|
||||||
- legacy fw btconly debug build
|
|
||||||
script:
|
|
||||||
- cd ci/hardware_tests
|
|
||||||
- $NIX_SHELL --run "./t1_hw_test.sh | ts -s"
|
|
||||||
artifacts:
|
|
||||||
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
|
|
||||||
paths:
|
|
||||||
- ci/hardware_tests/*.mp4
|
|
||||||
expire_in: 2 days
|
|
||||||
when: always
|
|
Loading…
Reference in new issue