.PHONY: help setup check build fmt format fmt-check lint test \
ci-format ci-lint ci-lockfile-diff ci-check ci-test ci-coverage ci-e2e ci-audit ci-changelog ci-build-check ci-release-readiness \
install-nextest install-llvm-cov \
e2e-up e2e-down e2e-logs e2e-run clean pre-commit lockfile spec-check
.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:
$(CARGO) fmt --all
format: fmt
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 --all-features --all-targets -- -D warnings
ci-lockfile-diff:
@cp Cargo.lock Cargo.lock.committed
@$(CARGO) generate-lockfile
@diff Cargo.lock.committed Cargo.lock || { \
echo ""; \
echo "ERROR: Cargo.lock is out of date. Run: cargo generate-lockfile && git add Cargo.lock"; \
mv Cargo.lock.committed Cargo.lock; exit 1; }
@mv Cargo.lock.committed Cargo.lock
ci-check: ci-format ci-lint
@echo "$(GREEN)✅ All code quality checks passed$(RESET)"
ci-test:
RUSTFLAGS="-D warnings" $(CARGO) nextest run --workspace \
--all-features -E 'not binary(e2e)'
ci-build-check:
$(CARGO) check --workspace --all-targets
$(CARGO) check --workspace --all-targets --all-features
$(CARGO) check --workspace --all-targets --no-default-features
$(CARGO) check --workspace --all-targets --no-default-features --features http
$(CARGO) check --workspace --all-targets --no-default-features --features grpc
$(CARGO) check --workspace --all-targets --no-default-features --features grpc-mtls
ci-release-readiness:
@echo "otel-bootstrap: single-crate lib — nothing to validate here"
ci-coverage:
RUSTFLAGS="-D warnings" $(CARGO) llvm-cov nextest --workspace \
--features integration-tests,grpc-mtls \
--show-missing-lines \
--fail-uncovered-lines 110
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)"
lockfile:
cargo generate-lockfile
spec-check:
@test -f SPEC.md || { echo "ERROR: SPEC.md missing"; exit 1; }
@grep -q 'wire_surface:' SPEC.md || { echo "ERROR: SPEC.md missing wire_surface field"; exit 1; }
@echo "spec-check: OK"
pre-commit: spec-check ci-format ci-lint ci-lockfile-diff ci-test ci-changelog
clean:
$(CARGO) clean
.PHONY: ci-changelog
ci-changelog:
@bash -lc 'bash <(curl -fsSL https://raw.githubusercontent.com/brefwiz/shared-ci-workflows/main/scripts/check-release-changelog.sh)'