#!/bin/sh

cargo build
if [[ $? == 1 ]]; then
    cat <<\EOF
Error: Build failed, please run cargo build to check the errors and fix them.
EOF
    exit 1
fi 

cargo test --all
if [[ $? == 1 ]]; then
    cat <<\EOF
Error: Tests failed, please run cargo test to check the errors and fix them.
EOF
    exit 1
fi 

cargo clippy -- -Dwarnings
if [[ $? != 0 ]]; then
    cat <<\EOF
Error: Linter failed, please run cargo clippy to check the errors and fix them.
EOF
    exit 1
fi
