forked from zimmski/go-mutesting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (56 loc) · 1.66 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
.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/zimmski/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 mod vendor
go test -i -v $(PKG)/...
.PHONY: install-dependencies
install-tools:
# generation
go get golang.org/x/tools/cmd/stringer
# linting
go get golang.org/x/lint/golint/...
go get github.com/kisielk/errcheck/...
go get honnef.co/go/tools/...
# code coverage
go get golang.org/x/tools/cmd/cover
go get github.com/onsi/ginkgo/ginkgo/...
go get github.com/modocache/gover/...
go get github.com/mattn/goveralls/...
.PHONY: install-tools
lint:
$(ROOT_DIR)/scripts/lint.sh
.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