-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
72 lines (61 loc) · 1.56 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
65
66
67
68
69
70
71
72
ifeq ($(OS),Windows_NT)
TARGET = $(PROJECT).exe
SHELL = cmd.exe
CHECK = where.exe
else
TARGET = $(PROJECT)
SHELL ?= bash
CHECK ?= which
endif
.PHONY: fetch-schemas
fetch-schemas:
@go run fetch-schemas.go
.PHONY: build
build:
go build ./...
.PHONY: test
test:
go test ./...
.PHONY: lint
lint:
golangci-lint run --config ./golangci.yml
.PHONY: create-test-cluster
create-test-cluster:
./e2e-kind.sh create_kind_cluster
.PHONY: delete-test-cluster
delete-test-cluster:
./e2e-kind.sh delete_kind_cluster
GOPATH := $(shell go env GOPATH)
HAS_GOLANGCI := $(shell $(CHECK) golangci-lint)
GOLANGCI_VERSION := v1.51.2
HAS_KIND := $(shell $(CHECK) kind)
HAS_KUBECTL := $(shell $(CHECK) kubectl)
HAS_GOCOV_XML := $(shell $(CHECK) gocov-xml;)
HAS_GOCOV := $(shell $(CHECK) gocov;)
HAS_GO_JUNIT_REPORT := $(shell $(CHECK) go-junit-report;)
.PHONY: bootstrap
bootstrap:
ifndef HAS_GOLANGCI
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION)
endif
ifndef HAS_KIND
go install sigs.k8s.io/[email protected]
endif
ifndef HAS_KUBECTL
echo "Follow instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/ to install kubectl."
endif
ifndef HAS_GOCOV_XML
go install github.com/AlekSi/[email protected]
endif
ifndef HAS_GOCOV
go install github.com/axw/gocov/[email protected]
endif
ifndef HAS_GO_JUNIT_REPORT
go install github.com/jstemmer/[email protected]
endif
.PHONY: coverage
coverage: compile-integration-tests
./e2e-kind.sh main
.PHONY: compile-integration-tests
compile-integration-tests:
@go test -tags=integration -run nothing ./...