syros 1.0.1

Syros - Distributed Coordination Service
Documentation
.PHONY: help build test clean docker run dev fmt lint bench docs


# Default target
help:
	@echo "Syros - Makefile Commands"

	@echo "=================================="

	@echo "Development:"

	@echo "  dev         - Start development environment"

	@echo "  build       - Build the project"

	@echo "  test        - Run all tests"

	@echo "  bench       - Run benchmarks"

	@echo "  fmt         - Format code"

	@echo "  lint        - Run linter"

	@echo "  clean       - Clean build artifacts"

	@echo ""

	@echo "Docker:"

	@echo "  docker      - Build Docker image"

	@echo "  run         - Run with Docker Compose"

	@echo "  stop        - Stop Docker Compose"

	@echo ""

	@echo "Documentation:"

	@echo "  docs        - Generate documentation"

	@echo "  serve-docs  - Serve documentation locally"

	@echo ""

	@echo "Release:"

	@echo "  release     - Build release version"

	@echo "  package     - Create release package"


# Development commands
dev:
	@echo "๐Ÿš€ Starting development environment..."

	docker-compose up -d redis etcd postgres

	@echo "โœ… Infrastructure started"

	@echo "๐Ÿ”ง Run 'cargo run' to start Syros"


build:
	@echo "๐Ÿ”จ Building Syros..."

	cargo build


test:
	@echo "๐Ÿงช Running tests..."

	cargo test --verbose

	@echo "๐Ÿงช Running integration tests..."

	cargo test --test integration --verbose


bench:
	@echo "๐Ÿ“Š Running benchmarks..."

	cargo bench


fmt:
	@echo "๐ŸŽจ Formatting code..."

	cargo fmt --all


lint:
	@echo "๐Ÿ” Running linter..."

	cargo clippy --all-targets --all-features -- -D warnings


clean:
	@echo "๐Ÿงน Cleaning build artifacts..."

	cargo clean

	docker system prune -f


# Docker commands
docker:
	@echo "๐Ÿณ Building Docker image..."

	docker build -t syros .


run:
	@echo "๐Ÿš€ Starting Syros with Docker Compose..."

	docker-compose up -d

	@echo "โœ… Syros started!"

	@echo ""

	@echo "๐ŸŒ Services available at:"

	@echo "  - REST API: http://localhost:8080"

	@echo "  - gRPC: localhost:9090"

	@echo "  - WebSocket: ws://localhost:8081/ws"

	@echo "  - Prometheus: http://localhost:9091"

	@echo "  - Grafana: http://localhost:3000 (admin/admin)"


stop:
	@echo "๐Ÿ›‘ Stopping Syros..."

	docker-compose down


# Documentation
docs:
	@echo "๐Ÿ“š Generating documentation..."

	cargo doc --no-deps --open


serve-docs:
	@echo "๐ŸŒ Serving documentation at http://localhost:8000..."

	python3 -m http.server 8000 -d target/doc


# Release commands
release:
	@echo "๐Ÿš€ Building release version..."

	cargo build --release

	@echo "โœ… Release build completed: target/release/syros"


package: release

	@echo "๐Ÿ“ฆ Creating release package..."

	mkdir -p dist

	cp target/release/syros dist/

	cp -r config dist/

	cp -r examples dist/

	cp README.md LICENSE dist/

	tar -czf dist/syros-$(shell cargo pkgid | cut -d# -f2).tar.gz -C dist .

	@echo "โœ… Release package created: dist/syros-*.tar.gz"


# Setup commands
setup:
	@echo "โš™๏ธ Setting up development environment..."

	@command -v docker >/dev/null 2>&1 || { echo "โŒ Docker is required but not installed."; exit 1; }

	@command -v docker-compose >/dev/null 2>&1 || { echo "โŒ Docker Compose is required but not installed."; exit 1; }

	@command -v rust >/dev/null 2>&1 || { echo "โŒ Rust is required but not installed. Visit https://rustup.rs/"; exit 1; }

	docker-compose pull

	cargo fetch

	@echo "โœ… Development environment setup complete!"


# Database migrations (when implemented)
migrate:
	@echo "๐Ÿ—„๏ธ Running database migrations..."

	# TODO: Implement database migrations
	@echo "โœ… Migrations completed"


# Security audit
audit:
	@echo "๐Ÿ”’ Running security audit..."

	cargo audit


# Performance profiling
profile:
	@echo "๐Ÿ“ˆ Running performance profile..."

	cargo build --release

	perf record --call-graph=dwarf target/release/syros

	perf report


# Load testing
load-test:
	@echo "โšก Running load tests..."

	@command -v wrk >/dev/null 2>&1 || { echo "โŒ wrk is required for load testing. Install with: sudo apt-get install wrk"; exit 1; }

	wrk -t12 -c400 -d30s --latency http://localhost:8080/health


# Install dependencies
deps:
	@echo "๐Ÿ“ฆ Installing dependencies..."

	cargo fetch

	@echo "โœ… Dependencies installed"


# Check project health
check: fmt lint test audit

	@echo "โœ… All checks passed!"


# CI/CD simulation
ci: check bench

	@echo "โœ… CI pipeline completed successfully!"


# Quick start
quick-start: setup build run

	@echo "๐ŸŽ‰ Syros is running!"

	@echo "๐Ÿ“– Check examples/ directory for usage examples"

	@echo "๐Ÿ“š Documentation: cargo doc --open"