Add coveralls.io code coverage github-action

This uses the goveralls package to convert the coverage report to lcov
and send it to coveralls.io
This commit is contained in:
Brian C. Lane 2020-03-09 09:19:56 -07:00 committed by Tom Gundersen
parent 46c3bed153
commit c5341211e9

35
.github/workflows/coverage.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Coverage
# NOTE(mhayden): Restricting branches prevents jobs from being doubled since
# a push to a pull request triggers two events.
on:
pull_request:
branches:
- "*"
push:
branches:
- master
jobs:
test:
name: Test with Coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: |
go mod download
- name: Run Unit tests
run: |
go test -race -covermode atomic -coverprofile=profile.cov ./...
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github