-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
45 lines (37 loc) · 1.24 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
precommit: fmt license test
test:
@go test -race $$(go list ./... | grep -v vendor)
fmt:
@go fmt $$(go list ./... | grep -v vendor)
license:
@go run $(GOPATH)/src/github.com/limetext/tasks/gen_license.go
fast_test:
@go test $$(go list ./... | grep -v vendor)
check_fmt:
ifneq ($(shell gofmt -l ./ | grep -v vendor | grep -v testdata),)
$(error code not fmted, run make fmt. $(shell gofmt -l ./ | grep -v vendor | grep -v testdata))
endif
check_license:
@go run $(GOPATH)/src/github.com/limetext/tasks/gen_license.go -check
cover_dep:
go get -v -u github.com/mattn/goveralls
go get -v -u github.com/axw/gocov/gocov
travis:
ifeq ($(TRAVIS_OS_NAME),osx)
brew update
brew install oniguruma
endif
travis_test: export PKG_CONFIG_PATH += $(PWD)/vendor/github.com/limetext/rubex:$(GOPATH)/src/github.com/limetext/rubex
travis_test: test cover report_cover
cover:
@echo "mode: count" > coverage.cov; \
for pkg in $$(go list "./..." | grep -v /vendor/); do \
go test -covermode=count -coverprofile=tmp.cov $$pkg; \
sed 1d tmp.cov >> coverage.cov; \
rm tmp.cov; \
done
report_cover:
ifeq ($(REPORT_COVERAGE),true)
$$(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=coverage.cov -service=travis-ci
endif
rm coverage.cov