diff --git a/ci.sh b/ci.sh index dbd73d67..95fde201 100755 --- a/ci.sh +++ b/ci.sh @@ -1,17 +1,42 @@ #!/bin/bash -set -e +# --- Safety & Environment --- +# set -e: Exit immediately if any command fails. +# set -u: Treat unset variables as an error. +set -eu -# Build +echo "[1/5] Building project in debug mode..." +# Build: Checks for compilation errors. cargo build -# Check formatting -cargo fmt -- --check -# Run Clippy -cargo clippy -- -D warnings -# Run tests -cargo test +echo "[2/5] Checking code formatting..." +# Rustfmt: Ensures the code follows the official Rust Style Guide. +# The --check flag prevents formatting changes and returns an error if not compliant. +cargo fmt --all -- --check -echo "CI checks passed successfully." \ No newline at end of file +echo "[3/5] Running Clippy lints (Static Analysis)..." +# Clippy: Catching common mistakes and improving your Rust code. +# -D warnings: Promotes all warnings to errors, forcing a clean codebase. +cargo clippy --workspace --all-targets -- -D warnings + + + +echo "[4/5] Running automated tests..." +# Tests: Validates logic and prevents regressions. +# Runs unit, integration, and documentation tests. +cargo test --workspace --no-fail-fast + + + +[Image of Unit Testing and Integration Testing pyramid] + + +echo "[5/5] Checking for documentation issues..." +# Optional but recommended: Ensures doc comments compile correctly. +cargo doc --no-deps --workspace --document-private-items + +echo "--------------------------------------------------" +echo "✅ CI checks passed successfully." +echo "--------------------------------------------------"