-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
65 lines (53 loc) · 2.29 KB
/
Makefile
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
addheaders:
@command -v addlicense > /dev/null || (echo "🚀 Installing addlicense..."; go install -modfile=tools.mod -v github.com/google/addlicense)
@addlicense -c "The Serverless Workflow Specification Authors" -l apache .
fmt:
@go vet ./...
@go fmt ./...
goimports:
@command -v goimports > /dev/null || (echo "🚀 Installing goimports..."; go install golang.org/x/tools/cmd/goimports@latest)
@goimports -w .
lint:
@echo "🚀 Running lint..."
@command -v golangci-lint > /dev/null || (echo "🚀 Installing golangci-lint..."; curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin")
@make addheaders
@make goimports
@make fmt
@./hack/go-lint.sh ${params}
@echo "✅ Linting completed!"
.PHONY: test
coverage="false"
test: deepcopy buildergen
@echo "🧪 Running tests..."
@go test ./...
@echo "✅ Tests completed!"
deepcopy: $(DEEPCOPY_GEN) ## Download deepcopy-gen locally if necessary.
@echo "📦 Running deepcopy-gen..."
@./hack/deepcopy-gen.sh deepcopy > /dev/null
@make lint
@echo "✅ Deepcopy generation and linting completed!"
buildergen: $(BUILDER_GEN) ## Download builder-gen locally if necessary.
@echo "📦 Running builder-gen..."
@./hack/builder-gen.sh buildergen > /dev/null
@make lint
@echo "✅ Builder generation and linting completed!"
.PHONY: kube-integration
kube-integration: controller-gen
@echo "📦 Generating Kubernetes objects..."
@$(CONTROLLER_GEN) object:headerFile="./hack/boilerplate.txt" paths="./kubernetes/api/..."
@echo "📦 Generating Kubernetes CRDs..."
@$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./kubernetes/..." output:crd:artifacts:config=config/crd/bases
@make lint
@echo "✅ Kubernetes integration completed!"
####################################
# install controller-gen tool
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
CONTROLLER_TOOLS_VERSION ?= v0.16.3
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)