.PHONY: help fmt ci-format ci-lint ci-no-std ci-test ci-coverage ci-audit ci-deny build clean \
proto-lint proto-breaking ci-release-readiness spec-check \
ci-build-check sdk-e2e-check sdk-e2e-prebuild sc-001-check \
lockfile ci-lockfile-diff
.DEFAULT_GOAL := help
ADVISORY_DB ?=
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
fmt:
cargo fmt --all
ci-format:
cargo fmt --all -- --check
ci-lint:
cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings
ci-no-std:
cargo check --no-default-features
cargo check --no-default-features --features alloc
cargo check --no-default-features --features alloc,serde
ci-test:
cargo nextest run --workspace --all-features
ci-coverage:
cargo llvm-cov nextest --workspace --all-features --fail-under-functions 100
build:
cargo build --release
ci-audit: ## Run cargo audit (PLATFORM-008 — strict, no default ignores). Pass ADVISORY_DB=... to use a local clone.
cargo audit $(if $(ADVISORY_DB),--db $(ADVISORY_DB),)
ci-deny:
cargo deny check licenses
clean:
cargo clean
proto-lint:
buf lint api-bones-protos/proto
proto-breaking:
@if git cat-file -e origin/main:api-bones-protos/proto/buf.yaml 2>/dev/null; then \
buf breaking api-bones-protos/proto --against ".git#branch=origin/main,subdir=api-bones-protos/proto"; \
elif git cat-file -e origin/main:proto/buf.yaml 2>/dev/null; then \
echo "proto/ on origin/main — comparing against the pre-move location"; \
buf breaking api-bones-protos/proto --against ".git#branch=origin/main,subdir=proto"; \
else \
echo "proto/ not present on origin/main yet — skipping breaking-change check"; \
fi
PUBLISHABLE_CRATES := api-bones api-bones-tower api-bones-reqwest api-bones-progenitor api-bones-sdk-gen api-bones-test api-bones-protos
ci-release-readiness:
@set -eu; \
for crate in $(PUBLISHABLE_CRATES); do \
echo "==> packaging + verifying $$crate..."; \
cargo package -p "$$crate" --allow-dirty; \
done; \
echo "==> all publishable crates package-verified."
.PHONY: lockfile
lockfile:
cargo generate-lockfile
.PHONY: ci-lockfile-diff
ci-lockfile-diff:
@cargo generate-lockfile
@if ! git diff --quiet Cargo.lock; then \
echo 'ERROR: Cargo.lock is out of date. Run: make lockfile && git add Cargo.lock'; \
git diff Cargo.lock; exit 1; \
fi
.PHONY: sc-001-check
sc-001-check:
@grep -rn 'tracing_subscriber::fmt().*try_init\|tracing_subscriber::fmt::Subscriber.*try_init' \
src/main.rs src/bin/*.rs 2>/dev/null \
&& (echo 'SC-001 violation: use otel-bootstrap via service-kit instead' && exit 1) || true
.PHONY: ci-build-check
ci-build-check:
cargo check --all-features
cargo check --no-default-features
.PHONY: sdk-e2e-check
sdk-e2e-check:
@echo "sdk-e2e-check: no-op (library crate)"
.PHONY: sdk-e2e-prebuild
sdk-e2e-prebuild:
@echo "sdk-e2e-prebuild: no-op (library crate)"
.PHONY: spec-check
spec-check:
@SPEC=SPEC.md; \
VALID="proto-source utoipa-legacy mixed-transition"; \
[ -f "$$SPEC" ] || { echo "ERROR: $$SPEC missing (ADR-0086 L1)"; exit 1; }; \
WS=$$(awk 'BEGIN{f=0}/^---/{f=!f;next}f&&/^wire_surface:/{print $$2;exit}' "$$SPEC"); \
[ -n "$$WS" ] || { echo "ERROR: wire_surface field missing (ADR-0086 L1)"; exit 1; }; \
echo "$$VALID" | tr ' ' '\n' | grep -qx "$$WS" \
|| { echo "ERROR: wire_surface='$$WS' invalid. Must be one of: $$VALID"; exit 1; }; \
echo "spec-check OK: wire_surface=$$WS"
.PHONY: pre-commit
pre-commit: ci-format ci-lint ci-test ci-changelog
.PHONY: ci-changelog
ci-changelog:
@bash <(curl -fsSL https://raw.githubusercontent.com/brefwiz/shared-ci-workflows/main/scripts/check-release-changelog.sh)