-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
125 lines (95 loc) · 3.35 KB
/
Makefile
File metadata and controls
125 lines (95 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
.PHONY: help build run test clean docker-build docker-run deploy lint fmt
# Variables
APP_NAME=stream-processor
DOCKER_IMAGE=synthoraai/stream-processor
VERSION?=latest
GO_VERSION=1.21
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: ## Install dependencies
@echo "Installing dependencies..."
@go mod download
@go mod verify
build: ## Build the application
@echo "Building $(APP_NAME)..."
@cd cmd/stream-processor && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o ../../bin/$(APP_NAME) .
run: ## Run the application
@echo "Running $(APP_NAME)..."
@go run cmd/stream-processor/main.go
test: ## Run tests
@echo "Running tests..."
@go test -v -race -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
test-integration: ## Run integration tests
@echo "Running integration tests..."
@go test -v -tags=integration ./...
benchmark: ## Run benchmarks
@echo "Running benchmarks..."
@go test -bench=. -benchmem ./...
lint: ## Run linter
@echo "Running linter..."
@golangci-lint run ./...
fmt: ## Format code
@echo "Formatting code..."
@gofmt -s -w .
@go mod tidy
clean: ## Clean build artifacts
@echo "Cleaning..."
@rm -rf bin/
@rm -f coverage.out coverage.html
docker-build: ## Build Docker image
@echo "Building Docker image..."
@docker build -t $(DOCKER_IMAGE):$(VERSION) .
@docker tag $(DOCKER_IMAGE):$(VERSION) $(DOCKER_IMAGE):latest
docker-run: ## Run Docker container
@echo "Running Docker container..."
@docker-compose up -d
docker-stop: ## Stop Docker container
@echo "Stopping Docker container..."
@docker-compose down
docker-logs: ## View Docker logs
@docker-compose logs -f stream-processor
docker-push: ## Push Docker image
@echo "Pushing Docker image..."
@docker push $(DOCKER_IMAGE):$(VERSION)
@docker push $(DOCKER_IMAGE):latest
k8s-deploy: ## Deploy to Kubernetes
@echo "Deploying to Kubernetes..."
@kubectl apply -f k8s/
k8s-delete: ## Delete from Kubernetes
@echo "Deleting from Kubernetes..."
@kubectl delete -f k8s/
k8s-logs: ## View Kubernetes logs
@kubectl logs -f deployment/stream-processor
dev: ## Run in development mode
@echo "Starting development environment..."
@docker-compose -f docker-compose.yml up
prod: ## Run in production mode
@echo "Starting production environment..."
@docker-compose -f docker-compose.prod.yml up -d
monitoring: ## Start monitoring stack
@echo "Starting monitoring stack..."
@docker-compose -f docker-compose.monitoring.yml up -d
generate: ## Generate code
@echo "Generating code..."
@go generate ./...
migrate-up: ## Run database migrations up
@echo "Running migrations up..."
# Add migration commands here
migrate-down: ## Run database migrations down
@echo "Running migrations down..."
# Add migration commands here
proto: ## Generate protobuf code
@echo "Generating protobuf code..."
@protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/*.proto
verify: ## Verify dependencies
@echo "Verifying dependencies..."
@go mod verify
security: ## Run security checks
@echo "Running security checks..."
@gosec ./...
all: clean fmt lint test build ## Run all checks and build
.DEFAULT_GOAL := help