-
-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: move hardware tests over to github actions
[skip_ci]
- Loading branch information
Showing
11 changed files
with
183 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Hardware tests | ||
|
||
on: | ||
schedule: | ||
- cron: '15 23 * * *' # every day @ 23:15 | ||
workflow_dispatch: | ||
pull_request: # TODO remove | ||
|
||
# [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' && '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: | | ||
nix-shell --arg hardwareTest true --run "ls -l /dev/tty*" | ||
# 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 }} | ||
path: trezor.log | ||
retention-days: 7 | ||
if: always() | ||
|
||
core_monero_test: | ||
name: Monero tests | ||
runs-on: | ||
- self-hosted | ||
- ${{ 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: | | ||
nix-shell --arg hardwareTest true --run "ls -l /dev/tty*" | ||
# 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 "cd ../../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-${{ 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/[email protected] | ||
with: | ||
name: legacy-hardware-${{ matrix.model }} | ||
path: ci/hardware_tests/*.mp4 | ||
retention-days: 7 | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
HERE=`dirname "$0"` | ||
SHA=${GITHUB_SHA:-unknown} | ||
cd $HERE | ||
|
||
function finish { | ||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} stop | ||
ls -l *.mp4 | ||
./record_video.sh ${T1_CAMERA} ${SHA} stop | ||
} | ||
trap finish EXIT | ||
|
||
set -e # exit on nonzero exitcode | ||
set -x # trace commands | ||
|
||
# export variables defined in the file | ||
set -a | ||
source hardware.cfg | ||
set +a | ||
|
||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} start | ||
./record_video.sh ${T1_CAMERA} ${SHA} start | ||
(cd ../.. && poetry install) | ||
poetry run python bootstrap.py t1 | ||
poetry run python bootstrap.py t1 ../../firmware-T1*.bin | ||
#poetry run python bootstrap.py T1B1 # install official firmware first | ||
poetry run python bootstrap.py T1B1 ../../firmware-T1*.bin | ||
poetry run pytest ../../tests/device_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.