2021-01-05 16:33:34 +00:00
|
|
|
name: Code Coverage
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: 1.15
|
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
|
2021-01-08 04:42:05 +00:00
|
|
|
# https://markphelps.me/2019/11/speed-up-your-go-builds-with-actions-cache/
|
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache@preview
|
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
2021-01-05 16:33:34 +00:00
|
|
|
- name: Basic build
|
|
|
|
run: go build ./cmd/...
|
|
|
|
|
|
|
|
- name: Run tests on linux with coverage data
|
2021-01-08 04:26:43 +00:00
|
|
|
run: go test -race -coverprofile=coverage.txt -bench=. -benchtime=1x ./...
|
2021-01-05 16:33:34 +00:00
|
|
|
|
|
|
|
- name: coveralls.io
|
|
|
|
uses: shogo82148/actions-goveralls@v1
|
|
|
|
env:
|
|
|
|
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.COVERALLS_BOT_PUBLIC_REPO_TOKEN }}
|
|
|
|
with:
|
|
|
|
path-to-profile: ./coverage.txt
|