The jacoco-badge-generator can be used in one of two ways: as a GitHub Action or as a command-line utility (e.g., such as part of a local build script). The jacoco-badge-generator parses a jacoco.csv from a JaCoCo coverage report, computes C0 and C1 coverage percentages from JaCoCo's Instructions and Branches counters, and generates badges for one or both of these (user configurable) to provide an easy to read visual summary of the code coverage of your test cases. The default behavior directly generates the badges internally with no external calls, but the action also provides an option to instead generate Shields JSON endpoints. It supports both the basic case of a single jacoco.csv, as well as multi-module projects in which case the action can produce coverage badges from the combination of the JaCoCo reports from all modules, provided that the individual reports are independent. It can also optionally generate a simple JSON summary report containing the computed coverages for easy consumption by other tools.

When used as a GitHub Action, the jacoco-badge-generator can also optionally be used as part of a pull-request check. Specifically, you can configure it to fail the workflow run if coverage decreased relative to prior run, and/or if coverage is below a target threshold.

The jacoco-badge-generator can be integrated directly into your CI/CD workflow within GitHub Actions, or it can be used as a command-line utility (installable for this purpose from PyPI). It is implemented in Python. The jacoco-badge-generator source code repository is hosted on GitHub; and is licensed under the MIT License. Also in the GitHub repository you will find detailed instructions for use including several sample GitHub workflows.

The jacoco-badge-generator GitHub Action is developed by Vincent A. Cicirello. It was originally implemented for my own use, but I have decided to share it with others.

Live GitHub Actions Examples

We have a template repository containing a simple Java project (Maven), and several runnable example workflows demonstrating the most common use-cases. The purpose of that repository is to enable potential new users of the action to use it as a project starter, or to have a sample that they can fork and experiment with before integrating into their projects.

You can also take a look at the following real projects that use the action.

RepositoryWorkflowBuild Configuration
Chips-n-Salsa build.yml pom.xml
JavaPermutationTools build.yml pom.xml
ρμ build.yml pom.xml

Tech Stack

The jacoco-badge-generator GitHub Action utilizes the following:

Blog Posts About the jacoco-badge-generator

As the author of the jacoco-badge-generator, I occasionally post about this, and other software that I maintain on DEV.to. See my DEV.to profile for a full list of such posts. Below is a selection of blog posts specifically about the jacoco-badge-generator.