scripts/rust-check.sh and scripts/wasm-build.sh (moved from docker/) run natively on the user-level rustup toolchain pinned by rust-toolchain.toml; scripts/rust-env.sh puts ~/.cargo/bin on PATH for non-interactive shells. Root scripts: rust:check and wasm:build native, rust:check:docker and wasm:build:docker through docker/rust-run.sh, check:all = scripts/check-all.sh, the whole pre-merge gate in one command (rust check, types drift, wasm build, pnpm check, application image, worker:test, worker:image started read-only). The native check now runs the worker's unit tests (cargo test --workspace); the sandbox tests stay feature-gated and Docker-only.
24 lines
1.2 KiB
Bash
Executable File
24 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# The Rust quality gate, one file for every environment: `pnpm rust:check` runs it on the
|
|
# native toolchain of the development machine (rustup selects the channel pinned by
|
|
# rust-toolchain.toml); `pnpm rust:check:docker` runs the same file inside the reference
|
|
# builder image (docker/rust-builder.Dockerfile) when a reproducible run is wanted.
|
|
# The worker's sandbox tests are feature-gated (`test-hooks`) and run only in its own
|
|
# Alpine/musl image (crates/worker/Dockerfile stage `test`, `pnpm worker:test`): the seccomp
|
|
# allowlist is derived for the musl static binary that ships. The plain `cargo test` below
|
|
# therefore covers the worker's unit tests and the whole of core and wasm.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
. scripts/rust-env.sh
|
|
|
|
cargo fmt --all --check
|
|
cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
cargo test --workspace --locked
|
|
# Exports the TypeScript types of the contracts (ts-rs) into packages/core-wasm/types.
|
|
# `git diff --exit-code -- packages/core-wasm/types` must stay empty afterwards
|
|
# (scripts/check-all.sh, .gitea/workflows/ci.yml): the committed types never drift from
|
|
# the Rust structs.
|
|
cargo test -p faunosteo-core --features ts --locked
|
|
cargo deny check licenses bans sources
|