-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Travis CI config and test coverage script
- Loading branch information
Showing
5 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ _testmain.go | |
# Created by .ignore support plugin (hsz.mobi) | ||
|
||
/build/ | ||
coverage.out | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
sudo: required | ||
|
||
language: go | ||
|
||
services: | ||
- docker | ||
|
||
go: | ||
- 1.8.x | ||
|
||
os: | ||
- linux | ||
|
||
before_install: | ||
- go get -v github.com/mattn/goveralls | ||
|
||
install: | ||
- make setup | ||
|
||
script: | ||
- make build | ||
- make test-race | ||
- make check | ||
- make bench-race | ||
- make coveralls | ||
|
||
after_success: | ||
- if [ "$TRAVIS_OS_NAME" == "linux" -a ! -z "$TRAVIS_TAG" ]; then | ||
echo "Executing release on tag build $TRAVIS_TAG"; | ||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; | ||
make release; | ||
else | ||
echo "Not executing release on non-tag build"; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
function die() { | ||
echo $* | ||
exit 1 | ||
} | ||
|
||
# Initialize coverage.out | ||
echo "mode: count" > coverage.out | ||
|
||
# Initialize error tracking | ||
ERROR="" | ||
|
||
declare -a packages=('' \ | ||
'cmd' \ | ||
'iam' \ | ||
'iptables' \ | ||
'k8s' \ | ||
'server' \ | ||
'store' \ | ||
'version'); | ||
|
||
# Test each package and append coverage profile info to coverage.out | ||
for pkg in "${packages[@]}" | ||
do | ||
go test -v -covermode=count -coverprofile=coverage_tmp.out "github.com/jtblin/kube2iam/$pkg" || ERROR="Error testing $pkg" | ||
tail -n +2 coverage_tmp.out >> coverage.out 2> /dev/null ||: | ||
done | ||
|
||
rm -f coverage_tmp.out | ||
|
||
if [ ! -z "$ERROR" ] | ||
then | ||
die "Encountered error, last error was: $ERROR" | ||
fi |