-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
86 lines (65 loc) · 1.9 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
.PHONY: all clean clean-coverage generate install install-dependencies install-tools lint test test-verbose test-verbose-with-coverage
export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
export PKG := github.com/avito-tech/go-mutesting
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export TEST_TIMEOUT_IN_SECONDS := 240
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
export ARGS
ifdef ARGS
PKG_TEST := $(ARGS)
else
PKG_TEST := $(PKG)/...
endif
all: install-dependencies install-tools install lint test
.PHONY: all
clean:
go clean -i $(PKG)/...
go clean -i -race $(PKG)/...
.PHONY: clean
clean-coverage:
find $(ROOT_DIR) | grep .coverprofile | xargs rm
.PHONY: clean-coverage
generate: clean
go generate $(PKG)/...
.PHONY: generate
install:
go install -v $(PKG)/...
.PHONY: install
install-dependencies:
go get -t -v $(PKG)/...
go test -i -v $(PKG)/...
.PHONY: install-dependencies
install-tools:
# generation
go get -u -v golang.org/x/tools/cmd/stringer
# linting
go get -u -v golang.org/x/lint/golint/...
go get -u -v github.com/kisielk/errcheck/...
# code coverage
go get -u -v github.com/onsi/ginkgo/ginkgo/...
go get -u -v github.com/modocache/gover/...
go get -u -v github.com/mattn/goveralls/...
.PHONY: install-tools
lint: ci-errcheck ci-gofmt ci-govet ci-lint
.PHONY: lint
test:
go test -race -test.timeout "$(TEST_TIMEOUT_IN_SECONDS)s" $(PKG_TEST)
.PHONY: test
test-verbose:
go test -race -test.timeout "$(TEST_TIMEOUT_IN_SECONDS)s" -v $(PKG_TEST)
.PHONY: test-verbose
test-verbose-with-coverage:
ginkgo -r -v -cover -race -skipPackage="testdata"
.PHONY: test-verbose-with-coverage
ci-errcheck:
$(ROOT_DIR)/scripts/ci/errcheck.sh
.PHONY: ci-errcheck
ci-gofmt:
$(ROOT_DIR)/scripts/ci/gofmt.sh
.PHONY: ci-gofmt
ci-govet:
$(ROOT_DIR)/scripts/ci/govet.sh
.PHONY: ci-govet
ci-lint:
$(ROOT_DIR)/scripts/ci/lint.sh
.PHONY: ci-lint