-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
42 lines (33 loc) · 932 Bytes
/
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
VERSION := $(shell git describe --tags --always --dirty="-dev")
# LDFLAGS := -ldflags='-X "main.version=$(VERSION)"'
Q=@
GOTESTFLAGS = -race
ifndef Q
GOTESTFLAGS += -v
endif
.PHONY: deps
deps:
$Qgo mod download
.PHONY: clean
clean:
$Qrm -rf vendor/ && git checkout ./vendor && dep ensure
.PHONY: vet
vet:
$Qgo vet ./...
.PHONY: fmtcheck
fmtchk:
$Qexit $(shell goimports -l . | grep -v '^vendor' | wc -l)
.PHONY: fmtfix
fmtfix:
$Qgoimports -w $(shell find . -iname '*.go' | grep -v vendor)
.PHONY: test
test:
$Qgo test $(GOTESTFLAGS) -coverpkg="./..." -coverprofile=.coverprofile ./...
$Qgrep -vE 'types_gen|cmd/example' < .coverprofile > .covertmp && mv .covertmp .coverprofile
$Qgo tool cover -func=.coverprofile
.PHONY: docker
docker:
$Qdocker build -t jeff-ci:$(VERSION) .
.PHONY: test-ci
test-ci:
$Qdocker run -v $(shell pwd):/go/src/github.com/abraithwaite/jeff -it jeff-ci:$(VERSION) make deps && make test