-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
46 lines (38 loc) · 1.23 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
TEST_PACKAGES := $(shell go list ./...)
COVER_PACKAGES := $(shell go list ./... | paste -sd "," -)
INVALID_FUNC_TESTS := $(shell ls ./functional_tests | grep -cv _test.go)
install_gometalinter:
@go get -v github.com/alecthomas/gometalinter
@gometalinter --install
update_gometalinter:
@go get -v -u github.com/alecthomas/gometalinter
@gometalinter --install --update
## lint: Validate golang code
lint: install_gometalinter
@gometalinter \
--deadline=120s \
--line-length=120 \
--enable-all \
--vendor ./...
## Perform all tests
test: test/unit
## Perform unit tests
test/unit: test/check
@go test -v -coverpkg $(COVER_PACKAGES) -cover $(TEST_PACKAGES)
test/coverage: test/check
@for d in ${TEST_PACKAGES}; do \
go test -v -coverpkg $(COVER_PACKAGES) -coverprofile=profile.out -covermode=atomic $$d; \
if [ -f profile.out ]; then \
cat profile.out >> coverage.out; \
rm profile.out; \
fi; \
done
test/coverage/publish:
@go get golang.org/x/tools/cmd/cover
@go get github.com/mattn/goveralls
@goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $$COVERALLS_TOKEN
test/check:
@if [ "${INVALID_FUNC_TESTS}" -ge 1 ]; then \
echo "Folder 'functional_tests' must contain only *_test.go files"; \
exit 1; \
fi