CARGO ?= cargo
PUBLISH_CRATE ?= contextvm-sdk
VERSION ?= $(shell sed -n 's/^version *= *"\(.*\)"/\1/p' Cargo.toml | head -1)
ALL ?= --all
ALL_FEATURES ?= --all-features
.PHONY: help fmt-check clippy check-all test test-no-default doc \
examples check publish-dry release-dry publish release clean
help:
@echo "ContextVM Rust SDK - release Makefile"
@echo ""
@echo "Targets:"
@echo " make help - show this help message"
@echo " make check - run the full CI quality gate"
@echo " make release-dry - quality gate + cargo publish --dry-run (no upload)"
@echo " make release - quality gate + upload contextvm-sdk to crates.io"
@echo ""
@echo "Quality-gate sub-targets (composed by 'check'):"
@echo " make fmt-check - cargo fmt --all -- --check"
@echo " make clippy - cargo clippy --all --all-features -- -D warnings"
@echo " make check-all - cargo check --all --all-features"
@echo " make test - cargo test --all --all-features"
@echo " make test-no-default - cargo test --no-default-features"
@echo " make doc - cargo doc --no-deps --all-features"
@echo " make examples - run the rmcp integration example (local, offline)"
@echo ""
@echo "Publish sub-targets:"
@echo " make publish-dry - cargo publish --dry-run -p contextvm-sdk"
@echo " make publish - cargo publish -p contextvm-sdk (uploads to crates.io)"
@echo ""
@echo "Other:"
@echo " make clean - cargo clean"
@echo ""
@echo "See the header of this file for the full release procedure."
fmt-check:
@echo "==> fmt --check"
$(CARGO) fmt --all -- --check
clippy:
@echo "==> clippy (all features, -D warnings)"
$(CARGO) clippy $(ALL) $(ALL_FEATURES) --all-targets -- -D warnings
check-all:
@echo "==> check (all features)"
$(CARGO) check $(ALL) $(ALL_FEATURES)
test:
@echo "==> test (all features)"
$(CARGO) test $(ALL) $(ALL_FEATURES)
test-no-default:
@echo "==> test (no default features)"
$(CARGO) test --no-default-features
doc:
@echo "==> doc (all features)"
$(CARGO) doc --no-deps $(ALL_FEATURES)
examples:
@echo "==> rmcp integration example (local)"
$(CARGO) run --example rmcp_integration_test --features rmcp -- local
check: fmt-check clippy check-all test test-no-default doc examples
@echo ""
@echo "All quality-gate checks passed."
publish-dry:
@echo "==> cargo publish --dry-run --allow-dirty -p $(PUBLISH_CRATE)"
$(CARGO) publish --dry-run --allow-dirty -p $(PUBLISH_CRATE)
release-dry: check publish-dry
@echo ""
@echo "Dry run complete. Nothing was uploaded."
publish:
@echo "==> cargo publish -p $(PUBLISH_CRATE) (uploading to crates.io)"
$(CARGO) publish -p $(PUBLISH_CRATE)
release: check publish
@echo ""
@echo "Released $(PUBLISH_CRATE) $(VERSION) to crates.io."
@echo "Tag and push (if not already): git tag v$(VERSION) && git push origin v$(VERSION)"
clean:
$(CARGO) clean