Skip to content

Commit 4a1dce4

Browse files
committed
chore: Add PHONY to Makefile targets
- Update dependency binaries to latest versions
1 parent 2bfa520 commit 4a1dce4

File tree

1 file changed

+61
-44
lines changed

1 file changed

+61
-44
lines changed

Makefile

Lines changed: 61 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
11
# Copyright 2019 The Kubernetes Authors.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
.PHONY: generate license fix vet fmt test lint tidy openapi
5-
64
GOPATH := $(shell go env GOPATH)
75
MYGOBIN := $(shell go env GOPATH)/bin
86
SHELL := /bin/bash
97
export PATH := $(MYGOBIN):$(PATH)
108

9+
.PHONY: all
1110
all: generate license fix vet fmt test lint tidy
1211

12+
"$(MYGOBIN)/stringer":
13+
go install golang.org/x/tools/cmd/[email protected]
14+
15+
"$(MYGOBIN)/addlicense":
16+
go install github.com/google/[email protected]
17+
18+
"$(MYGOBIN)/golangci-lint":
19+
go install github.com/golangci/golangci-lint/cmd/[email protected]
20+
21+
"$(MYGOBIN)/deepcopy-gen":
22+
go install k8s.io/code-generator/cmd/[email protected]
23+
24+
"$(MYGOBIN)/ginkgo":
25+
go install github.com/onsi/ginkgo/[email protected]
26+
27+
"$(MYGOBIN)/mdrip":
28+
go install github.com/monopole/[email protected]
29+
30+
"$(MYGOBIN)/kind":
31+
go install sigs.k8s.io/[email protected]
32+
1333
# The following target intended for reference by a file in
1434
# https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/cli-utils
1535
.PHONY: prow-presubmit-check
@@ -20,9 +40,15 @@ prow-presubmit-check: \
2040
prow-presubmit-check-e2e: \
2141
install-column-apt test-e2e verify-kapply-e2e
2242

43+
.PHONY: prow-presubmit-check-stress
44+
prow-presubmit-check-stress: \
45+
test-stress
46+
47+
.PHONY: fix
2348
fix:
2449
go fix ./...
2550

51+
.PHONY: fmt
2652
fmt:
2753
go fmt ./...
2854

@@ -35,86 +61,77 @@ install-column-apt:
3561
apt-get update
3662
apt-get install -y bsdmainutils
3763

38-
install-stringer:
39-
(which $(GOPATH)/bin/stringer || go install golang.org/x/tools/cmd/[email protected])
40-
41-
install-addlicense:
42-
(which $(GOPATH)/bin/addlicense || go install github.com/google/[email protected])
43-
44-
install-lint:
45-
(which $(GOPATH)/bin/golangci-lint || go install github.com/golangci/golangci-lint/cmd/[email protected])
46-
47-
install-deepcopy-gen:
48-
(which $(GOPATH)/bin/deepcopy-gen || go install k8s.io/code-generator/cmd/[email protected])
49-
50-
generate-deepcopy: install-deepcopy-gen
64+
.PHONY: generate-deepcopy
65+
generate-deepcopy: "$(MYGOBIN)/deepcopy-gen"
5166
hack/run-in-gopath.sh deepcopy-gen --input-dirs ./pkg/apis/... -O zz_generated.deepcopy --go-header-file ./LICENSE_TEMPLATE_GO
5267

53-
generate: install-stringer generate-deepcopy
68+
.PHONY: generate
69+
generate: "$(MYGOBIN)/stringer" generate-deepcopy
5470
go generate ./...
5571

56-
license: install-addlicense
57-
$(GOPATH)/bin/addlicense -v -y 2021 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
72+
.PHONY: license
73+
license: "$(MYGOBIN)/addlicense"
74+
"$(MYGOBIN)/addlicense" -v -y 2021 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
5875

59-
verify-license: install-addlicense
60-
$(GOPATH)/bin/addlicense -check .
76+
.PHONY: verify-license
77+
verify-license: "$(MYGOBIN)/addlicense"
78+
"$(MYGOBIN)/addlicense" -check .
6179

