From 7ddd7f488e7a092b336884afe8c55f7038081489 Mon Sep 17 00:00:00 2001 From: Antti Kupila Date: Sat, 12 May 2018 11:43:04 +0200 Subject: [PATCH] Set up codecov --- .circleci/config.yml | 3 ++- .gitignore | 1 + README.md | 1 + codecov.yml | 15 +++++++++++++++ scripts/test.sh | 12 ++++++++++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 codecov.yml create mode 100644 scripts/test.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 3903251..0319bdb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,8 @@ jobs: git --version git config --global user.email "test@test.com" git config --global user.name "Test" - go test ./... -cover + bash scripts/test.sh + bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN - run: name: Build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c57100a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +coverage.txt diff --git a/README.md b/README.md index 3a9de7e..0a923d4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![CircleCI](https://circleci.com/gh/akupila/gitprompt.svg?style=svg)](https://circleci.com/gh/akupila/gitprompt) [![goreportcard](https://goreportcard.com/badge/github.com/akupila/gitprompt)](https://goreportcard.com/report/github.com/akupila/gitprompt) +[![codecov](https://codecov.io/gh/akupila/gitprompt/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/gh/akupila/gitprompt) gitprompt is a configurable, fast and zero-dependencies* way of getting the current git status to be displayed in the `PROMPT`. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..7ca7a90 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +codecov: + branch: master + notify: + require_ci_to_pass: yes +coverage: + precision: 2 + round: down + range: 70...100 + status: + changes: false + patch: false + project: + default: + target: 90% +comment: false diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100644 index 0000000..34dbbfb --- /dev/null +++ b/scripts/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