.PHONY: help lint lint-sort format format-sort test build clean check ci quality-gates install-ci-toolchain
RUST_CI_VERSION := nightly
help:
@echo "AllSource Core - Development Commands"
@echo ""
@echo "Quality Gates (run before pushing):"
@echo " make quality-gates - Run exact CI checks with Rust nightly"
@echo ""
@echo "Quick Checks (uses current toolchain):"
@echo " make check - Run format, lint, sort, and test"
@echo " make lint - Check formatting and run clippy"
@echo " make lint-sort - Check if Cargo.toml is sorted"
@echo " make test - Run tests"
@echo ""
@echo "Formatting:"
@echo " make format - Auto-format code with rustfmt"
@echo " make format-sort - Auto-sort Cargo.toml dependencies"
@echo ""
@echo "Building:"
@echo " make build - Build the project"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Setup:"
@echo " make install-ci-toolchain - Install Rust nightly for quality-gates"
lint:
@echo "Checking code formatting..."
@cargo fmt --check
@echo "Running clippy..."
@cargo clippy --all-targets --all-features -- -D warnings
lint-sort:
@echo "Checking Cargo.toml sort order..."
@cargo sort --check
format:
@echo "Formatting code..."
@cargo fmt
format-sort:
@echo "Sorting Cargo.toml..."
@cargo sort -w
test:
@echo "Running tests..."
@cargo test --lib
build:
@echo "Building project..."
@cargo build --lib
clean:
@echo "Cleaning build artifacts..."
@cargo clean
check: lint lint-sort test
@echo "All checks passed!"
ci: check build
@echo "CI pipeline completed!"
quality-gates:
@echo "Running CI quality gates with Rust $(RUST_CI_VERSION)..."
@echo ""
@echo "[1/6] Checking code formatting..."
@cargo +$(RUST_CI_VERSION) fmt --check
@echo ""
@echo "[2/6] Checking Cargo.toml sorting..."
@cargo +$(RUST_CI_VERSION) sort --check
@echo ""
@echo "[3/6] Running clippy..."
@cargo +$(RUST_CI_VERSION) clippy --locked --all-targets --all-features -- -D warnings
@echo ""
@echo "[4/6] Running tests..."
@cargo +$(RUST_CI_VERSION) test --locked --lib --all-features
@echo ""
@echo "[5/6] Building release..."
@cargo +$(RUST_CI_VERSION) build --locked --lib --release
@echo ""
@echo "[6/6] Checking documentation..."
@RUSTDOCFLAGS="-D warnings" cargo +$(RUST_CI_VERSION) doc --no-deps --document-private-items
@echo ""
@echo "All quality gates passed!"
install-ci-toolchain:
@echo "Installing Rust $(RUST_CI_VERSION) toolchain..."
@rustup toolchain install $(RUST_CI_VERSION) --component rustfmt clippy
@echo "Rust $(RUST_CI_VERSION) installed!"