Skip to content

About

Github action for mach6/go-covercheck

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

go-covercheck-action

GitHub Action that runs go-covercheck to enforce Go test coverage thresholds.

steps:
  - uses: actions/checkout@v7
  - uses: actions/setup-go@v7
    with:
      go-version-file: go.mod
  - run: go test -coverprofile=coverage.out ./...
  - uses: mach6/go-covercheck-action@v1
    with:
      coverage-file: coverage.out
      statement-threshold: "80"
      block-threshold: "70"
      comment: ${{ github.event_name == 'pull_request' }}

How it works

  • Linux runners: runs the prebuilt ghcr.io/mach6/go-covercheck:<version> image. Nothing is compiled.
  • macOS, Windows, or Linux without Docker: builds that release with go install (needs actions/setup-go).

The CLI release is chosen by the version input, which defaults to 0.7.0. Building that release needs Go 1.27 or newer. Inputs are passed to the script as environment variables, never interpolated into the shell.

comment: true posts the results on the pull request and needs pull-requests: write permission. skip takes newline or comma separated regexes.

Inputs

Input Description Default
coverage-file Path to the coverage profile file coverage.out
config-file Path to the go-covercheck config file (CLI/config default)
statement-threshold Global statement threshold percentage to enforce (CLI/config default)
block-threshold Global block threshold percentage to enforce (CLI/config default)
total-statement-threshold Total statement threshold percentage to enforce (CLI/config default)
total-block-threshold Total block threshold percentage to enforce (CLI/config default)
format Output format (table|json|yaml|md|html|csv|tsv) (CLI/config default)
sort-by Column to sort results by (CLI/config default)
sort-order Sort order (asc|desc) (CLI/config default)
skip Regex patterns of files/packages to skip (newline or comma separated) (CLI/config default)
no-table Hide the results table (true|false) false
no-summary Hide the summary (true|false) false
no-color Disable color output (true|false) false
term-width Terminal width override (CLI/config default)
save-history Save the coverage result to history (true|false) false
history-file Path to the history file (CLI/config default)
label Label for the history entry (CLI/config default)
compare-history Compare against a history entry (ref or label) (CLI/config default)
show-history Show history instead of checking coverage (true|false) false
limit-history Limit the number of history entries shown (CLI/config default)
line-threshold Global line threshold percentage to enforce (CLI/config default)
total-line-threshold Total line threshold percentage to enforce (CLI/config default)
function-threshold Global function threshold percentage to enforce (CLI/config default)
total-function-threshold Total function threshold percentage to enforce (CLI/config default)
table-style Table style for the table output (CLI/config default)
diff-from Only enforce coverage on code changed since this git ref (CLI/config default)
module-name Go module name override (CLI/config default)
hide-columns Columns to leave out of the table, md, html, csv and tsv reports, comma or newline separated (disabled for json, yaml and heatmap) (CLI/config default)
no-uncovered-lines Hide uncovered lines (true|false) false
no-uncovered-functions Hide uncovered functions (true|false) false
comment Post results as a comment on the pull request (true|false). Needs pull-requests write permission false
comment-token Token used to post the comment ${{ github.token }}
version go-covercheck release to use (without or with leading v). Linux runs the ghcr.io/mach6/go-covercheck image, other runners build it with go install 0.7.0
working-directory Directory (relative to the workspace) to run go-covercheck in .

License

See LICENSE.

About

Github action for mach6/go-covercheck

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors