#!/usr/bin/env bash
#
# The full local gate: fmt + clippy + the complete test suite. This is the
# single source of truth for "is the tree releasable", mirroring the CI checks
# in .github/workflows/ci.yml so a green run here means a green run there.
# s/version++ calls this before cutting a release, and you can run it directly
# during development.
#
# The full `cargo test` (not just --lib) is the point: integration tests in
# tests/ shell out to the binary and only fail at runtime, so `--lib` misses
# them - which is how a broken flag test once slipped past into CI. Pointing
# TEST_DSC_CONFIG at an unreadable path makes the live-forum e2e tests skip
# (they gate on that config) exactly as they do in CI, while the offline
# integration tests still run - so the gate never touches a live forum.

set -euo pipefail
cd "$(git rev-parse --show-toplevel)"

cargo fmt --all --check
cargo clippy --all-targets -- -D warnings
TEST_DSC_CONFIG=/dev/null/disable-e2e cargo test --quiet
