.PHONY: help test bench coverage lint format check-perf clean install-tools ci-local docs
help:
@echo "kizzasi-tokenizer - Make targets"
@echo ""
@echo "Development:"
@echo " make test - Run all tests"
@echo " make bench - Run benchmarks"
@echo " make coverage - Generate coverage report"
@echo " make lint - Run clippy"
@echo " make format - Format code with rustfmt"
@echo " make docs - Build documentation"
@echo ""
@echo "CI/CD:"
@echo " make ci-local - Run CI checks locally"
@echo " make check-perf - Check for performance regressions"
@echo ""
@echo "Tools:"
@echo " make install-tools - Install required development tools"
@echo " make clean - Clean build artifacts"
test:
cargo test --all-features --verbose
bench:
cargo bench --all-features
coverage:
@echo "Generating coverage report..."
@mkdir -p coverage
cargo tarpaulin \
--all-features \
--workspace \
--timeout 300 \
--out Html \
--out Xml \
--output-dir coverage \
--exclude-files 'benches/*' 'examples/*'
@echo "Coverage report generated in ./coverage/"
@echo "Open ./coverage/index.html in a browser to view"
lint:
cargo clippy --all-targets --all-features -- -D warnings
format:
cargo fmt --all
format-check:
cargo fmt --all -- --check
check-perf:
@./scripts/check_performance.sh master 10
docs:
cargo doc --all-features --no-deps --open
ci-local: format-check lint test docs
@echo ""
@echo "✅ All CI checks passed!"
clean:
cargo clean
rm -rf coverage/
rm -f performance_report.txt
install-tools:
@echo "Installing development tools..."
cargo install cargo-tarpaulin
cargo install cargo-criterion
cargo install critcmp
cargo install cargo-audit
cargo install cargo-udeps
cargo install cargo-minimal-versions
@echo "✅ All tools installed!"
pre-commit: format lint test
@echo ""
@echo "✅ Pre-commit checks passed!"
test-nextest:
@if ! command -v cargo-nextest &> /dev/null; then \
echo "Installing cargo-nextest..."; \
cargo install cargo-nextest --locked; \
fi
cargo nextest run --all-features
bench-baseline:
cargo bench --all-features -- --save-baseline current
bench-compare:
cargo bench --all-features -- --baseline current
test-proptest:
cargo test --all-features --test proptest_suite
test-unit:
cargo test --all-features --lib
check-all: format-check lint test
@echo "Running Miri (undefined behavior detection)..."
@if command -v cargo-miri &> /dev/null; then \
cargo +nightly miri test --all-features; \
else \
echo "⚠️ Miri not installed. Install with: rustup +nightly component add miri"; \
fi
profile-memory:
@echo "Building test binary..."
@cargo test --all-features --no-run
@TEST_BIN=$$(find target/debug/deps -name 'kizzasi_tokenizer-*' -type f -executable | head -n 1); \
if [ -n "$$TEST_BIN" ]; then \
echo "Running Valgrind memory profiling..."; \
valgrind --tool=massif --massif-out-file=massif.out "$$TEST_BIN" --test-threads=1; \
ms_print massif.out > memory_profile.txt; \
echo "Memory profile saved to memory_profile.txt"; \
else \
echo "Error: Test binary not found"; \
exit 1; \
fi
audit:
cargo audit
check-unused:
cargo +nightly udeps --all-features
release:
cargo build --release --all-features
examples:
@echo "Running examples..."
@cargo run --example basic_quantizers --features vqvae
@cargo run --example vqvae_tokenizer --features vqvae
@cargo run --example advanced_features --features vqvae
watch:
@if ! command -v cargo-watch &> /dev/null; then \
echo "Installing cargo-watch..."; \
cargo install cargo-watch; \
fi
cargo watch -x test
flamegraph:
@if ! command -v cargo-flamegraph &> /dev/null; then \
echo "Installing cargo-flamegraph..."; \
cargo install flamegraph; \
fi
@echo "Generating flamegraph..."
@cargo flamegraph --bench comprehensive_benchmarks
publish-check:
cargo publish --dry-run --allow-dirty
release-checklist: clean ci-local check-perf coverage publish-check
@echo ""
@echo "✅ Release checklist complete!"
@echo ""
@echo "Next steps:"
@echo "1. Update version in Cargo.toml"
@echo "2. Update CHANGELOG.md"
@echo "3. Commit: git commit -am 'chore: bump version to X.Y.Z'"
@echo "4. Tag: git tag kizzasi-tokenizer-vX.Y.Z"
@echo "5. Push: git push --tags"