diff --git a/.travis.yml b/.travis.yml index dde731ce..fe587867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,7 +70,7 @@ install: - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pwd`" script: - - EMBEDROCKSDB=0 make cover_ci + - EMBEDROCKSDB=0 make -j4 cover_ci after_success: - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) diff --git a/Makefile b/Makefile index 086c32e3..f23edcbe 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: bins clean setup test test-race cover cover_ci cover_profile +.PHONY: bins clean setup test test-race cover cover_ci cover_profile cover_prepare cover_integration cover_unit SHELL = /bin/bash @@ -100,16 +100,11 @@ cherami-store-tool: $(DEPS) bins: cherami-server cherami-replicator-server cherami-cli cherami-admin cherami-replicator-tool cherami-cassandra-tool cherami-store-tool -cover_profile: lint bins - @echo Running tests: +cover_prepare: @mkdir -p $(BUILD) @echo "mode: atomic" > $(BUILD)/cover.out - @for dir in $(PKG_TEST_DIRS); do \ - mkdir -p $(BUILD)/"$$dir"; \ - go test $(EMBED) "$$dir" $(TEST_ARG) -coverprofile=$(BUILD)/"$$dir"/coverage.out || exit 1; \ - cat $(BUILD)/"$$dir"/coverage.out | grep -v "mode: atomic" >> $(BUILD)/cover.out; \ - done - + +cover_integration: $(DEPS) @echo Running integration tests: @for dir in $(INTEG_TEST_DIRS); do \ mkdir -p $(BUILD)/"$$dir"; \ @@ -117,10 +112,20 @@ cover_profile: lint bins cat $(BUILD)/"$$dir"/coverage.out | grep -v "mode: atomic" >> $(BUILD)/cover.out; \ done +cover_unit: $(DEPS) + @echo Running tests: + @for dir in $(PKG_TEST_DIRS); do \ + mkdir -p $(BUILD)/"$$dir"; \ + go test $(EMBED) "$$dir" $(TEST_ARG) -coverprofile=$(BUILD)/"$$dir"/coverage.out || exit 1; \ + cat $(BUILD)/"$$dir"/coverage.out | grep -v "mode: atomic" >> $(BUILD)/cover.out; \ + done + +cover_profile: lint cover_prepare cover_integration cover_unit + cover: cover_profile go tool cover -html=$(BUILD)/cover.out -cover_ci: cover_profile +cover_ci: cover_profile bins goveralls -coverprofile=$(BUILD)/cover.out -service=travis-ci || echo -e "\x1b[31mCoveralls failed\x1b[m" clean: