.PHONY: ci fmt clippy doc build test deny check install setup clean help \
coverage fuzz fuzz-fold mutants mutants-full check-fuzz-prereqs check-mutants-prereqs
ci: fmt clippy doc build test deny
@echo "✓ All CI checks passed"
fmt:
cargo fmt --all -- --check
clippy:
cargo clippy --all-targets -- -D warnings
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
build:
cargo build --release
test:
cargo nextest run --release
deny:
cargo deny check
check: fmt clippy deny
@echo "✓ Quick checks passed"
test-unit:
cargo test --lib
coverage:
@cargo llvm-cov --version >/dev/null 2>&1 || { echo "Requires: cargo install cargo-llvm-cov"; exit 1; }
cargo llvm-cov nextest --no-fail-fast --html --ignore-filename-regex 'tests/'
@echo "Report: target/llvm-cov/html/index.html"
FUZZ_TIME ?= 300
FUZZ_WORKERS ?= 1
check-fuzz-prereqs:
@cargo +nightly fuzz --version >/dev/null 2>&1 || { echo "Requires: cargo install cargo-fuzz && rustup toolchain install nightly"; exit 1; }
check-mutants-prereqs:
@cargo mutants --version >/dev/null 2>&1 || { echo "Requires: cargo install cargo-mutants"; exit 1; }
fuzz: check-fuzz-prereqs
nice -n 19 cargo +nightly fuzz run fuzz_normalize -- -max_total_time=$(FUZZ_TIME) -jobs=$(FUZZ_WORKERS) -workers=$(FUZZ_WORKERS)
fuzz-fold: check-fuzz-prereqs
nice -n 19 cargo +nightly fuzz run fuzz_fold -- -max_total_time=$(FUZZ_TIME) -jobs=$(FUZZ_WORKERS) -workers=$(FUZZ_WORKERS)
MUTANTS_MEM_MAX ?= 48G
MUTANTS_TIMEOUT_MULT ?= 3
MUTANTS_JOBS ?= 8
MUTANTS_RUN := systemd-run --scope -p MemoryMax=$(MUTANTS_MEM_MAX) nice -n 19
MUTANTS_ENV := PROPTEST_CASES=32 PROPTEST_MAX_SHRINK_ITERS=100
MUTANTS_FILES := -f src/folder.rs -f src/normalize.rs -f 'src/patterns/**/*.rs'
mutants: check-mutants-prereqs
$(MUTANTS_RUN) env $(MUTANTS_ENV) cargo mutants \
-j $(MUTANTS_JOBS) --timeout-multiplier $(MUTANTS_TIMEOUT_MULT) \
$(MUTANTS_FILES) -C --lib
mutants-full: check-mutants-prereqs
$(MUTANTS_RUN) env $(MUTANTS_ENV) cargo mutants \
-j $(MUTANTS_JOBS) --timeout-multiplier $(MUTANTS_TIMEOUT_MULT) \
$(MUTANTS_FILES)
install: build
cp ./target/release/lessence ~/.cargo/bin/lessence
@lessence --version
setup:
@echo "Installing development tools..."
cargo install cargo-deny
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ~/.cargo/bin
rustup component add clippy rustfmt
@echo ""
@echo "✓ Tools installed:"
@cargo deny --version
@cargo nextest --version
@cargo clippy --version
@cargo fmt --version
clean:
cargo clean
help:
@echo "lessence Development Commands"
@echo ""
@echo " make ci — Run full CI pipeline (same as GitHub Actions)"
@echo " make check — Quick pre-push validation (fmt + clippy + deny)"
@echo " make coverage — HTML code coverage report (unit tests)"
@echo " make fuzz — Fuzz normalizer (nightly, local only, 5 min)"
@echo " make mutants — Mutation testing, unit tests only (~12 min)"
@echo " make mutants-full — Mutation testing, all tests (~38 min)"
@echo " make setup — Install required dev tools"
@echo " make install — Build and install to PATH"
@echo ""
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed 's/^/ /'