forked from openshift/backplane-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (47 loc) · 1.34 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
BUILDFLAGS ?=
unexport GOFLAGS
BASE_DIR=$(shell pwd)
BIN_DIR=${BASE_DIR}/bin
.DEFAULT_GOAL := all
.PHONY: all
all: vet fmt mod lint test build
.PHONY: fmt
fmt:
@echo "gofmt"
@gofmt -w -s .
OS := $(shell go env GOOS | sed 's/[a-z]/\U&/')
ARCH := $(shell go env GOARCH)
GORELEASER_VERSION="v1.15.0"
GOLANGCI_LINT_VERSION="v1.55.0"
.PHONY: download-goreleaser
download-goreleaser:
GOBIN=${BIN_DIR} go install github.com/goreleaser/goreleaser@${GORELEASER_VERSION}
.PHONY: download-golangci-lint
download-golangci-lint:
GOBIN=${BIN_DIR} go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
SINGLE_TARGET ?= false
# Need to use --snapshot here because the goReleaser
# requires more git info that is provided in Prow's clone.
# Snapshot allows the build without validation of the
# repository itself
.PHONY: build
build: download-goreleaser
${BIN_DIR}/goreleaser build --clean --snapshot --id linux_arm64,linux_amd64,darwin_arm64,darwin_amd64 --single-target=${SINGLE_TARGET}
.PHONY: release
release:
${BIN_DIR}/goreleaser release --clean
.PHONY: vet
vet:
go vet ${BUILDFLAGS} ./...
.PHONY: mod
mod:
go mod tidy
.PHONY: test
test:
go test ${BUILDFLAGS} ./...
.PHONY: lint
lint: download-golangci-lint
GOLANGCI_LINT_CACHE=$(shell mktemp -d) ${BIN_DIR}/golangci-lint run
.PHONY: coverage
coverage:
hack/codecov.sh