-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (136 loc) · 4.72 KB
/
Copy pathMakefile
File metadata and controls
157 lines (136 loc) · 4.72 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
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright 2025 The Grove Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
REPO_ROOT := $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))")
REPO_HACK_DIR := $(REPO_ROOT)/hack
include $(REPO_HACK_DIR)/tools.mk
.PHONY: tidy
tidy:
@echo "> Tidying scheduler/api"
@make --directory=scheduler/api tidy
@echo "> Tidying operator/api"
@make --directory=operator/api tidy
@echo "> Tidying operator"
@make --directory=operator tidy
# Checks the entire codebase by linting and formatting the code base, and checking for uncommitted changes
.PHONY: check
check: validate
@echo "> Checking for uncommitted changes"
@if [ -n "$$(git status --porcelain)" ]; then \
echo "ERROR: Git tree is dirty after running validation steps."; \
echo "Please check the diff to identify the step that dirtied the tree."; \
git status; \
git diff; \
exit 1; \
fi
@echo "> Check complete"
.PHONY: validate
validate: generate add-license-headers format generate-api-docs lint verify-toc
@echo "> Validation complete"
.PHONY: build
build:
@echo "> Building Grove Operator"
@make --directory=operator build-operator
@echo "> Building Grove Init Container"
@make --directory=operator build-initc
# Lints the entire codebase (all modules) using GOLANGCI_LINT.
.PHONY: lint
lint:
@echo "> Linting operator/api"
@make --directory=operator/api lint
@echo "> Linting operator"
@make --directory=operator lint
@echo "> Linting scheduler/api"
@make --directory=scheduler/api lint
# Formats the entire codebase (all modules)
.PHONY: format
format:
@echo "> Formatting operator"
@make --directory=operator format
@echo "> Formatting scheduler"
@make --directory=scheduler format
# Generates code and CRDs for the entire codebase (all relevant modules)
.PHONY: generate
generate:
@echo "> Generating code for operator api"
@make --directory=operator/api generate
@echo "> Generating code for scheduler api"
@make --directory=scheduler/api generate
# Add license headers to all files
.PHONY: add-license-headers
add-license-headers: $(GO_ADD_LICENSE)
@$(REPO_HACK_DIR)/add-license-headers.sh
# Generates API documentation for Grove Operator and Scheduler APIs
.PHONY: generate-api-docs
generate-api-docs: $(CRD_REF_DOCS)
@$(REPO_HACK_DIR)/generate-api-docs.sh
# Runs unit tests for the entire codebase (all modules)
.PHONY: test-unit
test-unit:
@echo "> Running tests for operator/api"
@cd operator/api && go test ./...
@echo "> Running tests for operator"
@make --directory=operator test-unit
@echo "> Running tests for operator/client"
@cd operator/client && go test ./...
@echo "> Running tests for scheduler/api"
@cd scheduler/api && go test ./...
@echo "> Running tests for scheduler/client"
@cd scheduler/client && go test ./...
@echo "> Running tests for cli-plugin"
@if [ -n "$$(cd cli-plugin && go list ./... 2>/dev/null)" ]; then \
cd cli-plugin && go test ./...; \
else \
echo "> Skipping cli-plugin (no Go packages)"; \
fi
.PHONY: test-cover
test-cover:
@echo "> Running tests with coverage for operator"
@make --directory=operator test-cover
# Generates HTML coverage reports for the entire codebase (all modules)
.PHONY: cover-html
cover-html:
@echo "> Generating HTML coverage report for operator"
@make --directory=operator cover-html
# Runs e2e tests for the operator
.PHONY: run-e2e
run-e2e:
@echo "> Running e2e tests for operator"
@make --directory=operator run-e2e
# Runs the standalone latest-release-to-current operator upgrade test.
.PHONY: run-upgrade-e2e
run-upgrade-e2e:
@echo "> Running operator upgrade e2e test"
@make --directory=operator run-upgrade-e2e
# Runs all tests
.PHONY: test
test: test-unit
@echo "> All tests passed"
.PHONY: install-hooks
install-hooks:
@echo "> Configuring local git hooks from .githooks"
@git config --local core.hooksPath .githooks
@echo "> Git hooks installed"
.PHONY: uninstall-hooks
uninstall-hooks:
@echo "> Removing local git hooks configuration"
@git config --local --unset core.hooksPath || true
@echo "> Git hooks removed"
# Updates the docs/proposals table of contents
.PHONY: update-toc
update-toc: $(MDTOC)
@$(REPO_HACK_DIR)/update-toc.sh
# Verifies that the docs/proposals table of contents is up to date
.PHONY: verify-toc
verify-toc: $(MDTOC)
@$(REPO_HACK_DIR)/verify-toc.sh