-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.56 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.56 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
.PHONY: build test clean run-dev release-snapshot run-docker run docker-compose-up docker-compose-down lint
# Variables
BINARY_NAME=kafka-mcp-server
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_DIR=bin
# Build the application
build:
mkdir -p $(BUILD_DIR)
go build -ldflags "-X main.Version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd
# Run tests
test:
go test ./...
# Run tests without Kafka container (skips integration tests)
test-no-kafka:
SKIP_KAFKA_TESTS=true go test ./...
# Clean build artifacts
clean:
rm -rf $(BUILD_DIR)
# Run the application in development mode
run-dev:
go run cmd/main.go
# Create a release snapshot using GoReleaser
release-snapshot:
goreleaser release --snapshot --clean
# Run the application using the built binary
run:
./$(BUILD_DIR)/$(BINARY_NAME)
# Build and run Docker image
run-docker: build
docker build -t $(BINARY_NAME):$(VERSION) .
docker run -p 9097:9097 $(BINARY_NAME):$(VERSION)
# Start the application with Docker Compose
docker-compose-up:
docker-compose up -d
# Stop Docker Compose services
docker-compose-down:
docker-compose down
# Run linting checks (same as CI)
lint:
@echo "Running linters..."
@go mod tidy
@if ! git diff --quiet go.mod go.sum; then echo "go.mod or go.sum is not tidy, run 'go mod tidy'"; git diff go.mod go.sum; exit 1; fi
@if ! command -v golangci-lint &> /dev/null; then echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; fi
@golangci-lint run --timeout=5m
# Default target
all: clean build