From 519b7ee292745e5c10fcc39027c802c76d1ad085 Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Sun, 20 Mar 2016 12:54:40 +0100 Subject: [PATCH] Add Coveralls --- .test-coverage | 26 ++++++++++++++++++++++++++ .travis.yml | 4 ++++ README.md | 1 + 3 files changed, 31 insertions(+) create mode 100755 .test-coverage diff --git a/.test-coverage b/.test-coverage new file mode 100755 index 0000000..8bb6ae1 --- /dev/null +++ b/.test-coverage @@ -0,0 +1,26 @@ +#!/bin/bash +# Issue: https://github.com/mattn/goveralls/issues/20 +# Source: https://github.com/uber/go-torch/blob/63da5d33a225c195fea84610e2456d5f722f3963/.test-cover.sh + +echo "mode: count" > profile.cov +FAIL=0 + +# Standard go tooling behavior is to ignore dirs with leading underscors +for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); +do + if ls $dir/*.go &> /dev/null; then + go test -v -covermode=count -coverprofile=profile.tmp $dir || FAIL=$? + if [ -f profile.tmp ] + then + tail -n +2 < profile.tmp >> profile.cov + rm profile.tmp + fi + fi +done + +# Failures have incomplete results, so don't send +if [ "$FAIL" -eq 0 ]; then + goveralls -service=travis-ci -v -coverprofile=profile.cov +fi + +exit $FAIL diff --git a/.travis.yml b/.travis.yml index 73208d7..8f91e8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,7 @@ go: - 1.6 install: - go get -t github.com/FreifunkBremen/respond-collector/... + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - ./.test-coverage diff --git a/README.md b/README.md index d7f0daa..42eae68 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Respond Collector [![Build Status](https://travis-ci.org/FreifunkBremen/respond-collector.svg?branch=master)](https://travis-ci.org/FreifunkBremen/respond-collector) +[![Coverage Status](https://coveralls.io/repos/github/FreifunkBremen/respond-collector/badge.svg?branch=master)](https://coveralls.io/github/FreifunkBremen/respond-collector?branch=master) `respond-collector` is a respond client that fetches, stores and publishes information about a Freifunk network. The goals: * Generating JSON for [MeshViewer](https://github.com/ffnord/meshviewer) (Works with branch [JSONv2](https://github.com/FreifunkBremen/meshviewer/tree/JSONv2))