80+
.PHONY: tidy
6281
tidy:
6382
go mod tidy
6483

65-
lint: install-lint
66-
$(GOPATH)/bin/golangci-lint run ./...
84+
.PHONY: lint
85+
lint: "$(MYGOBIN)/golangci-lint"
86+
"$(MYGOBIN)/golangci-lint" run ./...
6787

88+
.PHONY: test
6889
test:
6990
go test -race -cover ./cmd/... ./pkg/...
7091

71-
test-e2e: $(MYGOBIN)/ginkgo $(MYGOBIN)/kind
92+
.PHONY: test-e2e
93+
test-e2e: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
7294
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
73-
$(GOPATH)/bin/ginkgo -v ./test/e2e/... -- -v 3
95+
"$(MYGOBIN)/ginkgo" -v ./test/e2e/... -- -v 3
7496

7597
.PHONY: test-e2e-focus
76-
test-e2e-focus: $(MYGOBIN)/ginkgo $(MYGOBIN)/kind
98+
test-e2e-focus: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
7799
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
78-
$(GOPATH)/bin/ginkgo -v -focus ".*$(FOCUS).*" ./test/e2e/... -- -v 5
100+
"$(MYGOBIN)"/ginkgo -v -focus ".*$(FOCUS).*" ./test/e2e/... -- -v 5
79101

80-
test-stress: $(MYGOBIN)/ginkgo $(MYGOBIN)/kind
102+
.PHONY: test-stress
103+
test-stress: "$(MYGOBIN)/ginkgo" "$(MYGOBIN)/kind"
81104
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
82-
$(GOPATH)/bin/ginkgo -v ./test/stress/... -- -v 3
105+
"$(MYGOBIN)/ginkgo" -v ./test/stress/... -- -v 3
83106

107+
.PHONY: vet
84108
vet:
85109
go vet ./...
86110

111+
.PHONY: build
87112
build:
88113
go build -o bin/kapply sigs.k8s.io/cli-utils/cmd;
89-
mv bin/kapply $(MYGOBIN)
114+
mv bin/kapply "$(MYGOBIN)"
90115

116+
.PHONY: build-with-race-detector
91117
build-with-race-detector:
92118
go build -race -o bin/kapply sigs.k8s.io/cli-utils/cmd;
93-
mv bin/kapply $(MYGOBIN)
119+
mv bin/kapply "$(MYGOBIN)"
94120

95121
.PHONY: verify-kapply-e2e
96122
verify-kapply-e2e: test-examples-e2e-kapply
97123

98-
$(MYGOBIN)/ginkgo:
99-
go install github.com/onsi/ginkgo/[email protected]
100-
101-
$(MYGOBIN)/mdrip:
102-
go install github.com/monopole/[email protected]
103-
104-
.PHONY:
105-
test-examples-e2e-kapply: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
124+
.PHONY: test-examples-e2e-kapply
125+
test-examples-e2e-kapply: "$(MYGOBIN)/mdrip" "$(MYGOBIN)/kind"
106126
( \
107127
set -e; \
108128
/bin/rm -f bin/kapply; \
109-
/bin/rm -f $(MYGOBIN)/kapply; \
129+
/bin/rm -f "$(MYGOBIN)/kapply"; \
110130
echo "Installing kapply from ."; \
111131
make build-with-race-detector; \
112132
./hack/testExamplesE2EAgainstKapply.sh .; \
113133
)
114134

115-
$(MYGOBIN)/kind:
116-
go install sigs.k8s.io/[email protected]
117-
118135
.PHONY: nuke
119-
nuke: clean
120-
sudo rm -rf $(shell go env GOPATH)/pkg/mod/sigs.k8s.io
136+
nuke:
137+
sudo rm -rf "$(GOPATH)/pkg/mod/sigs.k8s.io"

0 commit comments

Comments
 (0)