.PHONY: all
all: help
.PHONY: ci
ci:
@echo "๐ฆ Running complete CI pipeline locally..."
@echo "๐ Setting strict compiler flags..."
@export RUSTFLAGS='-D warnings' && \
echo "๐จ Checking formatting..." && \
cargo fmt --all -- --check && \
echo "๐ Running clippy (all features)..." && \
cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings && \
echo "๐ Running clippy (no default features)..." && \
cargo clippy --workspace --no-default-features --all-targets --no-deps -- -D warnings && \
echo "๐ Building documentation..." && \
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps --document-private-items && \
echo "๐งช Running tests (all features)..." && \
cargo test --workspace --all-features --verbose && \
echo "๐งช Running tests (no default features)..." && \
cargo test --workspace --no-default-features --verbose && \
echo "๐งช Running tests (default features)..." && \
cargo test --workspace --verbose && \
echo "๐ Running doctests..." && \
cargo test --workspace --all-features --doc && \
echo "๐ Running security audit..." && \
cargo deny check && \
echo "โ
All CI checks passed locally!"
.PHONY: ci-quick
ci-quick:
@echo "โก Running quick CI checks..."
@export RUSTFLAGS='-D warnings' && \
cargo fmt --all -- --check && \
cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings && \
cargo test --workspace --all-features && \
echo "โ
Quick CI checks passed!"
.PHONY: build
build:
@echo "Building all project components..."
@cargo build --all
.PHONY: lint
lint: ensure-clippy
@echo "Linting with Clippy..."
@cargo clippy --all-features --all-targets --all -- \
--deny clippy::dbg_macro --deny clippy::unimplemented --deny clippy::todo --deny warnings \
--deny missing_docs --deny broken_intra_doc_links --forbid unused_must_use --deny clippy::result_unit_err
.PHONY: test
test:
@echo "Running tests..."
@cargo test
.PHONY: check
check:
@echo "Checking code formatting..."
@cargo check
.PHONY: format
format: ensure-rustfmt
@echo "Formatting all project components..."
@cargo fmt --all
.PHONY: format-check-verbose
format-check-verbose: ensure-rustfmt
@echo "Checking code format with verbose output..."
@cargo fmt --all -- --check --verbose
.PHONY: fix
fix: ensure-cargo-fix
@echo "Applying cargo fix..."
@cargo fix --all
.PHONY: deny
deny: ensure-cargo-deny
@echo "Running cargo deny checks..."
@cargo deny check
.PHONY: outdated
outdated: ensure-cargo-outdated
@echo "Checking for outdated dependencies..."
@cargo outdated --root-deps-only
.PHONY: ensure-clippy ensure-rustfmt ensure-cargo-fix ensure-cargo-deny ensure-cargo-outdated
ensure-clippy:
@cargo clippy --version || rustup component add clippy
ensure-rustfmt:
@cargo fmt --version || rustup component add rustfmt
ensure-cargo-fix:
@cargo fix --version || rustup component add rustfix
ensure-cargo-deny:
@command -v cargo-deny || cargo install cargo-deny
ensure-cargo-outdated:
@command -v cargo-outdated || cargo install cargo-outdated
.PHONY: help
help:
@echo "Usage: make [target]..."
@echo ""
@echo "Targets:"
@awk 'BEGIN {FS = ":.*?##"} /^[a-zA-Z_-]+:.*?##/ {printf " %-30s %s\n", $$1, $$2}' $(MAKEFILE_LIST)