.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_directory.yaml --allow-anonymous
docker-build:
docker build -t yamldap:latest .
docker-buildx:
docker buildx build --platform linux/amd64,linux/arm64 -t yamldap:latest .
docker-push: docker-login
@if [ -z "$(VERSION)" ]; then echo "Usage: make docker-push VERSION=0.0.1"; exit 1; fi
docker buildx build --platform linux/amd64 \
-t ghcr.io/rvben/yamldap:$(VERSION) \
-t ghcr.io/rvben/yamldap:latest \
--push .
docker-push-multiplatform: docker-login
@if [ -z "$(VERSION)" ]; then echo "Usage: make docker-push-multiplatform VERSION=0.0.1"; exit 1; fi
docker buildx build --platform linux/amd64,linux/arm64 \
-t ghcr.io/rvben/yamldap:$(VERSION) \
-t ghcr.io/rvben/yamldap:latest \
--push .
docker-login:
@echo "Logging into GitHub Container Registry..."
@echo "$$GITHUB_TOKEN" | docker login ghcr.io -u rvben --password-stdin
docker-setup:
docker buildx create --name yamldap-builder --use || true
docker buildx inspect --bootstrap
docker-run:
docker run -d --name yamldap -p 389:389 -v $(PWD)/examples/sample_directory.yaml:/data/directory.yaml yamldap:latest -f /data/directory.yaml --allow-anonymous
docker-compose-up:
docker compose up -d
docker-compose-registry:
docker compose -f compose.registry.yml up -d
docker-stop:
docker stop yamldap && docker rm yamldap || true
docker compose down || true
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-ldap:
@echo "Testing LDAP server..."
@./test_ldap.py || true
release-prep:
@./scripts/prepare-release.sh
release-check:
@echo "Checking release readiness..."
@echo ""
@echo "1. Running tests..."
@cargo test --quiet
@echo "✓ Tests passed"
@echo ""
@echo "2. Checking formatting..."
@cargo fmt -- --check
@echo "✓ Code is formatted"
@echo ""
@echo "3. Running clippy..."
@cargo clippy -- -D warnings
@echo "✓ No clippy warnings"
@echo ""
@echo "4. Checking documentation..."
@cargo doc --no-deps --quiet
@echo "✓ Documentation builds"
@echo ""
@echo "5. Dry-run crates.io publish..."
@cargo publish --dry-run --allow-dirty
@echo "✓ Package is ready for crates.io"
@echo ""
@echo "✅ All checks passed! Ready for release."
@echo ""
@echo "Next steps:"
@echo " 1. Run 'make release-prep' to prepare the release"
@echo " 2. Push the tag to trigger the release workflow"
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"
@echo " make docker-build - Build Docker image (local, current platform)"
@echo " make docker-buildx - Build Docker image for multiple platforms"
@echo " make docker-push VERSION=x.x.x - Build and push to ghcr.io (AMD64)"
@echo " make docker-push-multiplatform VERSION=x.x.x - Push multi-arch to ghcr.io"
@echo " make docker-setup - Setup Docker buildx for multi-platform builds"
@echo " make docker-run - Run with Docker"
@echo " make docker-compose-up - Run with Docker Compose (local build)"
@echo " make docker-compose-registry - Run with Docker Compose (from registry)"
@echo " make docker-stop - Stop Docker containers"
@echo " make test-ldap - Test with LDAP client"
@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 release-check - Check if ready for release"
@echo " make release-prep - Prepare a new release"
@echo " make help - Show this help message"