diff --git a/.travis.yml b/.travis.yml index 5a556d9fd..82ad32ae3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,4 +24,7 @@ before_script: - psql prest -c 'create table test(name text);' -U postgres script: - - go test -v -race ./... + - sh test.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 551f234bd..93023843c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://travis-ci.org/nuveo/prest.svg?branch=master)](https://travis-ci.org/nuveo/prest) [![GoDoc](https://godoc.org/github.com/nuveo/prest?status.png)](https://godoc.org/github.com/nuveo/prest) [![Go Report Card](https://goreportcard.com/badge/github.com/nuveo/prest)](https://goreportcard.com/report/github.com/nuveo/prest) +[![codecov](https://codecov.io/gh/nuveo/prest/branch/master/graph/badge.svg)](https://codecov.io/gh/nuveo/prest) Serve a RESTful API from any PostgreSQL database diff --git a/coverage.txt b/coverage.txt new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/coverage.txt @@ -0,0 +1 @@ + diff --git a/test.sh b/test.sh new file mode 100755 index 000000000..34dbbfb31 --- /dev/null +++ b/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -race -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done