.PHONY: help setup check test test-unit test-integration lint format doc clean bench audit coverage release-check examples
help:
@echo "๐ ๏ธ api_gemini development commands:"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "๐ Common workflows:"
@echo " make setup @echo " make dev @echo " make test-all @echo " make release-check
setup:
@echo "๐ Setting up development environment..."
@./scripts/dev-setup.sh
check:
@echo "๐ Running cargo check..."
@cargo check --all-targets --all-features
lint:
@echo "๐ Running clippy..."
@cargo clippy --all-targets --all-features -- -D warnings
test: test-unit
test-unit:
@echo "๐งช Running unit tests..."
@cargo test --lib
test-integration:
@echo "๐ Running integration tests..."
@if [ -z "$$GEMINI_API_KEY" ]; then \
echo "โ ๏ธ GEMINI_API_KEY not set - integration tests require API key"; \
echo " Set environment variable or add to workspace secret/-secrets.sh"; \
exit 1; \
fi
@cargo test --features integration
test-all: test-unit test-integration
test-verbose:
@echo "๐งช Running tests with verbose output..."
@RUST_LOG=debug cargo test --lib -- --nocapture
dev: lint test-unit
dev-watch:
@echo "๐ Watching for changes..."
@cargo watch -x "test --lib"
doc:
@echo "๐ Building documentation..."
@cargo doc --open --all-features
doc-check:
@echo "๐ Checking documentation..."
@cargo test --doc --all-features
bloat:
@echo "๐ Analyzing binary size..."
@cargo bloat --release
audit:
@echo "๐ Running security audit..."
@cargo audit
outdated:
@echo "๐
Checking for outdated dependencies..."
@cargo outdated
coverage:
@echo "๐ Generating coverage report..."
@cargo tarpaulin --out Html --output-dir coverage
@echo "Coverage report: coverage/tarpaulin-report.html"
examples:
@echo "๐ Available examples:"
@find examples -name "*.rs" -exec basename {} .rs \; | sort | sed 's/^/ /'
example: ## Run an example (use: make example EXAMPLE=gemini_chat_basic)
@if [ -z "$(EXAMPLE)" ]; then \
echo "โ Please specify an example: make example EXAMPLE=gemini_chat_basic"; \
echo "Available examples:"; \
find examples -name "*.rs" -exec basename {} .rs \; | sort | sed 's/^/ /'; \
exit 1; \
fi
@echo "๐ Running example: $(EXAMPLE)"
@cargo run --example $(EXAMPLE)
clean:
@echo "๐งน Cleaning build artifacts..."
@cargo clean
@rm -rf coverage/
clean-all: clean
@echo "๐งน Cleaning all artifacts..."
@rm -rf target/
@rm -rf ~/.cargo/registry/index/*
release-check: lint doc-check test-unit audit
@echo "๐ Checking release readiness..."
@echo "โ
All release checks passed!"
publish-dry:
@echo "๐ฆ Dry run cargo publish..."
@cargo publish --dry-run
deps-tree:
@echo "๐ณ Dependency tree:"
@cargo tree
deps-licenses:
@echo "๐ Dependency licenses:"
@cargo tree --format "{p} {l}"
init-api-key:
@echo "๐ Setting up API key in workspace secrets..."
@echo "โ ๏ธ Note: This will add GEMINI_API_KEY to workspace root secret/-secrets.sh"
@echo -n "Enter your Gemini API key: " && read -s key && \
echo "" && \
echo "export GEMINI_API_KEY=\"$$key\"" >> ../../secret/-secrets.sh && \
chmod 600 ../../secret/-secrets.sh && \
echo "โ
API key added to workspace secret/-secrets.sh (workspace_tools 0.6.0)"
dev-server:
@echo "๐ Starting development server with auto-reload..."
@cargo watch -x "check --all-targets" -x "test --lib"
profile:
@echo "๐ Profiling application..."
@cargo build --release
@echo "Use 'perf' or other profiling tools with target/release/..."
debug-example:
@if [ -z "$(EXAMPLE)" ]; then \
echo "โ Please specify an example: make debug-example EXAMPLE=gemini_chat_basic"; \
exit 1; \
fi
@echo "๐ Running example with debug info: $(EXAMPLE)"
@RUST_LOG=debug RUST_BACKTRACE=full cargo run --example $(EXAMPLE)
help-testing:
@echo "๐งช Testing Commands Help:"
@echo ""
@echo " test-unit - Fast unit tests, no API key required"
@echo " test-integration - Requires GEMINI_API_KEY environment variable"
@echo " test-all - Runs both unit and integration tests"
@echo " test-verbose - Shows detailed test output"
@echo ""
@echo "๐ก Tips:"
@echo " - Use 'make init-api-key' to set up your API key"
@echo " - Set RUST_LOG=debug for detailed logging"
@echo " - Integration tests may take 15-30 seconds due to API processing"
help-examples:
@echo "๐ Examples Commands Help:"
@echo ""
@echo " examples - List all available examples"
@echo " example - Run specific example (make example EXAMPLE=name)"
@echo " debug-example - Run example with full debugging"
@echo ""
@echo "Available examples:"
@find examples -name "*.rs" -exec basename {} .rs \; | sort | sed 's/^/ /'
@echo ""
@echo "๐ก Usage: make example EXAMPLE=gemini_chat_basic"