diff --git a/.circleci/config.yml b/.circleci/config.yml index 95f879392..122827afd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,6 +67,38 @@ jobs: command: | export PATH="$GOBIN:$PATH" gometalinter --disable-all --enable='golint' --vendor ./... + + test_unit: + <<: *defaults + parallelism: 4 + steps: + - attach_workspace: + at: /tmp/workspace + - restore_cache: + key: v1-pkg-cache + - restore_cache: + key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} + - run: + name: Test unit + command: | + export PATH="$GOBIN:$PATH" + make test_unit + + test_cli: + <<: *defaults + parallelism: 1 + steps: + - attach_workspace: + at: /tmp/workspace + - restore_cache: + key: v1-pkg-cache + - restore_cache: + key: v1-tree-{{ .Environment.CIRCLE_SHA1 }} + - run: + name: Test cli + command: | + export PATH="$GOBIN:$PATH" + make test_cli test_cover: <<: *defaults @@ -121,6 +153,12 @@ workflows: - lint: requires: - setup_dependencies + - test_unit: + requires: + - setup_dependencies + - test_cli: + requires: + - setup_dependencies - test_cover: requires: - setup_dependencies diff --git a/Makefile b/Makefile index d6d1fa289..abcdc5756 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ PACKAGES=$(shell go list ./... | grep -v '/vendor/') +PACKAGES_NOCLITEST=$(shell go list ./... | grep -v '/vendor/' | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test) COMMIT_HASH := $(shell git rev-parse --short HEAD) BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}" -all: check_tools get_vendor_deps build build_examples install install_examples test_nocli +all: check_tools get_vendor_deps install install_examples test_lint test ######################################## ### CI -ci: get_tools get_vendor_deps install test_cover +ci: get_tools get_vendor_deps install test_cover test_lint test ######################################## ### Build @@ -83,18 +84,13 @@ godocs: ######################################## ### Testing -test: test_unit # test_cli +test: test_unit test_cli -test_nocli: - go test `go list ./... | grep -v github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test` - -# Must be run in each package seperately for the visualization -# Added here for easy reference -# coverage: -# go test -coverprofile=c.out && go tool cover -html=c.out +test_cli: + @go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test` test_unit: - @go test $(PACKAGES) + @go test $(PACKAGES_NOCLITEST) test_cover: @bash tests/test_cover.sh @@ -103,7 +99,7 @@ test_lint: gometalinter --disable-all --enable='golint' --vendor ./... benchmark: - @go test -bench=. $(PACKAGES) + @go test -bench=. $(PACKAGES_NOCLITEST) ######################################## @@ -133,4 +129,4 @@ devdoc_update: # To avoid unintended conflicts with file names, always add to .PHONY # unless there is a reason not to. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html -.PHONY: build build_examples install install_examples dist check_tools get_tools get_vendor_deps draw_deps test test_nocli test_unit test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update +.PHONY: build build_examples install install_examples dist check_tools get_tools get_vendor_deps draw_deps test test_cli test_unit test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update