.PHONY: help setup check build fmt format fmt-check lint test \
ci-format ci-lint ci-check ci-test ci-coverage ci-e2e ci-audit \
install-nextest install-llvm-cov \
e2e-up e2e-down e2e-logs e2e-run clean
.DEFAULT_GOAL := help
CARGO := $(shell which cargo 2>/dev/null || echo $(HOME)/.cargo/bin/cargo)
GREEN := \033[32m
YELLOW := \033[33m
RESET := \033[0m
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
setup:
rustup component add rustfmt clippy
check:
$(CARGO) check --workspace
build:
$(CARGO) build --workspace
fmt format:
$(CARGO) fmt --all
fmt-check:
@echo "$(YELLOW)Checking formatting...$(RESET)"
$(CARGO) fmt --all -- --check
@echo "$(GREEN)✅ Formatting OK$(RESET)"
lint:
@echo "$(YELLOW)Running clippy...$(RESET)"
$(CARGO) clippy --workspace -- -D warnings
@echo "$(GREEN)✅ Clippy clean$(RESET)"
install-nextest:
@$(CARGO) install cargo-nextest --version 0.9.114 --locked 2>/dev/null || true
install-llvm-cov:
@$(CARGO) install cargo-llvm-cov --locked 2>/dev/null || true
test: fmt-check lint install-nextest
$(CARGO) nextest run --workspace
@echo "$(GREEN)✅ All tests passed$(RESET)"
ci-format:
$(CARGO) fmt --all -- --check
ci-lint:
$(CARGO) clippy --workspace -- -D warnings
ci-check: ci-format ci-lint
@echo "$(GREEN)✅ All code quality checks passed$(RESET)"
ci-test:
RUSTFLAGS="-D warnings" $(CARGO) nextest run --workspace
ci-coverage:
RUSTFLAGS="-D warnings" $(CARGO) llvm-cov nextest --workspace \
--features integration-tests \
--fail-uncovered-lines 1
ci-e2e:
RUSTFLAGS="-D warnings" $(CARGO) nextest run \
--features integration-tests \
--test e2e
ci-audit:
$(CARGO) audit --deny warnings --deny unsound --deny unmaintained --deny yanked $(if $(DB_PATH),--db $(DB_PATH) --no-fetch,)
audit:
$(CARGO) audit
e2e-up:
docker compose up -d
@echo "$(GREEN)OTel Collector running — gRPC on :4317$(RESET)"
e2e-down:
docker compose down
e2e-logs:
docker compose logs -f
e2e-run: e2e-up
$(CARGO) test --features integration-tests --test e2e
@echo "$(GREEN)✅ E2E tests passed$(RESET)"
pre-commit: fmt-check lint test
clean:
$(CARGO) clean