ci: stylecheck and test all rust crates

[no changelog]
This commit is contained in:
Martin Milata
2025-11-26 19:49:10 +01:00
parent 50adcc8acb
commit fa55d870d2
5 changed files with 47 additions and 3 deletions

View File

@@ -79,6 +79,16 @@ jobs:
# LD_LIBRARY_PATH workaround: https://discourse.nixos.org/t/nixpkgs-nixos-unstable-many-package-fail-with-glibc-2-38-not-found/35078 https://github.com/NixOS/nixpkgs/issues/287764
- run: nix-shell --arg fullDeps true --run "unset LD_LIBRARY_PATH && cd python && uv run tox"
rust_test:
name: Rust crates test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "make -C rust check"
storage_test:
name: Storage test
# TODO: only for changes in storage/

View File

@@ -94,13 +94,14 @@ defs_check: ## check validity of coin definitions and protobuf files
ruststyle:
@echo [RUSTFMT]
@cd core/embed/rust ; cargo fmt
@cd rust/trezor-client ; cargo fmt
make -C rust style
ruststyle_check:
rustfmt --version
@echo [RUSTFMT]
@cd core/embed/rust ; cargo fmt -- --check
@cd rust/trezor-client ; cargo fmt -- --check
make -C rust style_check
typecheck: pyright

1
rust/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*/target/

33
rust/Makefile Normal file
View File

@@ -0,0 +1,33 @@
# trezor-client needs running emulator for test, handled in core.yml
CRATES_TEST = trezor-thp trezor-tjpgdec
CRATES = ${CRATES_TEST} trezor-client
check: clippy test
style:
@for D in $(CRATES); do ( \
echo "[STYLE $$D]"; \
cd $$D; \
cargo fmt \
); done
style_check:
@for D in $(CRATES); do ( \
echo "[STYLE $$D]"; \
cd $$D; \
cargo fmt -- --check \
); done
clippy:
@for D in $(CRATES); do ( \
echo "[CLIPPY $$D]"; \
cd $$D; \
cargo clippy \
); done
test:
@for D in $(CRATES_TEST); do ( \
echo "[TEST $$D]"; \
cd $$D; \
cargo test \
); done

View File

@@ -1 +0,0 @@
target/