.PHONY: all build test bench clean run docker-build docker-run help
all: build
build:
cargo build --release
test:
cargo test --all-features -- --nocapture
test-unit:
cargo test --lib --all-features -- --nocapture
test-integration:
cargo test --test '*' --all-features -- --nocapture
coverage:
cargo tarpaulin --out Html --output-dir coverage --all-features --verbose
coverage-open: coverage
open coverage/tarpaulin-report.html
coverage-check:
cargo tarpaulin --all-features
bench:
cargo bench
clean:
cargo clean
rm -rf target/
run:
cargo run -- -f examples/sample_database.yaml --hot-reload -v
run-prod:
cargo run --release -- -f examples/sample_database.yaml
docker-build:
docker build -t yamlbase:latest .
docker-run:
docker run -d --name yamlbase -p 5432:5432 -v $(PWD)/examples/sample_database.yaml:/data/database.yaml yamlbase:latest
docker-stop:
docker stop yamlbase && docker rm yamlbase
lint:
cargo clippy -- -D warnings
fmt:
cargo fmt
fmt-check:
cargo fmt -- --check
check:
cargo check --all-features
ci: fmt-check check lint test
test-postgres:
@echo "Starting PostgreSQL server in background..."
@cargo run -- -f examples/sample_database.yaml --protocol postgres &
@sleep 3
@echo "Running PostgreSQL test queries..."
@./test_queries.sh
@echo "Stopping server..."
@pkill -f "cargo run.*yamlbase" || true
test-mysql:
@echo "Starting MySQL server in background..."
@cargo run -- -f examples/sample_database.yaml --protocol mysql &
@sleep 3
@echo "Running MySQL test queries..."
@./test_mysql_queries.sh
@echo "Stopping server..."
@pkill -f "cargo run.*yamlbase" || true
test-client: test-postgres test-mysql
docs:
cargo doc --no-deps --open
help:
@echo "Available targets:"
@echo " make build - Build the project in release mode"
@echo " make test - Run all tests"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make coverage - Run tests with coverage report"
@echo " make coverage-open - Run coverage and open HTML report"
@echo " make coverage-check - Check coverage percentage"
@echo " make bench - Run benchmarks"
@echo " make clean - Clean build artifacts"
@echo " make run - Run the server locally with sample data"
@echo " make run-prod - Run in production mode (release build)"
@echo " make docker-build - Build Docker image"
@echo " make docker-run - Run with Docker"
@echo " make docker-stop - Stop Docker container"
@echo " make lint - Run linting with clippy"
@echo " make fmt - Format code"
@echo " make fmt-check - Check code formatting"
@echo " make check - Type check the code"
@echo " make ci - Run all checks (format, lint, type check, test)"
@echo " make test-client - Test with PostgreSQL client"
@echo " make docs - Generate and open documentation"
@echo " make help - Show this help message"