name: Rust tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: Run cargo tests (auto-detect) shell: bash run: | set -euxo pipefail # If there's a workspace at the repo root, test the whole thing. if [ -f Cargo.toml ] && grep -q '^\[workspace\]' Cargo.toml; then cargo test --workspace --all-features --verbose exit 0 fi # Otherwise, find all Cargo.toml files and test each crate. mapfile -t MANIFESTS < <(git ls-files '**/Cargo.toml') if [ ${#MANIFESTS[@]} -eq 0 ]; then echo "No Cargo.toml found; skipping Rust tests." exit 0 fi for m in "${MANIFESTS[@]}"; do echo "=== Testing $m ===" cargo test --verbose --manifest-path "$m" done