Merge pull request #10 from kadel/addCodecov

add codecov.io
This commit is contained in:
Shubham
2018-01-31 19:19:55 +05:30
committed by GitHub
6 changed files with 37 additions and 2 deletions

8
.codecov.yml Normal file
View File

@@ -0,0 +1,8 @@
comment: false
coverage:
status:
project:
default:
target: auto
base: auto

3
.gitignore vendored
View File

@@ -5,6 +5,9 @@
# Ignore compiled files
ocdev
# Ignore coverage report
coverage.txt
#
# GO SPECIFIC
#

View File

@@ -13,4 +13,9 @@ install:
script:
- make
- make validate
- make validate
- make test-coverage
after_success:
# submit coverage.txt to codecov.io
- bash <(curl -s https://codecov.io/bash)

View File

@@ -36,3 +36,7 @@ goget-tools:
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/golang/lint/golint
# Run unit tests and collect coverage
.PHONY: test-coverage
test-coverage:
./scripts/generate-coverage.sh

View File

@@ -1,5 +1,5 @@
# ocdev
[![Build Status](https://travis-ci.org/redhat-developer/ocdev.svg?branch=master)](https://travis-ci.org/redhat-developer/ocdev)
[![Build Status](https://travis-ci.org/redhat-developer/ocdev.svg?branch=master)](https://travis-ci.org/redhat-developer/ocdev) [![codecov](https://codecov.io/gh/kadel/ocdev/branch/master/graph/badge.svg)](https://codecov.io/gh/kadel/ocdev)
## What is ocdev?
OpenShift Command line for Developers

15
scripts/generate-coverage.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
# source: https://github.com/codecov/example-go
# go test can't generate code coverage for multiple packages in one command
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