Merge pull request #347 from cosmos/coverage

codecov: closes #334
This commit is contained in:
Ethan Buchman 2018-01-17 20:32:33 -05:00 committed by GitHub
commit 85cc4321d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 1 deletions

26
.codecov.yml Normal file
View File

@ -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"

View File

@ -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 all: check_tools get_vendor_deps build test
########################################
### CI
ci: get_tools get_vendor_deps build test_cover
######################################## ########################################
### Build ### Build
@ -44,6 +49,9 @@ test: test_unit # test_cli
test_unit: test_unit:
@go test $(PACKAGES) @go test $(PACKAGES)
test_cover:
@bash test_cover.sh
test_tutorial: test_tutorial:
@shelldown ${TUTORIALS} @shelldown ${TUTORIALS}
@for script in docs/guide/*.sh ; do \ @for script in docs/guide/*.sh ; do \

View File

@ -17,5 +17,7 @@ dependencies:
test: test:
override: override:
- "cd $REPO && make get_tools && make all" - "cd $REPO && make ci"
- ls $GOPATH/bin - ls $GOPATH/bin
- bash <(curl -s https://codecov.io/bash) -f coverage.txt

14
test_cover.sh Normal file
View File

@ -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