From 4863950d28e5f57b28bc52317989f6a2a9237535 Mon Sep 17 00:00:00 2001 From: Onsi Fakhouri Date: Wed, 23 Apr 2014 15:00:27 -0700 Subject: [PATCH] Coveralls, to keep your code decent. Signed-off-by: David Varvel --- .drone.yml | 1 + README.md | 1 + scripts/test | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 324dba1..edd98ce 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,6 +2,7 @@ image: mischief/docker-golang env: + - COVERALLS_TOKEN={{coveralls_token}} - GOROOT=/usr/local/go - GOPATH=/var/cache/drone - PATH=$GOPATH/bin:$PATH diff --git a/README.md b/README.md index a06dd46..76d826f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Runtime Metrics Server ====================== +* [![Coverage Status](https://coveralls.io/repos/cloudfoundry-incubator/runtime-metrics-server/badge.png)](https://coveralls.io/r/cloudfoundry-incubator/runtime-metrics-server)] This server reports metrics about the runtime data store to the Cloud Foundry [collector](https://github.com/cloudfoundry/collector) diff --git a/scripts/test b/scripts/test index 3b61086..b5677fe 100755 --- a/scripts/test +++ b/scripts/test @@ -13,6 +13,21 @@ export PATH=$FIRST_GOPATH/bin:$PATH go get -u github.com/coreos/etcd go get -u github.com/apcera/gnatsd +go get github.com/dustin/goveralls + go install github.com/onsi/ginkgo/ginkgo -ginkgo -r -failOnPending -randomizeAllSpecs -race -nodes=4 +ginkgo -r -cover -failOnPending -randomizeAllSpecs -race -nodes=4 + +# don't leak coveralls token +set +x + +if [ -n "$COVERALLS_TOKEN" ]; then + profiles=$(find . -name '*.coverprofile' | grep -v fake | grep -v Godeps | grep -v file-server.coverprofile) + + echo mode: set > all.coverprofile + cat $profiles | grep -v mode: >> all.coverprofile + + goveralls -service drone.io -coverprofile=all.coverprofile $COVERALLS_TOKEN || \ + echo "Coveralls failed. :(" +fi