Skip to content

Commit

Permalink
New: Enable code coverage reports (#5)
Browse files Browse the repository at this point in the history
* New: Enable code coverage reports

* Update: Add badge to README
  • Loading branch information
Eric Powers authored and primalmotion committed Nov 8, 2018
1 parent ba55c03 commit 86eecdb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -4,10 +4,11 @@
*/debug
vendor
*.cover
coverage.txt
Gopkg.lock
cmd/rego/rego

*.cov
artifacts

for p in *.spec ; do
data=$(cat $p)
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Expand Up @@ -8,7 +8,8 @@ PROJECT_RELEASE ?= dev
ci: init lint test codecov

init:
dep ensure -v
dep ensure
dep status

lint:
golangci-lint run \
Expand All @@ -30,10 +31,18 @@ lint:
./...

test:
@for d in $(shell go list ./... | grep -v vendor); do \
@ echo 'mode: atomic' > unit_coverage.cov
@ for d in $(shell 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 -f profile.out; fi; \
if [ -f profile.out ]; then tail -q -n +2 profile.out >> unit_coverage.cov; rm -f profile.out; fi; \
done;

codecov:
coverage_aggregate:
@ mkdir -p artifacts
@ for f in `find . -maxdepth 1 -name '*.cov' -type f`; do \
filename="$${f##*/}" && \
go tool cover -html=$$f -o artifacts/$${filename%.*}.html; \
done;

codecov: coverage_aggregate
bash <(curl -s https://codecov.io/bash)
2 changes: 2 additions & 0 deletions README.md
@@ -1,3 +1,5 @@
# Regolithe

[![codecov](https://codecov.io/gh/aporeto-inc/regolithe/branch/master/graph/badge.svg?token=1nPCvsj0YJ)](https://codecov.io/gh/aporeto-inc/regolithe)

Regolithe is a new version of monolithe, written in go, working as a library.

0 comments on commit 86eecdb

Please sign in to comment.