diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f722032b167..7573dbe5efe 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -25,3 +25,8 @@ jobs: GO111MODULE: "on" run: | sh ./goclean.sh + + - name: Send coverage + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: profile.cov diff --git a/.gitignore b/.gitignore index 72fb9416ea7..c3effe5fc75 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,7 @@ _cgo_export.* _testmain.go *.exe + +# Code coverage files +profile.tmp +profile.cov diff --git a/README.md b/README.md index 8c9d252ad42..72a2ca65938 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ btcd ==== [![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions) +[![Coverage Status](https://coveralls.io/repos/github/btcsuite/btcd/badge.svg?branch=master)](https://coveralls.io/github/btcsuite/btcd?branch=master) [![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/btcsuite/btcd) diff --git a/goclean.sh b/goclean.sh index bb0cd7b6005..dad9f8f1dc2 100755 --- a/goclean.sh +++ b/goclean.sh @@ -4,11 +4,12 @@ # 3. go vet (http://golang.org/cmd/vet) # 4. gosimple (https://github.com/dominikh/go-simple) # 5. unconvert (https://github.com/mdempsky/unconvert) -# +# 6. race detector (http://blog.golang.org/race-detector) +# 7. test coverage (http://blog.golang.org/cover) set -ex -go test -tags="rpctest" ./... +env GORACE="halt_on_error=1" go test -race -tags="rpctest" -covermode atomic -coverprofile=profile.cov ./... # Automatic checks golangci-lint run --deadline=10m --disable-all \