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