hammerwork 0.3.0

A high-performance, database-driven job queue for Rust with PostgreSQL and MySQL support, featuring cron scheduling, job timeouts, dead job management, and comprehensive statistics collection
Documentation
# Hammerwork Job Queue Makefile
# Provides convenient targets for development and testing

.PHONY: help build test test-unit test-integration test-postgres test-mysql
.PHONY: setup-db start-db stop-db restart-db clean-db logs-db
.PHONY: integration-postgres integration-mysql integration-all
.PHONY: performance benchmark clean cleanup docker-build
.PHONY: lint format check ci

# Default target
help:
	@echo "Hammerwork Job Queue - Available Targets"
	@echo "========================================"
	@echo ""
	@echo "Development:"
	@echo "  build              Build the project"
	@echo "  test               Run all tests"
	@echo "  test-unit          Run unit tests only"
	@echo "  test-integration   Run integration tests without databases"
	@echo "  lint               Run clippy linting"
	@echo "  format             Format code with rustfmt"
	@echo "  check              Run cargo check"
	@echo ""
	@echo "Database Management:"
	@echo "  setup-db           Start database containers"
	@echo "  start-db           Start database containers"
	@echo "  stop-db            Stop database containers" 
	@echo "  restart-db         Restart database containers"
	@echo "  clean-db           Clean database containers and volumes"
	@echo "  logs-db            Show database logs"
	@echo ""
	@echo "Integration Testing:"
	@echo "  integration-all    Run all integration tests"
	@echo "  integration-postgres  Run PostgreSQL integration tests"
	@echo "  integration-mysql     Run MySQL integration tests"
	@echo "  test-postgres      Run PostgreSQL tests only"
	@echo "  test-mysql         Run MySQL tests only"
	@echo ""
	@echo "Performance & Benchmarks:"
	@echo "  performance        Run performance benchmarks"
	@echo "  benchmark          Alias for performance"
	@echo ""
	@echo "Docker:"
	@echo "  docker-build       Build integration Docker images"
	@echo "  docker-run-postgres   Run PostgreSQL integration container"
	@echo "  docker-run-mysql      Run MySQL integration container"
	@echo ""
	@echo "Cleanup:"
	@echo "  clean              Clean Rust build artifacts"
	@echo "  cleanup            Full cleanup (containers, volumes, images)"
	@echo ""
	@echo "CI/CD:"
	@echo "  ci                 Run all CI checks"
	@echo ""

# Build targets
build:
	@echo "๐Ÿ”จ Building Hammerwork..."
	cargo build

build-release:
	@echo "๐Ÿ”จ Building Hammerwork (release)..."
	cargo build --release

build-all:
	@echo "๐Ÿ”จ Building all workspace members..."
	cargo build --workspace

# Test targets
test: test-unit test-integration
	@echo "โœ… All tests completed"

test-unit:
	@echo "๐Ÿงช Running unit tests..."
	cargo test --lib

test-integration:
	@echo "๐Ÿงช Running integration tests (without databases)..."
	cargo test --test integration_tests

test-postgres:
	@echo "๐Ÿ˜ Running PostgreSQL tests..."
	./scripts/test-postgres.sh

test-mysql:
	@echo "๐Ÿฌ Running MySQL tests..."
	./scripts/test-mysql.sh

# Database management
setup-db: start-db

start-db:
	@echo "๐Ÿ—„๏ธ  Starting databases..."
	./scripts/setup-db.sh --start

stop-db:
	@echo "๐Ÿ›‘ Stopping databases..."
	./scripts/setup-db.sh --stop

restart-db:
	@echo "๐Ÿ”„ Restarting databases..."
	./scripts/setup-db.sh --restart

clean-db:
	@echo "๐Ÿงน Cleaning databases..."
	./scripts/setup-db.sh --clean

logs-db:
	@echo "๐Ÿ“‹ Showing database logs..."
	./scripts/setup-db.sh --logs

status-db:
	@echo "๐Ÿ“Š Checking database status..."
	./scripts/setup-db.sh --status

