-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (46 loc) · 1.68 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
SHELL := /bin/bash
TMPDIR := $(if $(TMPDIR),$(TMPDIR),"/tmp/")
GOPATH := $(shell go env GOPATH)
tulpa_bin := $(GOPATH)/bin/tulpa
gofiles := $(wildcard *.go **/*.go **/**/*.go **/**/**/*.go)
gocoverutil := $(GOPATH)/bin/gocoverutil
staticcheck := $(GOPATH)/bin/staticcheck
golangcilint := $(GOPATH)/bin/golangci-lint
gomodoutdated := $(GOPATH)/bin/go-mod-outdated
all: build
build: $(tulpa_bin)
$(tulpa_bin): $(gofiles)
GO111MODULE=on go install ./...
.PHONY: clean
clean:
git clean -x -f
.PHONY: test
test:
GO111MODULE=on go test -cover -race ./...
.PHONY: test.lint
test.lint: $(staticcheck) $(golangcilint)
GO111MODULE=on $(staticcheck) -f stylish -checks all ./...
GO111MODULE=on $(golangcilint) run --deadline 2m
.PHONY: test.cover
test.cover: $(gocoverutil)
$(gocoverutil) -coverprofile=cov.out test -covermode=count ./... \
2> >(grep -v "no packages being tested depend on matches for pattern" 1>&2) \
| sed -e 's/of statements in .*/of statements/'
@echo -n "total: "; go tool cover -func=cov.out | tail -n 1 | sed -e 's/\((statements)\|total:\)//g' | tr -s "[:space:]"
.PHONY: test.outdated
test.outdated: $(gomodoutdated)
GO111MODULE=on go list -u -m -json all | go-mod-outdated -direct
.PHONY: release.dryrun
release.dryrun:
goreleaser --snapshot --skip-publish --rm-dist
.PHONY: release
release:
goreleaser --rm-dist
$(gocoverutil):
GO111MODULE=off go get github.com/AlekSi/gocoverutil
$(staticcheck):
cd $(TMPDIR) && GO111MODULE=on go get honnef.co/go/tools/cmd/[email protected]
$(golangcilint):
cd $(TMPDIR) && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected]
$(gomodoutdated):
GO111MODULE=off go get github.com/psampaz/go-mod-outdated