提交 90d6ab0e 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3473 from ipfs/feat/cover/maybe-better

Switch coverage to codecov from coveralls
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
*.orig *.orig
*~ *~
coverage.txt
.ipfs .ipfs
bin/gx bin/gx
bin/gx* bin/gx*
......
...@@ -3,31 +3,39 @@ IPFS_MIN_GO_VERSION = 1.7 ...@@ -3,31 +3,39 @@ IPFS_MIN_GO_VERSION = 1.7
IPFS_MIN_GX_VERSION = 0.6 IPFS_MIN_GX_VERSION = 0.6
IPFS_MIN_GX_GO_VERSION = 1.1 IPFS_MIN_GX_GO_VERSION = 1.1
GOTAGS =
GOTAGS += "" # we have to have always at least one tag, empty tag works well
GOFLAGS =
GOTFLAGS =
export IPFS_REUSEPORT=false export IPFS_REUSEPORT=false
export GOFLAGS
export GOTFLAGS
ifneq ($(COVERALLS_TOKEN), ) GOFLAGS += -tags $(call join-with,$(comma),$(GOTAGS))
covertools_rule = covertools
GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOTFLAGS)
else
covertools_rule = $()
GOT = go test $(GOTFLAGS) ./...
endif
ifeq ($(TEST_NO_FUSE),1) ifeq ($(TEST_NO_FUSE),1)
GOTFLAGS += -tags nofuse GOTAGS += nofuse
endif endif
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
GOPATH_DELIMITER = ; GOPATH_DELIMITER = ;
else else
GOPATH_DELIMITER = : GOPATH_DELIMITER = :
endif endif
dist_root=/ipfs/QmNZL8wNsvAGdVYr8uGeUE9aGfHjFpHegAWywQFEdSaJbp dist_root=/ipfs/QmNZL8wNsvAGdVYr8uGeUE9aGfHjFpHegAWywQFEdSaJbp
gx_bin=bin/gx-v0.9.0 gx_bin=bin/gx-v0.9.0
gx-go_bin=bin/gx-go-v1.3.0 gx-go_bin=bin/gx-go-v1.3.0
# util functions
space =
space +=
comma =,
join-with = $(subst $(space),$1,$(strip $2))
# use things in our bin before any other system binaries # use things in our bin before any other system binaries
export PATH := bin:$(PATH) export PATH := bin:$(PATH)
export IPFS_API ?= v04x.ipfs.io export IPFS_API ?= v04x.ipfs.io
...@@ -58,12 +66,11 @@ path_check: ...@@ -58,12 +66,11 @@ path_check:
@bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(GOPATH_DELIMITER), ,$(GOPATH)))) @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 $(covertools_rule) deps: go_check gx_check path_check $(covertools_rule)
${gx_bin} --verbose install --global ${gx_bin} --verbose install --global >/dev/null 2>&1
covertools: deps_covertools:
go get -u github.com/mattn/goveralls go get -u github.com/wadey/gocovmerge
go get -u golang.org/x/tools/cmd/cover go get -u golang.org/x/tools/cmd/cover
go get -u github.com/Kubuxu/overalls
# saves/vendors third-party dependencies to Godeps/_workspace # saves/vendors third-party dependencies to Godeps/_workspace
# -r flag rewrites import paths to use the vendored path # -r flag rewrites import paths to use the vendored path
...@@ -71,7 +78,11 @@ covertools: ...@@ -71,7 +78,11 @@ covertools:
vendor: godep vendor: godep
godep save -r ./... godep save -r ./...
install build nofuse: deps nofuse: GOTAGS += nofuse
nofuse: deps
$(MAKE) -C cmd/ipfs install
install build: deps
$(MAKE) -C cmd/ipfs $@ $(MAKE) -C cmd/ipfs $@
clean: clean:
...@@ -99,14 +110,19 @@ test_3node: ...@@ -99,14 +110,19 @@ test_3node:
test_go_fmt: test_go_fmt:
bin/test-go-fmt bin/test-go-fmt
test_go_short: GOTFLAGS += -test.short test_go_short: GOTFLAGS += -test.short
test_go_race: GOTFLAGS += -race test_go_race: GOTFLAGS += -race
test_go_expensive test_go_short test_go_race: test_go_expensive test_go_short test_go_race:
$(GOT) go test $(GOFLAGS) $(GOTFLAGS) ./...
ifneq ($(COVERALLS_TOKEN), )
goveralls -coverprofile=overalls.coverprofile -service $(SERVICE) coverage: deps_covertools
endif @echo Running coverage
$(eval PKGS := $(shell go list -f '{{if (len .GoFiles)}}{{.ImportPath}}{{end}}' ./... | grep -v /vendor/ | grep -v /Godeps/))
#$(eval PKGS_DELIM := $(call join-with,$(comma),$(PKGS)))
@go list -f '{{if or (len .TestGoFiles) (len .XTestGoFiles)}}go test $(GOFLAGS) $(GOTFLAGS) -covermode=atomic -coverprofile={{.Name}}_{{len .Imports}}_{{len .Deps}}.coverprofile {{.ImportPath}}{{end}}' $(GOFLAGS) $(PKGS) | xargs -I {} bash -c {} 2>&1 | grep -v 'warning: no packages being tested depend on'
gocovmerge `ls *.coverprofile` > coverage.txt
rm *.coverprofile
bash -c 'bash <(curl -s https://codecov.io/bash)'
test_sharness_short: test_sharness_short:
$(MAKE) -j1 -C test/sharness/ $(MAKE) -j1 -C test/sharness/
......
...@@ -26,7 +26,7 @@ dependencies: ...@@ -26,7 +26,7 @@ dependencies:
override: override:
- rm -rf "$HOME/.go_workspace/src/$IMPORT_PATH" - rm -rf "$HOME/.go_workspace/src/$IMPORT_PATH"
- mkdir -p "$HOME/.go_workspace/src/$IMPORT_PATH" - mkdir -p "$HOME/.go_workspace/src/$IMPORT_PATH"
- cp -a ./* "$HOME/.go_workspace/src/$IMPORT_PATH" - cp -aT . "$HOME/.go_workspace/src/$IMPORT_PATH"
- cd "$HOME/.go_workspace/src/$IMPORT_PATH" && make deps - cd "$HOME/.go_workspace/src/$IMPORT_PATH" && make deps
cache_directories: cache_directories:
...@@ -35,9 +35,6 @@ dependencies: ...@@ -35,9 +35,6 @@ dependencies:
test: test:
override: override:
- make test_go_expensive: - case $CIRCLE_NODE_INDEX in 0) make coverage ;; 1) make test_sharness_expensive ;; esac:
pwd: "../.go_workspace/src/$IMPORT_PATH"
parallel: true
- make test_sharness_expensive:
pwd: "../.go_workspace/src/$IMPORT_PATH" pwd: "../.go_workspace/src/$IMPORT_PATH"
parallel: true parallel: true
COMMIT := $(shell git rev-parse --short HEAD) COMMIT := $(shell git rev-parse --short HEAD)
ldflags = "-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)" GOFLAGS += -ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"
all: install all: install
install: install:
go install -ldflags=$(ldflags) go install $(GOFLAGS)
build: build:
go build -i -ldflags=$(ldflags) go build -i $(GOFLAGS)
nofuse:
go install -tags nofuse -ldflags=$(ldflags)
clean: clean:
go clean -ldflags=$(ldflags) go clean $(GOFLAGS)
uninstall: uninstall:
go clean -i -ldflags=$(ldflags) go clean -i $(GOFLAGS)
codecov:
ci:
- "ci/circle-ci"
- "!js-ipfs-ap"
- "!teamcity"
- "!continuous-integration/travis-ci/pr"
- "!continuous-integration/travis-ci/push"
notify:
after_n_builds: 1
coverage:
range: "50...100"
comment: off
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论