build: capture code coverage stats during Travis-CI run

The results are uploaded to codecov.io to create readable reports.
This commit is contained in:
Martin Atkins 2017-06-02 08:25:08 -07:00
parent c15eb86349
commit 5522e0c8d0
2 changed files with 21 additions and 0 deletions

12
.travis.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -e
echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done

View File

@ -4,3 +4,12 @@ go:
- 1.7.x
- 1.8.x
- tip
before_install:
- go get -t -v ./...
script:
- ./.travis.sh
after_success:
- bash <(curl -s https://codecov.io/bash)