-
Notifications
You must be signed in to change notification settings - Fork 150
/
Makefile
41 lines (34 loc) · 1.98 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
SHELL := /bin/bash # Use bash syntax
GOPATH ?= "$(HOME)/go"
GO111MODULE=on
K8S_APIMACHINERY_VERSION = $(shell go list -m -f '{{ .Version }}' k8s.io/apimachinery)
K8S_APIMACHINERY_DIR = "$(GOPATH)/pkg/mod/k8s.io/apimachinery@$(K8S_APIMACHINERY_VERSION)"
CONTROLLER_RUNTIME_VERSION = $(shell go list -m -f '{{ .Version }}' sigs.k8s.io/controller-runtime)
CONTROLLER_RUNTIME_DIR = "$(GOPATH)/pkg/mod/sigs.k8s.io/controller-runtime@$(CONTROLLER_RUNTIME_VERSION)"
.PHONY: all test clean-mocks mocks
all: test
test: | mocks ## Run code tests
go test ${GO_TAGS} ./...
clean-mocks: ## Remove mocks directory
rm -rf mocks
install-mockery:
@scripts/install-mockery.sh
mocks: install-mockery ## Build mocks
@echo -n "building mocks for pkg/types ... "
@bin/mockery --quiet --all --tags=codegen --case=underscore --output=mocks/pkg/types --dir=pkg/types
@echo "ok."
@echo -n "building mocks for k8s.io/apimachinery/pkg/apis/meta/v1 ... "
@bin/mockery --quiet --name=Object --case=underscore --output=mocks/apimachinery/pkg/apis/meta/v1 --dir="$(K8S_APIMACHINERY_DIR)/pkg/apis/meta/v1"
@echo "ok."
@echo -n "building mocks for k8s.io/apimachinery/runtime ... "
@bin/mockery --quiet --name="(Object|UnstructuredConverter)" --case=underscore --output=mocks/apimachinery/pkg/runtime --dir="$(K8S_APIMACHINERY_DIR)/pkg/runtime"
@echo "ok."
@echo -n "building mocks for k8s.io/apimachinery/runtime/schema ... "
@bin/mockery --quiet --name=ObjectKind --case=underscore --output=mocks/apimachinery/pkg/runtime/schema --dir="$(K8S_APIMACHINERY_DIR)/pkg/runtime/schema"
@echo "ok."
@echo -n "building mocks for sigs.k8s.io/controller-runtime/pkg/client ... "
@bin/mockery --quiet --name="(Object|Client|Status|Reader|SubResourceWriter)" --case=underscore --output=mocks/controller-runtime/pkg/client --dir="$(CONTROLLER_RUNTIME_DIR)/pkg/client"
@echo "ok."
help: ## Show this help.
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v grep | sed -e 's/\\$$//' \
| awk -F'[:#]' '{print $$1 = sprintf("%-30s", $$1), $$4}'