# Integration testing
integration-all:
	@echo "๐Ÿš€ Running all integration tests..."
	./scripts/test-local.sh

integration-postgres:
	@echo "๐Ÿ˜ Running PostgreSQL integration..."
	./scripts/test-local.sh --postgres-only

integration-mysql:
	@echo "๐Ÿฌ Running MySQL integration..."
	./scripts/test-local.sh --mysql-only

# Performance testing
performance: benchmark

benchmark:
	@echo "๐ŸŽ๏ธ  Running performance benchmarks..."
	./scripts/test-local.sh --performance

# Docker targets
docker-build:
	@echo "๐Ÿณ Building Docker images..."
	docker-compose build postgres-integration mysql-integration

docker-run-postgres:
	@echo "๐Ÿณ Running PostgreSQL integration container..."
	docker-compose --profile integration up --build postgres-integration

docker-run-mysql:
	@echo "๐Ÿณ Running MySQL integration container..."
	docker-compose --profile integration up --build mysql-integration

# Code quality
lint:
	@echo "๐Ÿ“ Running clippy..."
	cargo clippy --workspace --all-targets --all-features -- -D warnings

format:
	@echo "๐ŸŽจ Formatting code..."
	cargo fmt --all

format-check:
	@echo "๐ŸŽจ Checking code formatting..."
	cargo fmt --all -- --check

check:
	@echo "๐Ÿ” Running cargo check..."
	cargo check --workspace --all-targets --all-features

# Feature-specific builds and tests
postgres-build:
	@echo "๐Ÿ˜ Building with PostgreSQL features..."
	cargo build --features postgres

mysql-build:
	@echo "๐Ÿฌ Building with MySQL features..."
	cargo build --features mysql

postgres-test:
	@echo "๐Ÿ˜ Testing PostgreSQL features..."
	cargo test --features postgres

mysql-test:
	@echo "๐Ÿฌ Testing MySQL features..."
	cargo test --features mysql

# Examples
run-postgres-example:
	@echo "๐Ÿ˜ Running PostgreSQL example..."
	cargo run --example postgres_example --features postgres

run-mysql-example:
	@echo "๐Ÿฌ Running MySQL example..."
	cargo run --example mysql_example --features mysql

# Cleanup targets
clean:
	@echo "๐Ÿงน Cleaning build artifacts..."
	cargo clean

cleanup:
	@echo "๐Ÿงน Full cleanup..."
	./scripts/cleanup.sh

cleanup-force:
	@echo "๐Ÿงน Force cleanup..."
	./scripts/cleanup.sh --force

# CI/CD targets
ci: format-check lint check test-unit test-integration
	@echo "โœ… All CI checks passed"

ci-postgres: postgres-build postgres-test integration-postgres
	@echo "โœ… PostgreSQL CI checks passed"

ci-mysql: mysql-build mysql-test integration-mysql
	@echo "โœ… MySQL CI checks passed"

# Development helpers
dev-setup: start-db
	@echo "๐Ÿ› ๏ธ  Development environment ready"
	@echo "  - Databases started"
	@echo "  - Run 'make test' to verify setup"

dev-reset: cleanup dev-setup
	@echo "๐Ÿ”„ Development environment reset"

# Release preparation
pre-release: format lint check test integration-all benchmark
	@echo "๐Ÿšข Pre-release checks completed"

# Documentation
docs:
	@echo "๐Ÿ“š Building documentation..."
	cargo doc --workspace --all-features

docs-open:
	@echo "๐Ÿ“š Opening documentation..."
	cargo doc --workspace --all-features --open

# Dependency management
update-deps:
	@echo "๐Ÿ“ฆ Updating dependencies..."
	cargo update

audit:
	@echo "๐Ÿ” Running security audit..."
	cargo audit

# Quick development cycle
quick: format check test-unit
	@echo "โšก Quick development cycle completed"

full: clean build lint test integration-all
	@echo "๐ŸŽฏ Full development cycle completed"