Run coveralls if COVERALLS_TOKEN is set
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Nov 29, 2016 at 22:49 UTC
36708cc04ac4b83119da42a9470ccc6af4a84c6e
3 files changed
+29
-12
.gitignore
+1
@@ -5,6 +5,7 @@
5
*.swp
6
.ipfsconfig
7
*.out
8
+*.coverprofile
9
*.test
10
*.orig
11
*~
Makefile
+26
-12
@@ -3,10 +3,19 @@ IPFS_MIN_GO_VERSION = 1.7
3
IPFS_MIN_GX_VERSION = 0.6
4
IPFS_MIN_GX_GO_VERSION = 1.1
5
6
-ifeq ($(TEST_NO_FUSE),1)
7
- go_test=IPFS_REUSEPORT=false go test -tags nofuse
6
+
7
+export IPFS_REUSEPORT=false
8
+
9
+ifneq ($(COVERALLS_TOKEN), )
10
+ covertools_rule = covertools
11
+ GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test -- $(GOTFLAGS)
12
else
9
- go_test=IPFS_REUSEPORT=false go test
13
+ covertools_rule = $()
14
+ GOT = go test $(GOTFLAGS) ./...
15
+endif
16
+
17
+ifeq ($(TEST_NO_FUSE),1)
18
+ GOTFLAGS += -tags nofuse
19
endif
20
21
ifeq ($(OS),Windows_NT)
@@ -48,9 +57,14 @@ gx_check: ${gx_bin} ${gx-go_bin}
57
path_check:
58
@bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(GOPATH_DELIMITER), ,$(GOPATH))))
59
51
-deps: go_check gx_check path_check
60
+deps: go_check gx_check path_check $(covertools_rule)
61
${gx_bin} --verbose install --global
62
63
+covertools:
64
+ go get -u github.com/mattn/goveralls
65
+ go get -u golang.org/x/tools/cmd/cover
66
+ go get -u github.com/Kubuxu/overalls
67
+
68
# saves/vendors third-party dependencies to Godeps/_workspace
69
# -r flag rewrites import paths to use the vendored path
70
# ./... performs operation on all packages in tree
@@ -67,7 +81,7 @@ clean:
81
uninstall:
82
$(MAKE) -C cmd/ipfs uninstall
83
70
-PHONY += all help godep gx_check
84
+PHONY += all help godep gx_check dl_coveralls
85
PHONY += go_check deps vendor install build nofuse clean uninstall
86
87
##############################################################
@@ -85,14 +99,14 @@ test_3node:
99
test_go_fmt:
100
bin/test-go-fmt
101
88
-test_go_short:
89
- $(go_test) -test.short ./...
102
91
-test_go_expensive:
92
- $(go_test) ./...
93
-
94
-test_go_race:
95
- $(go_test) ./... -race
103
+test_go_short: GOTFLAGS += -test.short
104
+test_go_race: GOTFLAGS += -race
105
+test_go_expensive test_go_short test_go_race:
106
+ $(GOT)
107
+ifneq ($(COVERALLS_TOKEN), )
108
+ goveralls -coverprofile=overalls.coverprofile -service $(SERVICE)
109
+endif
110
111
test_sharness_short:
112
$(MAKE) -j1 -C test/sharness/
circle.yml
+2
@@ -7,6 +7,8 @@ machine:
7
CIRCLE: 1
8
IMPORT_PATH: "github.com/ipfs/go-ipfs"
9
GOPATH: "$HOME/.go_workspace"
10
+ GOBIN: "$GOPATH/bin"
11
+ SERVICE: "circle-ci"
12
13
post:
14
- sudo rm -rf /usr/local/go