jacoco-badge-generator

Overview

The jacoco-badge-generator GitHub Action parses a jacoco.csv file 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 (configurable with action inputs) to provide an easy to read visual summary of the code coverage of your test cases. The action 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.

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 action is integrated directly into your CI/CD workflow within GitHub Actions. 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 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
ZigguratGaussian build.yml pom.xml