Closed nachg closed 3 years ago
I'm using it myself in multiple repositories. Would adding a link to the following work as an example: example workflow and the maven pom.xml? In that project, I have jacoco configured in a profile in the pom.xml. Or are you looking for a more minimal example?
I think it will be enough. I have injected your badge into my project: https://github.com/nachg/xpathqs also. It is working great!
My suggestion is to add an example badge snippet to the readme.md with the default config:
[![Coverage](.github/badges/jacoco.svg)](jacoco.svg)
And add an example of committing changes in the most simple way (buid.yml):
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: 'upload badge'
add: '*.svg'
@nachg Great documentation suggestions. Thanks. I noticed that your project uses gradle. If you don't mind, I might link to it to have an example of a gradle project that is using the action. All of my projects use maven. In the examples of my own projects that I just linked to, I linked directly to the relevant workflow as well as to the maven pom.xml to make it easy to see how jacoco is configured. I don't use gradle, so not sure what gradle's equivalent is. Where are plugins configured in gradle?
If you don't mind, I might link to it to have an example of a gradle project
Sure, it will be great!
Where are plugins configured in gradle?
In build.gradle.kts. There are just two simple steps required To add Jacoco as a plugin:
plugins {
jacoco
}
And to enable .csv (which is required for the jacoco-badge-generator):
tasks.jacocoTestReport {
reports {
csv.isEnabled = true
}
}
And jobs/steps example:
- name: Run Tests
run: ./gradlew test
- name: Run Test Coverage
run: ./gradlew jacocoTestReport
- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2.1.0
with:
generate-branches-badge: true
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
It will be great to have any link to the working example