#!/bin/sh
# Enable with: git config core.hooksPath hooks
# The slow checks: doctests link a binary each, and the doc build.

set -e

# resolved-showcase (the showcase movie) is left out of every step here; pre-commit's
# clippy still builds it. It also turns on the library's astrokit feature, and Cargo
# unifies features across a workspace build, so with it in, the steps without default
# features would build the library with astrokit after all.

echo "pre-push: cargo test"
cargo test --workspace --exclude resolved-showcase --all-features --quiet

# Without default features: every target must still build cleanly, and the unit
# tests run. The GPU integration tests do not depend on features, so the run above
# covers them.
echo "pre-push: cargo clippy --no-default-features"
cargo clippy --workspace --exclude resolved-showcase --all-targets --no-default-features --quiet -- -D warnings

echo "pre-push: cargo test --no-default-features (unit tests)"
cargo test --workspace --exclude resolved-showcase --no-default-features --lib --bins --quiet

echo "pre-push: cargo doc"
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --exclude resolved-showcase --no-deps --all-features --quiet

echo "pre-push: ok"
