-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (73 loc) · 2.04 KB
/
Makefile
File metadata and controls
93 lines (73 loc) · 2.04 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
.PHONY: all build test proto clean docker lint local-up local-down
# Default target
all: proto build
# Generate protobuf code
proto:
@echo "Generating protobuf code..."
cd proto && buf generate
# Build all binaries
build:
@echo "Building binaries..."
go build -o bin/master ./cmd/master
go build -o bin/worker ./cmd/worker
go build -o bin/distctl ./cmd/distctl
go build -o bin/operator ./cmd/operator
# Run tests
test:
go test -v -race ./...
# Run tests with coverage
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
# Lint
lint:
golangci-lint run
# Clean build artifacts
clean:
rm -rf bin/ gen/ coverage.out coverage.html
# Install buf (if not installed)
install-buf:
go install github.com/bufbuild/buf/cmd/buf@latest
# Docker images
docker: docker-master docker-worker
docker-master:
docker build -f Dockerfile.master -t dist-exec-master:latest .
docker-worker:
docker build -f Dockerfile.worker -t dist-exec-worker:latest .
# Local development with docker-compose
local-up:
docker-compose up --build
local-down:
docker-compose down
# Run master locally
run-master:
MASTER_ADDRESS=:50051 LOG_LEVEL=debug go run ./cmd/master
# Run worker locally
run-worker:
WORKER_ID=worker-1 WORKER_ADDRESS=:50052 MASTER_ADDRESS=localhost:50051 LOG_LEVEL=debug go run ./cmd/worker
# Tidy dependencies
tidy:
go mod tidy
# Format code
fmt:
go fmt ./...
# Vet code
vet:
go vet ./...
# Check all (pre-commit)
check: fmt vet test
# Help
help:
@echo "Available targets:"
@echo " all - Generate proto and build (default)"
@echo " proto - Generate protobuf code"
@echo " build - Build all binaries"
@echo " test - Run tests"
@echo " lint - Run linter"
@echo " clean - Clean build artifacts"
@echo " docker - Build Docker images"
@echo " local-up - Start local cluster"
@echo " local-down - Stop local cluster"
@echo " run-master - Run master locally"
@echo " run-worker - Run worker locally"