From fda615b6e692868a4db0760b255ea4cb99b500af Mon Sep 17 00:00:00 2001 From: diginatu Date: Wed, 25 Apr 2018 23:45:02 +0900 Subject: [PATCH] add coverage generation in CI use doecov for serve coverages --- .gitignore | 1 + .travis.yml | 4 ++++ Makefile | 11 +++++++++++ README.md | 1 + 4 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index ecc2f14..7fa733b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ nagome *.exe *.test *.prof +coverage.txt diff --git a/.travis.yml b/.travis.yml index bef572c..f135976 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,10 @@ script: - golint ./... - go vet ./... - make test + - make coverage + +after_success: + - bash <(curl -s https://codecov.io/bash) notifications: slack: diff --git a/Makefile b/Makefile index 17e42f4..efdaca6 100644 --- a/Makefile +++ b/Makefile @@ -26,3 +26,14 @@ clean: .PHONY: test test: go test -v -race $(GOPACKAGES) + +.PHONY: coverage +coverage: + echo "" > coverage.txt + for d in $(GOPACKAGES); do \ + go test -coverprofile=profile.out -covermode=atomic "$$d"; \ + if [ -f profile.out ]; then \ + cat profile.out >> coverage.txt; \ + rm profile.out; \ + fi \ + done diff --git a/README.md b/README.md index e82e14c..af6eaf5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Nagome [![GoDoc](https://godoc.org/github.com/diginatu/nagome?status.svg)](https://godoc.org/github.com/diginatu/nagome) [![Build Status](https://travis-ci.org/diginatu/nagome.svg?branch=master)](https://travis-ci.org/diginatu/nagome) +[![codecov](https://codecov.io/gh/diginatu/nagome/branch/master/graph/badge.svg)](https://codecov.io/gh/diginatu/nagome) Advanced NicoLive Comment Viewer written in go.