-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
144 lines (103 loc) · 4.69 KB
/
Makefile
File metadata and controls
144 lines (103 loc) · 4.69 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.PHONY: all build test clean deps deps-go deps-check deps-install dev fmt lint coverage build-all build-unix install help \
operator-build operator-run operator-docker-build operator-docker-push \
operator-test operator-deploy operator-undeploy operator-install operator-uninstall \
operator-manifests operator-generate operator-coverage \
registry-deploy
# Variables
BINARY_NAME ?= mcp-runtime
BUILD_DIR ?= bin
GOCACHE ?= $(CURDIR)/.gocache
export GOCACHE
##@ General
help: ## Display this help message.
@echo "Usage: make [target]"
@echo ""
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Build
all: build ## Default target: build CLI
build: ## Build CLI binary for current platform.
@echo "Building $(BINARY_NAME) CLI..."
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/mcp-runtime
build-all: ## Build CLI for all Unix platforms (macOS and Linux, ARM64 and AMD64).
@echo "Building for all Unix platforms..."
@mkdir -p $(BUILD_DIR)
@echo "Building macOS ARM64..."
GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/mcp-runtime
@echo "Building macOS AMD64..."
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/mcp-runtime
@echo "Building Linux ARM64..."
GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/mcp-runtime
@echo "Building Linux AMD64..."
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/mcp-runtime
@echo "Build complete. Binaries in $(BUILD_DIR)/"
build-unix: build-all ## Alias for build-all to keep CI targets stable.
##@ Development
dev: build ## Build and run CLI in development mode.
./$(BUILD_DIR)/$(BINARY_NAME)
deps: deps-check deps-go ## Verify host tools, then download Go modules (Go 1.25+, docker, kubectl).
deps-go: ## Go mod download and tidy (root) plus go mod download for each nested module in services/ and examples/.
@./hack/deps.sh go
deps-check: ## Verify toolchain on PATH. Set STRICT_DEPS_CHECK=1 to fail the recipe if a tool is missing.
@./hack/deps.sh check
deps-install: ## Best-effort install of host tools where supported (Go, Docker client, kubectl).
@./hack/deps.sh install
##@ Testing
test: ## Run all tests.
go test -v ./...
coverage: ## Generate code coverage report.
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
##@ Code Quality
fmt: ## Format Go code using go fmt.
go fmt ./...
lint: ## Lint code using golangci-lint (requires golangci-lint to be installed).
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not found. Please install from https://github.com/golangci/golangci-lint#install"; \
exit 1; \
fi
vet: ## Run go vet.
go vet ./...
##@ Cleanup
clean: ## Remove build artifacts and clean Go cache.
@echo "Cleaning build artifacts..."
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
go clean
##@ Installation
install: build ## Install CLI binary to /usr/local/bin (requires sudo).
@echo "Installing $(BINARY_NAME) to /usr/local/bin..."
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
@echo "Installation complete. Run '$(BINARY_NAME)' to use."
##@ Operator
operator-build: ## Build operator binary.
@$(MAKE) -f Makefile.operator build
operator-run: ## Run operator against the configured Kubernetes cluster.
@$(MAKE) -f Makefile.operator run
operator-docker-build: ## Build Docker image with the operator.
@$(MAKE) -f Makefile.operator docker-build
operator-docker-push: ## Push Docker image to registry.
@$(MAKE) -f Makefile.operator docker-push
operator-test: ## Run operator tests.
@$(MAKE) -f Makefile.operator test
operator-coverage: ## Generate operator code coverage report.
@$(MAKE) -f Makefile.operator coverage
operator-deploy: ## Deploy operator to Kubernetes cluster.
@$(MAKE) -f Makefile.operator deploy
operator-undeploy: ## Undeploy operator from Kubernetes cluster.
@$(MAKE) -f Makefile.operator undeploy
operator-install: ## Install operator CRDs into Kubernetes cluster.
@$(MAKE) -f Makefile.operator install
operator-uninstall: ## Uninstall operator CRDs from Kubernetes cluster.
@$(MAKE) -f Makefile.operator uninstall
operator-manifests: ## Generate operator manifests (CRDs, RBAC).
@$(MAKE) -f Makefile.operator manifests
operator-generate: ## Generate operator code (DeepCopy methods).
@$(MAKE) -f Makefile.operator generate
##@ Registry
registry-deploy: ## Deploy container registry to Kubernetes cluster.
kubectl apply -k config/registry/