diff --git a/.testandcover.bash b/.testandcover.bash index 572daea..b768407 100755 --- a/.testandcover.bash +++ b/.testandcover.bash @@ -1,6 +1,4 @@ #!/bin/bash - - function die() { echo $* exit 1 @@ -8,7 +6,7 @@ function die() { export GOPATH=`pwd`:$GOPATH -make +make travis # Initialize profile.cov echo "mode: count" > profile.cov @@ -19,10 +17,9 @@ ERROR="" # Test each package and append coverage profile info to profile.cov for pkg in `cat .testpackages.txt` do - #$HOME/gopath/bin/ - go test -v -covermode=count -coverprofile=profile_tmp.cov $pkg || ERROR="Error testing $pkg" - - [ -f profile_tmp.cov ] && { + go test -v -covermode=count -coverprofile=profile_tmp.cov $pkg || ERROR="Error testing $pkg" + + [ -f profile_tmp.cov ] && { tail -n +2 profile_tmp.cov >> profile.cov || die "Unable to append coverage for $pkg" } done diff --git a/.travis.yml b/.travis.yml index a02a8cb..668b1b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,3 +19,17 @@ script: after_success: - goveralls -coverprofile=profile.cov -service=travis-ci + +before_deploy: "echo 'ready to deploy?'" + +deploy: + provider: releases + file: + - "build/tunasync-linux-bin.tar.gz" + api_key: + secure: "F9kaVaR1mxEh2+EL9Nm8GZmbVY98pXCJA0LGDNrq1C2vU61AUNOeX6yI1mMklHNZPLBqoFDvGN1M5HnJ+xWCFH+KnJgLD2GVIAcAxFNpcNWQe8XKE5heklNsIQNQfuh/rJKM6YzeDB9G5RN4Y76iL4WIAXhNnMm48W6jLnWhf70=" + skip_cleanup: true + overwrite: true + on: + tags: true + all_branches: true diff --git a/Makefile b/Makefile index b4f9aae..b171c75 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ LDFLAGS="-X main.buildstamp=`date -u '+%s'` -X main.githash=`git rev-parse HEAD` all: get tunasync tunasynctl +travis: get tunasync tunasynctl travis-package + get: go get ./cmd/tunasync go get ./cmd/tunasynctl @@ -14,3 +16,6 @@ tunasync: build tunasynctl: build go build -o build/tunasynctl -ldflags ${LDFLAGS} github.com/tuna/tunasync/cmd/tunasynctl + +travis-package: tunasync tunasynctl + tar zcf build/tunasync-linux-bin.tar.gz -C build tunasync tunasynctl