From 53fc8a511a9cc4d5893166bbaffdc42ecc7754da Mon Sep 17 00:00:00 2001 From: Jeremy Clerc Date: Mon, 13 Feb 2017 09:45:59 +0100 Subject: Add build/coverage badge. Update travis config to have code coverage. --- .travis.yml | 12 +++++++++++- README.md | 4 ++++ test.sh | 12 ++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 test.sh diff --git a/.travis.yml b/.travis.yml index 8e65008..35dfb22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,13 @@ language: go +sudo: false go: - - 1.x \ No newline at end of file + - 1.x + +before_install: + - go get -t -v ./... + +script: + - ./test.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index bfd7f38..4870b76 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Build +Status](https://travis-ci.org/google/easypki.svg?branch=master)](https://travis-ci.org/google/easypki) +[![codecov](https://codecov.io/gh/google/easypki/branch/master/graph/badge.svg)](https://codecov.io/gh/google/easypki) + easypki ====== diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..34dbbfb --- /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 -- cgit v1.3