diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1 @@ +--- diff --git a/.gitignore b/.gitignore index 113a1f3..e0b44f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ builds/ **.out .vscode/ -configs/ \ No newline at end of file +configs/ +coverage.txt \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 839f58b..9e8275f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,4 +21,7 @@ go: - tip script: - - make test \ No newline at end of file + - ./misc/codecov_tests.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index f6ed39a..fd1b734 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # gocrack -[![Build Status](https://travis-ci.org/fireeye/gocrack.svg?branch=master)](https://travis-ci.org/fireeye/gocrack) +[![Build Status](https://travis-ci.org/fireeye/gocrack.svg?branch=master)](https://travis-ci.org/fireeye/gocrack) [![codecov](https://codecov.io/gh/fireeye/gocrack/branch/master/graph/badge.svg)](https://codecov.io/gh/fireeye/gocrack) ![GoCrack Logo](/docs/logo.png) diff --git a/misc/codecov_tests.sh b/misc/codecov_tests.sh new file mode 100755 index 0000000..fc3cc0c --- /dev/null +++ b/misc/codecov_tests.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +FILES=$(go list ./... | egrep -v "gocat|vendor") +set -e +echo "" > coverage.txt + +for d in $FILES; do + go test -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done