Don't go undercov! Track your test coverage and check for under-coverage with this Git standalone tool. 🕵️
undercov is a command-line tool built with Go that helps you track your test coverage. It works standalone and stores the coverage data inside a branch in your Git repository. With undercov, you can easily check on your CI pipeline if your changes meet the required coverage thresholds, ensuring that your code is well-tested and maintainable.
- Supports monorepos with multiple coverage files.
undercov is a single multi-platform binary that you can download from the release page.
You can use undercov in your Github Actions workflow to check for under-coverage. Here's an example of how to set it up:
name: Coverage check
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
coverage:
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Run tests and generate lcov file
run: |
# Run your tests and generate the lcov file
- name: Check coverage with undercov
uses: openscript-ch/undercov@v1
with:
threshold: 80
files: '**/coverage/lcov.info'
branch: coveragethreshold: The minimum coverage percentage required to pass the check.files: The glob pattern to locate the coverage files (e.g.,**/coverage/lcov.info).branch: The name of the branch where the coverage data will be stored (default:coverage).
- Clone the repository
- Download Go dependencies
go mod download- Run lint checks with the same golangci-lint version used in CI
make lint- Run tests
make testIf you prefer to run golangci-lint directly without make, use:
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 runReleases are managed with git-cliff and Forgejo workflows.
- Conventional commits are pushed to
main. - The
version.ymlworkflow computes the next semantic version, updatesCHANGELOG.mdwith git-cliff, and creates or updates a release PR. - When the release PR is merged,
tag.ymlcreates and pushes the correspondingv*tag. - The tag triggers
release.yml, which builds binaries for Linux (x86_64,arm64,armv7) and Windows (x86_64,arm64) and uploads artifacts plus SHA256 checksums.
To guarantee that a tag pushed by automation can trigger the release workflow in your Forgejo setup, configure the RELEASE_BOT_TOKEN repository secret and use a token with permission to push branches and tags.