diff --git a/.gitignore b/.gitignore index 81205d3..7fc942e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,9 @@ -profile.cov -cover.out examples/addsvc/addsvc examples/addsvc/client/addcli/addcli examples/stringsvc1/stringsvc1 examples/stringsvc2/stringsvc2 examples/stringsvc3/stringsvc3 +gover.coverprofile # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o diff --git a/bin/coverage-circle.bash b/bin/coverage-circle.bash deleted file mode 100755 index 5575a5a..0000000 --- a/bin/coverage-circle.bash +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -echo "mode: count" >| profile.cov - -for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); -do -if ls $dir/*.go &> /dev/null; then - go test -covermode=count -coverprofile=$dir/profile.tmp $dir - if [ -f $dir/profile.tmp ] - then - cat $dir/profile.tmp | tail -n +2 >> profile.cov - rm $dir/profile.tmp - fi -fi -done - -go tool cover -func profile.cov - -goveralls -coverprofile=profile.cov -service=circle-ci -repotoken=$COVERALLS_TOKEN - diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 4bde74d..0000000 --- a/circle.yml +++ /dev/null @@ -1,9 +0,0 @@ -test: - pre: - - go get github.com/axw/gocov/gocov - - go get github.com/mattn/goveralls - - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - override: - - go get -v -u -d github.com/go-kit/kit/... - - bin/coverage-circle.bash - diff --git a/coverage.bash b/coverage.bash index 3b8b32a..6a00849 100755 --- a/coverage.bash +++ b/coverage.bash @@ -2,7 +2,10 @@ # This script runs the cover tool on all packages with test files. If you set a # WEB environment variable, it will additionally open the web-based coverage -# visualizer for each package. +# visualizer for each package. If you set a COVERALLS environment variable, +# it will report the reults to Coveralls.io. + +set -ex function go_files { find . -name '*_test.go' ; } function filter { grep -v '/_' ; } @@ -19,24 +22,27 @@ PATHS=${1:-$(unique_directories)} -function package_names { - for d in $PATHS +function report { + for path in $PATHS do - echo github.com/go-kit/kit/$d + go test -coverprofile=$path/cover.coverprofile ./$path done } -function report { - package_names | while read pkg - do - go test -coverprofile=cover.out $pkg - if [ -n "${WEB+x}" ] - then - go tool cover -html=cover.out - fi - done - rm cover.out +function combine { + gover +} + +function clean { + find . -name cover.coverprofile | xargs rm } report +combine +clean +if [ -n "${WEB+x}" ] +then + go tool cover -html=$path/cover.coverprofile +fi +