-
Notifications
You must be signed in to change notification settings - Fork 243
Expand file tree
/
Copy pathMakefile
More file actions
189 lines (155 loc) · 6.42 KB
/
Makefile
File metadata and controls
189 lines (155 loc) · 6.42 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#
# Copyright (c) 2020 Red Hat, Inc.
#
# 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.
#
include .bingo/Variables.mk
.DEFAULT_GOAL := rosa
# Wrapper script entry points used by make convenience targets.
RUN_CHECKS_SCRIPT := ./hack/run-checks.sh
# Ensure go modules are enabled:
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
# Use Go's documented toolchain switching, since some repackaged toolchains default to local-only.
export GOTOOLCHAIN=auto
# Let the selected Go binary provide its own GOROOT to avoid mixed-toolchain builds.
unexport GOROOT
# Use the selected toolchain binary for Bingo-managed tool builds.
GO := $(shell go env GOROOT)/bin/go
# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0
# Unset GOFLAG for CI and ensure we've got nothing accidently set
unexport GOFLAGS
.PHONY: rosa
rosa:
go build -ldflags="-X github.com/openshift/rosa/pkg/info.Build=$(shell git rev-parse --short HEAD)" ./cmd/rosa
.PHONY: test
test:
go test $(GO_TEST_FLAGS) $(shell go list ./... | grep -v /tests/)
.PHONY: coverage
coverage:
go test -coverprofile=cover.out -covermode=atomic -p 1 $(GO_TEST_FLAGS) $(shell go list ./... | grep -v /tests/)
.PHONY: coverage-changed-files
coverage-changed-files:
./hack/coverage-changed-files.sh
.PHONY: install
install:
go install ./cmd/rosa
.PHONY: fmt
fmt: $(GCI)
GCI_BIN="$(GCI)" ./hack/fmt.sh
.PHONY: fmt-staged
fmt-staged: $(GCI)
GCI_BIN="$(GCI)" ./hack/fmt-staged.sh
.PHONY: fmt-check
fmt-check: $(GCI)
@test -z "$$(gofmt -s -l cmd pkg tests)"
@test -z "$$($(GCI) list -s standard -s default -s "prefix(k8s)" -s "prefix(sigs.k8s)" -s "prefix(github.com)" -s "prefix(gitlab)" -s "prefix(github.com/openshift/rosa)" --custom-order --skip-generated --skip-vendor cmd pkg tests)"
.PHONY: lint
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run --timeout 5m0s $(LINT_OUTPUT_FLAGS) ./...
.PHONY: commits/check
commits/check:
@./hack/commit-msg-verify.sh
.PHONY: install-hooks
install-hooks:
@./hack/install-git-hooks.sh
.PHONY: basic-checks
basic-checks:
@$(RUN_CHECKS_SCRIPT) basic
.PHONY: pre-commit-checks
pre-commit-checks:
@$(MAKE) --no-print-directory fmt-staged
.PHONY: pre-push-checks
pre-push-checks:
@$(RUN_CHECKS_SCRIPT) pre-push
.PHONY: run-checks
run-checks:
@$(RUN_CHECKS_SCRIPT) $(filter-out $@,$(MAKECMDGOALS))
PASSTHROUGH_MAKE_TARGETS := run-checks
ifneq (,$(filter $(PASSTHROUGH_MAKE_TARGETS),$(MAKECMDGOALS)))
PASSTHROUGH_ARG_GOALS := $(filter-out $(PASSTHROUGH_MAKE_TARGETS),$(MAKECMDGOALS))
$(foreach goal,$(PASSTHROUGH_ARG_GOALS),$(eval .PHONY: $(goal)))
$(foreach goal,$(PASSTHROUGH_ARG_GOALS),$(eval $(goal):;@:))
endif
.PHONY: diff
diff:
git diff --exit-code
.PHONY: verify
verify: fmt
go mod tidy
go mod vendor
$(MAKE) diff
.PHONY: clean
clean:
rm -rf \
./cover.out \
rosa \
rosa-darwin-amd64 \
rosa-darwin-arm64 \
rosa-linux-amd64 \
rosa-linux-arm64 \
rosa-windows-amd64.exe \
*.sha256 \
$(NULL)
.PHONY: generate
generate: $(GO_BINDATA) mocks
$(GO_BINDATA) -nometadata -nocompress -pkg assets -o ./assets/bindata.go ./templates/...
go generate ./...
.PHONY: codecov
codecov: coverage
@./hack/codecov.sh
mocks: $(MOCKGEN)
$(MOCKGEN) -source=pkg/aws/api_interface/iam_api_client.go -package=mocks -destination=pkg/aws/mocks/iam_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/organizations_api_client.go -package=mocks -destination=pkg/aws/mocks/organizations_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/sts_api_client.go -package=mocks -destination=pkg/aws/mocks/sts_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/cloudformation_api_client.go -package=mocks -destination=pkg/aws/mocks/cloudformation_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/servicequotas_api_client.go -package=mocks -destination=pkg/aws/mocks/servicequotas_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/ec2_api_client.go -package=mocks -destination=pkg/aws/mocks/ec2_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/s3_api_client.go -package=mocks -destination=pkg/aws/mocks/s3_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/api_interface/secretsmanager_api_client.go -package=mocks -destination=pkg/aws/mocks/secretsmanager_api_client_mock.go
$(MOCKGEN) -source=pkg/aws/client.go -package=aws -destination=pkg/aws/client_mock.go
$(MOCKGEN) -source=pkg/version/version.go -package=version -destination=pkg/version/version_mock.go
$(MOCKGEN) -source=pkg/version/retriever.go -package=version -destination=pkg/version/retriever_mock.go
$(MOCKGEN) -source=cmd/verify/rosa/cmd.go -package=rosa -destination=cmd/verify/rosa/cmd_mock.go
$(MOCKGEN) -source=pkg/clients/http.go -package=clients -destination=pkg/clients/http_mock.go
$(MOCKGEN) -source=pkg/cache/service.go -package=cache -destination=pkg/cache/service_mock.go
$(MOCKGEN) -source=pkg/cache/cache.go -package=cache -destination=pkg/cache/cache_mock.go
$(MOCKGEN) -source=pkg/network/network.go -package=network -destination=pkg/network/network_mock.go
$(MOCKGEN) -source=pkg/machinepool/machinepool.go -package=machinepool -destination=pkg/machinepool/machinepool_mock.go
$(MOCKGEN) -source=pkg/kubeletconfig/config.go -package=kubeletconfig -destination=pkg/kubeletconfig/capability_checker_mock.go
$(MOCKGEN) -source=cmd/create/idp/cmd.go -package=mocks -destination=cmd/create/idp/mocks/identityprovider.go
.PHONY: e2e_test
e2e_test: install
ginkgo run \
--label-filter $(LabelFilter)\
--timeout 5h \
-r \
--focus-file tests/e2e/.* \
$(NULL)
.PHONY: generate-docs
generate-docs:
go run ./tools/gendocs
# verifies changes to .goreleaser.yaml
.PHONY: check-release-config
check-release-config:
$(GORELEASER) check
# builds a snap shot release in /dist
.PHONY: local-release
local-release:
$(GORELEASER) release --snapshot --clean
# builds and publishes a latest release from tag set as env-ver GORELEASER_PREVIOUS_TAG
# leave GORELEASER_PREVIOUS_TAG empty to build from last release tag
.PHONY: release
release:
bash ./hack/build_cli.sh