-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (79 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
101 lines (79 loc) · 2.12 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
# kfunc Makefile
# Build targets for operator, gateway, CLI, and testing
# Variables
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
BINARY_DIR=bin
OPERATOR_BINARY=$(BINARY_DIR)/operator
GATEWAY_BINARY=$(BINARY_DIR)/gateway
CLI_BINARY=$(BINARY_DIR)/kfunc
# Controller-gen and other tools
CONTROLLER_GEN=controller-gen
KUSTOMIZE=kustomize
.PHONY: all build test clean manifests deploy help
# Default target
all: build
## help: Display this help message
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## build: Build all binaries (operator, gateway, CLI)
build: build-operator build-gateway build-cli
## build-operator: Build operator binary
build-operator:
mkdir -p $(BINARY_DIR)
$(GOBUILD) -o $(OPERATOR_BINARY) ./cmd/operator/
## build-gateway: Build gateway binary
build-gateway:
mkdir -p $(BINARY_DIR)
$(GOBUILD) -o $(GATEWAY_BINARY) ./cmd/gateway/
## build-cli: Build CLI binary
build-cli:
mkdir -p $(BINARY_DIR)
$(GOBUILD) -o $(CLI_BINARY) ./cmd/cli/
## test: Run all tests
test: test-unit test-integration test-e2e
## test-unit: Run unit tests
test-unit:
$(GOTEST) -v ./tests/unit/...
## test-integration: Run integration tests
test-integration:
$(GOTEST) -v ./tests/integration/...
## test-e2e: Run E2E tests
test-e2e:
$(GOTEST) -v ./tests/e2e/...
## test-coverage: Run tests with coverage
test-coverage:
$(GOTEST) -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out
## manifests: Generate CRD manifests
manifests:
$(CONTROLLER_GEN) crd paths="./pkg/apis/..." output:crd:artifacts:config=config/crd
## generate: Generate deepcopy code
generate:
$(CONTROLLER_GEN) object paths="./pkg/apis/..."
## deploy: Deploy operator to Kubernetes cluster
deploy: manifests
kubectl apply -f config/crd/
kubectl apply -f config/rbac/
## clean: Remove build artifacts
clean:
$(GOCLEAN)
rm -rf $(BINARY_DIR)
rm -f coverage.out
## tidy: Tidy Go modules
tidy:
$(GOMOD) tidy
## lint: Run linters
lint:
golangci-lint run
## fmt: Format Go code
fmt:
gofmt -w .
## vet: Run go vet
vet:
$(GOCMD) vet ./...