From 2661e88113c7245ceb2962c773b1806546ef3893 Mon Sep 17 00:00:00 2001 From: Jonathon Klobucar Date: Fri, 25 Jul 2014 11:48:53 -0700 Subject: [PATCH] Add a small script to run the tests and report to coveralls in travis. --- .travis.yml | 31 +++++++++++++++++-------------- README.md | 2 +- travis/coveralls-script.sh | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 15 deletions(-) create mode 100755 travis/coveralls-script.sh diff --git a/.travis.yml b/.travis.yml index 66ecba57..fbf149ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,23 @@ language: go go: - - 1.3 - +- 1.3 branches: only: - - master - + - master install: - - DST=~/gopath/src/github.com/apcera - - mkdir -p "$DST" - - git clone --depth=1 --quiet https://github.com/apcera/nats.git "$DST"/nats - - go get code.google.com/p/go.tools/cmd/vet - +- DST=~/gopath/src/github.com/apcera +- mkdir -p "$DST" +- git clone --depth=1 --quiet https://github.com/apcera/nats.git "$DST"/nats +- go get code.google.com/p/go.tools/cmd/vet +- go get code.google.com/p/go.tools/cmd/cover +- go get github.com/mattn/goveralls script: - - go build - - go fmt ./... - - go vet ./... - - go test -i -race ./... - - go test -v -race ./... +- go build +- go fmt ./... +- go vet ./... +- go test -i -race ./... +- go test -v -race ./... +- ./travis/coveralls-script.sh +env: + global: + secure: fi/zxSp5eF6Mt8yrgJakBVinDpCDFy3zPZ4Jy7jsyoKWgF7CdSFmh0WBcN932KOLCRaVm7ZqD2RwO9SifIsBcDtZqML4RKg3Q+T+Uqt4LpskVobMYkPKDcA5i3c3ifhJu/wzl7Y/jnysvjxCwQrH/nGAc4+AwyH6x2TjKF7UFoY= diff --git a/README.md b/README.md index 5bba72ef..c336b89a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Gnatsd [![Build Status](https://secure.travis-ci.org/apcera/gnatsd.svg?branch=master)](http://travis-ci.org/apcera/gnatsd) +# Gnatsd [![Build Status](https://secure.travis-ci.org/apcera/gnatsd.svg?branch=master)](http://travis-ci.org/apcera/gnatsd) [![Coverage Status](https://img.shields.io/coveralls/apcera/gnatsd.svg)](https://coveralls.io/r/apcera/gnatsd) A High Performance [NATS](https://github.com/derekcollison/nats) Server written in [Go.](http://golang.org) diff --git a/travis/coveralls-script.sh b/travis/coveralls-script.sh new file mode 100755 index 00000000..c8d35f45 --- /dev/null +++ b/travis/coveralls-script.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e +echo "mode: count" > acc.out +for Dir in $(find ./* -maxdepth 10 -type d | grep -v test); +do + if ls $Dir/*.go &> /dev/null; + then + go test -v -covermode=count -coverprofile=profile.out $Dir + if [ -f profile.out ] + then + cat profile.out | grep -v "mode: count" >> acc.out + fi +fi +done +$HOME/gopath/bin/goveralls -coverprofile=acc.out $COVERALLS +rm -rf ./profile.out +rm -rf ./acc.out