Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
#!/bin/bash

set -e
# -----------------------------------------------------------------------------
# Bash Strict Mode
# -----------------------------------------------------------------------------
# -e: Exit immediately if a command exits with a non-zero status.
# -u: Treat unset variables as an error and exit immediately.
# -o pipefail: The return value of a pipeline is the status of
# the last command to exit with a non-zero status.
set -euo pipefail

# Build
cargo build
echo "🚀 Starting CI checks..."

# Check formatting
cargo fmt -- --check
# -----------------------------------------------------------------------------
# 1. Formatting Check (Fastest)
# -----------------------------------------------------------------------------
# We run this first to fail fast if code style guidelines are not met.
# --all: Checks all packages in the workspace.
echo "🎨 Checking formatting..."
cargo fmt --all -- --check

# Run Clippy
cargo clippy -- -D warnings
# -----------------------------------------------------------------------------
# 2. Linting & Static Analysis (Clippy)
# -----------------------------------------------------------------------------
# Runs clippy to catch common mistakes and improve code quality.
# --workspace: Checks all crates in the workspace.
# --all-targets: Checks lib, bins, tests, benchmarks, and examples.
# -D warnings: Fails the build if any warning is found.
echo "linter Checking lints..."
cargo clippy --workspace --all-targets -- -D warnings

# Run tests
cargo test

echo "CI checks passed successfully."
# -----------------------------------------------------------------------------
# 3. Testing
# -----------------------------------------------------------------------------
# Runs