forked from TheThingsArchive/go-account-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
40 lines (30 loc) · 960 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
SHELL = bash
go = go
pkgs = $(go) list ./... | grep -vE go-account-lib/vendor
cover_file=coverage.out
tmp_cover_dir ?= .cover
.PHONY: test tools cover watch
tools:
@echo fething dev deps...
$(go) get -u golang.org/x/tools/cmd/cover
$(go) get -u github.com/mattn/goveralls
$(go) get -u github.com/golang/lint/golint
$(go) get -u github.com/onsi/ginkgo/ginkgo
test:
@for pkg in $$($(pkgs)); do \
profile=$$([ "$$COVER" = "1" ] && echo "-coverprofile=$(tmp_cover_dir)/$$(echo $$pkg | tr -d '/').cover"); \
$(go) test -cover $$profile $$pkg; \
done
cover:
@mkdir -p $(tmp_cover_dir)
@touch $(tmp_cover_dir)/empty.cover
@export COVER=1; make test
@echo "mode: set" > $(cover_file)
@cat $(tmp_cover_dir)/*.cover | grep -v mode | sort -r >> $(cover_file)
@rm -rf $(tmp_cover_dir)
vet:
$(pkgs) | xargs $(go) vet
lint:
$(pkgs) | xargs golint
watch:
@ginkgo watch -coverprofile=/dev/null $$($(pkgs) | sed "s/.*$$(basename $$PWD)\//.\//")