Skip to content

Commit 4f38c88

Browse files
Merge pull request ipfs#3460 from ipfs/feat/test/coveralls
Report coverage to coveralls
2 parents 433d0b5 + 6696b01 commit 4f38c88

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.swp
66
.ipfsconfig
77
*.out
8+
*.coverprofile
89
*.test
910
*.orig
1011
*~

Makefile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ IPFS_MIN_GO_VERSION = 1.7
33
IPFS_MIN_GX_VERSION = 0.6
44
IPFS_MIN_GX_GO_VERSION = 1.1
55

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)
812
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
1019
endif
1120

1221
ifeq ($(OS),Windows_NT)
@@ -48,9 +57,14 @@ gx_check: ${gx_bin} ${gx-go_bin}
4857
path_check:
4958
@bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(GOPATH_DELIMITER), ,$(GOPATH))))
5059

51-
deps: go_check gx_check path_check
60+
deps: go_check gx_check path_check $(covertools_rule)
5261
${gx_bin} --verbose install --global
5362

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+
5468
# saves/vendors third-party dependencies to Godeps/_workspace
5569
# -r flag rewrites import paths to use the vendored path
5670
# ./... performs operation on all packages in tree
@@ -67,7 +81,7 @@ clean:
6781
uninstall:
6882
$(MAKE) -C cmd/ipfs uninstall
6983

70-
PHONY += all help godep gx_check
84+
PHONY += all help godep gx_check covertools
7185
PHONY += go_check deps vendor install build nofuse clean uninstall
7286

7387
##############################################################
@@ -85,14 +99,14 @@ test_3node:
8599
test_go_fmt:
86100
bin/test-go-fmt
87101

88-
test_go_short:
89-
$(go_test) -test.short ./...
90102

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
96110

97111
test_sharness_short:
98112
$(MAKE) -j1 -C test/sharness/

circle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ machine:
77
CIRCLE: 1
88
IMPORT_PATH: "github.com/ipfs/go-ipfs"
99
GOPATH: "$HOME/.go_workspace"
10+
GOBIN: "$GOPATH/bin"
11+
SERVICE: "circle-ci"
1012

1113
post:
1214
- sudo rm -rf /usr/local/go
@@ -35,5 +37,7 @@ test:
3537
override:
3638
- make test_go_expensive:
3739
pwd: "../.go_workspace/src/$IMPORT_PATH"
40+
parallel: true
3841
- make test_sharness_expensive:
3942
pwd: "../.go_workspace/src/$IMPORT_PATH"
43+
parallel: true

0 commit comments

Comments
 (0)