From 8c6a2d7ec1a3514f6160d5c83e275b57d4c82542 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Wed, 17 Jan 2018 20:00:48 -0500 Subject: [PATCH] codecov: closes #334 --- .codecov.yml | 26 ++++++++++++++++++++++++++ Makefile | 8 ++++++++ circle.yml | 4 +++- test_cover.sh | 14 ++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml create mode 100644 test_cover.sh diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..7321557bc --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,26 @@ + +# +# This codecov.yml is the default configuration for +# all repositories on Codecov. You may adjust the settings +# below in your own codecov.yml in your repository. +# +coverage: + precision: 2 + round: down + range: 70...100 + + status: + # Learn more at https://codecov.io/docs#yaml_default_commit_status + project: + default: + threshold: 1% # allow this much decrease on project + changes: false + +comment: + layout: "header, diff" + behavior: default # update if exists else create new + +ignore: + - "docs" + - "*.md" + - "*.rst" diff --git a/Makefile b/Makefile index 5f68dc500..f39563f4d 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,11 @@ BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=`git r all: check_tools get_vendor_deps build test +######################################## +### CI + +ci: get_tools get_vendor_deps build test_cover + ######################################## ### Build @@ -44,6 +49,9 @@ test: test_unit # test_cli test_unit: @go test $(PACKAGES) +test_cover: + @bash test_cover.sh + test_tutorial: @shelldown ${TUTORIALS} @for script in docs/guide/*.sh ; do \ diff --git a/circle.yml b/circle.yml index 9f7ab6093..c13494bf6 100644 --- a/circle.yml +++ b/circle.yml @@ -17,5 +17,7 @@ dependencies: test: override: - - "cd $REPO && make get_tools && make all" + - "cd $REPO && make ci" - ls $GOPATH/bin + - bash <(curl -s https://codecov.io/bash) -f coverage.txt + diff --git a/test_cover.sh b/test_cover.sh new file mode 100644 index 000000000..4f8aa55f1 --- /dev/null +++ b/test_cover.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e + +PKGS=$(go list ./... | grep -v /vendor/) + +set -e +echo "mode: atomic" > coverage.txt +for pkg in ${PKGS[@]}; do + go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic "$pkg" + if [ -f profile.out ]; then + tail -n +2 profile.out >> coverage.txt; + rm profile.out + fi +done