.PHONY: all ci fmt fmt-check lint test test-release doc doc-check check build clean release
all: ci
ci: fmt-check lint test test-release doc-check check
@echo "All CI checks passed!"
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
lint:
cargo clippy --all-features -- -D warnings
test:
cargo test --all-features
test-release:
cargo test --all-features --release
doc:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
doc-check:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
check:
cargo check --all-features
build:
cargo build --all-features
build-release:
cargo build --all-features --release
clean:
cargo clean
fix: fmt
cargo clippy --all-features --fix --allow-dirty --allow-staged
release:
ifndef VERSION
$(error VERSION is not set. Usage: make release VERSION=x.x.x)
endif
@echo "Creating release branch for version $(VERSION)..."
@ @if [ -n "$$(git status --porcelain)" ]; then \
echo "Error: Working tree is not clean. Please commit or stash changes."; \
exit 1; \
fi
@ git checkout -b release/$(VERSION)
@ @sed -i.bak 's/^version = ".*"/version = "$(VERSION)"/' Cargo.toml && rm -f Cargo.toml.bak
@ cargo update --workspace
@ @$(MAKE) ci
@ git add Cargo.toml Cargo.lock
git commit -m "chore: bump version to $(VERSION)"
@ git push -u origin release/$(VERSION)
@echo ""
@echo "Release branch 'release/$(VERSION)' created and pushed!"
@echo "Next steps:"
@echo " 1. Create a PR from release/$(VERSION) to main"
@echo " 2. After merge, create and push tag: git tag v$(VERSION) && git push origin v$(VERSION)"