#!/bin/sh
#
# See https://github.com/rhysd/cargo-husky#readme
#

echo "-------------------------------------------------------------------------------"
echo "Run CI steps"
echo "The following steps are also ran during   git push   command."
echo "If you want to push your changes without running CI, use   git push --no-verify"
echo "-------------------------------------------------------------------------------"

set -ex

export RUSTFLAGS='-D warnings'

rustc --version
cargo --version
cargo fmt --all -- --check
cargo build
cargo test --workspace --all-targets --all-features --bins --tests --lib --benches

{ set +x ;} 2> /dev/null
for hash in "fnv" "xxh3"; do
  echo "################################################################################################################################"
  set -x
  cargo test --no-default-features --lib --bins --examples --tests --benches --features "$hash"
  { set +x ;} 2> /dev/null
done

echo "################################################################################################################################"
set -x

cargo test --doc
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps

cargo clippy -- -D warnings
cargo clippy --all-features -- -D warnings
