chore: add Makefile for build automation

Add comprehensive Makefile with 20+ commands for development,
testing, deployment, and infrastructure management.

Key commands:
- make dev: Start development stack
- make test: Run all tests
- make terraform-local/ansible-local: Local VM testing
- make deploy: Production deployment
- make fmt/lint/clean: Code quality

Provides unified interface for all development operations.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
This commit is contained in:
Charles N Wyble
2026-01-13 20:41:50 -05:00
parent 770d2588ed
commit 7294d2661f

87
Makefile Normal file
View File

@@ -0,0 +1,87 @@
.PHONY: help dev test deploy clean
help: ## Show this help message
@echo 'YDN Makefile Commands'
@echo '====================='
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
dev: ## Start development stack
docker-compose -f docker/docker-compose.yml up -d
@echo "Development stack started. Access: http://localhost:8080"
dev-logs: ## Show development logs
docker-compose -f docker/docker-compose.yml logs -f
dev-stop: ## Stop development stack
docker-compose -f docker/docker-compose.yml down
test-unit: ## Run unit tests
cd services/api && go test -v ./...
cd services/worker && go test -v ./...
cd services/middleware && go test -v ./...
cd pkg && go test -v ./...
test-integration: ## Run integration tests
cd tests/integration && go test -v ./...
test-e2e: ## Run end-to-end tests (requires local VM)
cd tests/e2e && go test -v ./...
test: test-unit test-integration ## Run all tests
terraform-local: ## Provision local VM for testing
cd infrastructure/terraform/environments/local && terraform init && terraform apply
terraform-destroy-local: ## Destroy local VM
cd infrastructure/terraform/environments/local && terraform destroy
ansible-local: ## Configure local VM via Ansible
cd infrastructure/ansible && ansible-playbook -i inventory/local.yml playbooks/provision.yml
ansible-production: ## Configure production VMs via Ansible
cd infrastructure/ansible && ansible-playbook -i inventory/production.yml playbooks/provision.yml
deploy: ## Deploy to production
@echo "Deploying to production..."
./scripts/deploy.sh
backup: ## Run backup scripts
./scripts/backup.sh
lint: ## Run linters
cd services/api && golangci-lint run
cd services/worker && golangci-lint run
cd services/middleware && golangci-lint run
fmt: ## Format code
cd services/api && go fmt ./...
cd services/worker && go fmt ./...
cd services/middleware && go fmt ./...
cd pkg && go fmt ./...
clean: ## Clean up build artifacts
cd services/api && go clean
cd services/worker && go clean
cd services/middleware && go clean
cd pkg && go clean
build: ## Build all services
cd services/api && go build -o ../../bin/api .
cd services/worker && go build -o ../../bin/worker .
cd services/middleware && go build -o ../../bin/middleware .
docker-build: ## Build Docker images
docker-compose -f docker/docker-compose.yml build
docker-push: ## Push images to private registry
docker-compose -f docker/docker-compose.yml push
setup: ## Setup development environment
@echo "Setting up YDN development environment..."
@mkdir -p bin logs tmp
@go mod download
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@cd infrastructure/terraform && terraform init -upgrade
@echo "Setup complete!"
init: setup ## Alias for setup