Add code coverage #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
cache: false | |
- name: staticcheck | |
uses: dominikh/[email protected] | |
with: | |
version: "2023.1.6" | |
- name: Go test coverage | |
uses: gwatts/go-coverage-action@v1 | |
id: coverage | |
with: | |
# Optional coverage threshold | |
# use fail-coverage to determine what should happen below this threshold | |
coverage-threshold: 25 | |
# collect coverage for all packages beyond the one under test | |
cover-pkg: ./... | |
# Ignore code-generated files when calculating coverage totals | |
ignore-pattern: | | |
\.pb\.go$ | |
\_string\.go$ | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... |