This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
89 lines (72 loc) · 2.52 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
SHA=$(shell git rev-parse --short HEAD)
VERSION=$(shell cat VERSION)
DIRTY=false
# TODO add release flag
GO_PACKAGE=$(shell go list)
LDFLAGS=-ldflags "-w -s -X $(GO_PACKAGE)/util.GitSha=${SHA} -X $(GO_PACKAGE)/util.Version=${VERSION} -X $(GO_PACKAGE)/util.Dirty=${DIRTY}"
export GO111MODULE=on
setup: # setup development dependencies
export GO111MODULE=on
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- v0.9.14
.PHONY: setup
install:
go install
.PHONY: install
test:
go test -v -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
test-all:
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -tags=integration
.PHONY: test-all
test-coverage: ## run the test with proper coverage reporting
go test -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -html=coverage.out
.PHONY: test-coverage
test-coverage-integration: ## run the test with proper coverage reporting
go test -coverprofile=coverage.out -covermode=atomic ./... -tags=integration
go tool cover -html=coverage.out
.PHONY: test-coverage-all
# lint: # run the fast go linters
# ./bin/golangci-lint run --no-config \
# --disable-all --enable=deadcode --enable=gocyclo --enable=golint --enable=varcheck \
# --enable=structcheck --enable=errcheck --enable=dupl --enable=unparam --enable=goimports \
# --enable=interfacer --enable=unconvert --enable=gosec --enable=megacheck --deadline=5m
# .PHONY: lint
lint: ## run the fast go linters on the diff from master
./bin/reviewdog -conf .reviewdog.yml -diff "git diff master"
.PHONY: lint
lint-ci: ## run the fast go linters
./bin/reviewdog -conf .reviewdog.yml -reporter=github-pr-review
.PHONY: lint-ci
lint-all: ## run the fast go linters
# doesn't seem to be a way to get reviewdog to not filter by diff
golangci-lint run
.PHONY: lint-all
deps:
go get -u ./...
go mod tidy
.PHONY: deps
release: ## run a release
bff bump
git push
goreleaser release --rm-dist
.PHONY: release
build: ## build the binary
go build .
.PHONY: build
release-prerelease: setup build ## release to github as a 'pre-release'
go build ${LDFLAGS} .
version=`./rotator version`; \
git tag v"$$version"; \
git push
git push --tags
goreleaser release -f .goreleaser.prerelease.yml --debug
.PHONY: release-prerelease
check-mod:
go mod tidy
git diff --exit-code -- go.mod go.sum
.PHONY: check-mod
fmt:
goimports -w -d $$(find . -type f -name '*.go' -not -path "./vendor/*")
.PHONY: fmt