Skip to content

Commit 3f0a5ee

Browse files
committed
update ci/travis to work with multiple packages
1 parent 78ff80e commit 3f0a5ee

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: go
22
go:
3-
- 1.7
3+
- 1.7.1
44
install:
55
- go get -u github.com/stretchr/testify/assert
66
- go get -u github.com/pborman/uuid
@@ -9,7 +9,7 @@ install:
99
- go get -u github.com/go-openapi/errors
1010
- go get -u github.com/mitchellh/mapstructure
1111
script:
12-
- go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
12+
- ./hack/coverage
1313
after_success:
1414
- bash <(curl -s https://codecov.io/bash)
1515
notifications:

hack/coverage

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
4+
# Run test coverage on each subdirectories and merge the coverage profile.
5+
echo "mode: ${GOCOVMODE-atomic}" > coverage.txt
6+
7+
# Standard go tooling behavior is to ignore dirs with leading underscores
8+
# skip generator for race detection and coverage
9+
for dir in $(go list ./...)
10+
do
11+
pth="$GOPATH/src/$dir"
12+
go test -race -timeout 20m -covermode=${GOCOVMODE-atomic} -coverprofile=${pth}/profile.out $dir
13+
if [ -f $pth/profile.out ]
14+
then
15+
cat $pth/profile.out | tail -n +2 >> coverage.txt
16+
rm $pth/profile.out
17+
fi
18+
done
19+
20+
go tool cover -func coverage.txt

0 commit comments

Comments
 (0)