Skip to content

Commit

Permalink
Merge pull request #3460 from ipfs/feat/test/coveralls
Browse files Browse the repository at this point in the history
Report coverage to coveralls
  • Loading branch information
whyrusleeping authored Dec 3, 2016
2 parents 433d0b5 + 6696b01 commit 4f38c88
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.swp
.ipfsconfig
*.out
*.coverprofile
*.test
*.orig
*~
Expand Down
38 changes: 26 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ IPFS_MIN_GO_VERSION = 1.7
IPFS_MIN_GX_VERSION = 0.6
IPFS_MIN_GX_GO_VERSION = 1.1

ifeq ($(TEST_NO_FUSE),1)
go_test=IPFS_REUSEPORT=false go test -tags nofuse

export IPFS_REUSEPORT=false

ifneq ($(COVERALLS_TOKEN), )
covertools_rule = covertools
GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test -- $(GOTFLAGS)
else
go_test=IPFS_REUSEPORT=false go test
covertools_rule = $()
GOT = go test $(GOTFLAGS) ./...
endif

ifeq ($(TEST_NO_FUSE),1)
GOTFLAGS += -tags nofuse
endif

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

deps: go_check gx_check path_check
deps: go_check gx_check path_check $(covertools_rule)
${gx_bin} --verbose install --global

covertools:
go get -u github.com/mattn/goveralls
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/Kubuxu/overalls

# saves/vendors third-party dependencies to Godeps/_workspace
# -r flag rewrites import paths to use the vendored path
# ./... performs operation on all packages in tree
Expand All @@ -67,7 +81,7 @@ clean:
uninstall:
$(MAKE) -C cmd/ipfs uninstall

PHONY += all help godep gx_check
PHONY += all help godep gx_check covertools
PHONY += go_check deps vendor install build nofuse clean uninstall

##############################################################
Expand All @@ -85,14 +99,14 @@ test_3node:
test_go_fmt:
bin/test-go-fmt

test_go_short:
$(go_test) -test.short ./...

test_go_expensive:
$(go_test) ./...

test_go_race:
$(go_test) ./... -race
test_go_short: GOTFLAGS += -test.short
test_go_race: GOTFLAGS += -race
test_go_expensive test_go_short test_go_race:
$(GOT)
ifneq ($(COVERALLS_TOKEN), )
goveralls -coverprofile=overalls.coverprofile -service $(SERVICE)
endif

test_sharness_short:
$(MAKE) -j1 -C test/sharness/
Expand Down
4 changes: 4 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ machine:
CIRCLE: 1
IMPORT_PATH: "github.com/ipfs/go-ipfs"
GOPATH: "$HOME/.go_workspace"
GOBIN: "$GOPATH/bin"
SERVICE: "circle-ci"

post:
- sudo rm -rf /usr/local/go
Expand Down Expand Up @@ -35,5 +37,7 @@ test:
override:
- make test_go_expensive:
pwd: "../.go_workspace/src/$IMPORT_PATH"
parallel: true
- make test_sharness_expensive:
pwd: "../.go_workspace/src/$IMPORT_PATH"
parallel: true

0 comments on commit 4f38c88

Please sign in to comment.