This uses the goveralls package to convert the coverage report to lcov and send it to coveralls.io
35 lines
882 B
YAML
35 lines
882 B
YAML
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
|