1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-17 15:06:47 +08:00

ci: Coverage and Junit xmls in one run

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera
2018-10-27 18:27:18 +02:00
parent d756d64071
commit 23ddc26025
9 changed files with 163 additions and 19 deletions

View File

@ -11,6 +11,7 @@ endif
# unit tests coverage
UTESTS_$(d) := $(shell go list -f '{{if (len .TestGoFiles)}}{{.ImportPath}}{{end}}' $(go-flags-with-tags) ./...)
UTESTS_$(d) += $(shell go list -f '{{if (len .XTestGoFiles)}}{{.ImportPath}}{{end}}' $(go-flags-with-tags) ./... | grep -v go-ipfs/vendor | grep -v go-ipfs/Godeps)
UCOVER_$(d) := $(addsuffix .coverprofile,$(addprefix $(d)/unitcover/, $(subst /,_,$(UTESTS_$(d)))))
@ -18,7 +19,7 @@ $(UCOVER_$(d)): $(d)/coverage_deps ALWAYS
$(eval TMP_PKG := $(subst _,/,$(basename $(@F))))
$(eval TMP_DEPS := $(shell go list -f '{{range .Deps}}{{.}} {{end}}' $(go-flags-with-tags) $(TMP_PKG) | sed 's/ /\n/g' | grep ipfs/go-ipfs) $(TMP_PKG))
$(eval TMP_DEPS_LIST := $(call join-with,$(comma),$(TMP_DEPS)))
go test $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverpkg=$(TMP_DEPS_LIST) -coverprofile=$@ $(TMP_PKG)
go test $(go-flags-with-tags) $(GOTFLAGS) -v -covermode=atomic -json -coverpkg=$(TMP_DEPS_LIST) -coverprofile=$@ $(TMP_PKG) | tee -a test/unit/gotest.json
$(d)/unit_tests.coverprofile: $(UCOVER_$(d))
@ -26,6 +27,7 @@ $(d)/unit_tests.coverprofile: $(UCOVER_$(d))
TGTS_$(d) := $(d)/unit_tests.coverprofile
.PHONY: $(d)/unit_tests.coverprofile
# sharness tests coverage
$(d)/ipfs: GOTAGS += testrunmain