go-coverage-summary

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 7 Imported by: 0

README

go-coverage-summary

Action to display Go Code Coverage summary on github workflow summary.

Usage

The only input to the action is the path to the coverage profile file, generated by go test when run with the -coverprofile flag. The action does require that the -covermode=atomic is also provided on the call to go test. Below is an example of how to call the action.

name: Example

on:
  push:
    branches-ignore:
      - main

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version: '1.22.5'

    - name: Run tests
      run: go test -cover -covermode=atomic -coverprofile=coverage.out -race ./...

    - name: Call action
      uses: notmiguelalves/go-coverage-summary@v0.5.0
      with:
        coverage-file: "coverage.out"
        exclusions: "utils,wrapper"  # note that this is a comma separated list

Will then create a table in the job summary output containing the coverage for each package. For example:

Package Coverage
github.com/notmiguelalves/anypipe/pkg/dockerutils 89.2%
github.com/notmiguelalves/anypipe/pkg/anypipe 69.8%

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL