generated from cicirello/python-github-action-template
-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from cicirello/prep-release
Prepare release 2.9.0
- Loading branch information
Showing
3 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,6 +276,17 @@ and in particular see the [Multi-Module Example Workflows](#multi-module-example | |
for an example of how to do this. Multi-module support is limited to cases where | ||
each module has its own test coverage report, and where those reports don't overlap. | ||
|
||
You can also use a glob pattern to specify the set of JaCoCo reports for your modules. | ||
For example, `jacoco-csv-file: "**/jacoco.csv"` will match all `jacoco.csv` files found | ||
across all directories within your project. Or for example `jacoco-csv-file: "**/*.csv"` | ||
will match all `csv` files found within your project, but be careful with such a pattern | ||
if your project has other `csv` files that are not JaCoCo reports. Or as another example, | ||
maybe all of your JaCoCo reports are in the same directory, but with names with numbers. | ||
The pattern `jacoco-csv-file: "target/site/jacoco/module*.csv"` will match all `csv` files | ||
in the directory `target/site/jacoco/` whose name begins with `module`. Note that in all of | ||
these examples you need the quotes around the glob pattern or else GitHub Actions will | ||
give you an error that your workflow file is invalid. | ||
|
||
The action assumes that all reports passed via this input are | ||
independent of each other. If you are using matrix testing, such that | ||
each group of tests produces a report, and where the groups overlap in what | ||
|
@@ -556,7 +567,7 @@ along the lines of the following: | |
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.8</version> | ||
<version>0.8.10</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
|
@@ -578,7 +589,7 @@ along the lines of the following: | |
|
||
Note that the jacoco-badge-generator action has been tested with | ||
the `jacoco.csv` files generated by `jacoco-maven-plugin` versions | ||
0.8.6 through 0.8.8, and has not been tested with earlier versions | ||
0.8.6 through 0.8.10, and has not been tested with earlier versions | ||
of JaCoCo. | ||
|
||
##### Running JaCoCo via Gradle | ||
|
@@ -648,7 +659,7 @@ You can also use a specific release with: | |
```yml | ||
- name: Generate JaCoCo Badge | ||
uses: cicirello/jacoco-badge-generator@v2.8.0 | ||
uses: cicirello/jacoco-badge-generator@v2.9.0 | ||
with: | ||
generate-branches-badge: true | ||
``` | ||
|
@@ -728,7 +739,7 @@ jobs: | |
- name: Set up the Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
|
@@ -786,7 +797,7 @@ jobs: | |
- name: Set up the Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Build with Maven | ||
|
@@ -846,7 +857,7 @@ jobs: | |
- name: Set up the Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
|
@@ -878,7 +889,62 @@ jobs: | |
fi | ||
``` | ||
|
||
#### Example Workflow 4: Multi-Module Project with Separate Badges for Each Module. | ||
#### Example Workflow 4: Glob Pattern to Specify Reports of a Multi-Module Project. | ||
|
||
This example workflow uses a glob pattern to specify the reports of a multi-module project, | ||
and generates both badges (instructions coverage percentage and branches coverage percentage). | ||
The badges that are generated are computed over all modules. In this example, all of the JaCoCo | ||
reports are named `jacoco.csv` but reside in different directories. You can match all of them | ||
with `jacoco-csv-file: "**/jacoco.csv"`. The quotes around the glob are required to avoid an | ||
invalid workflow error from GitHub Actions. | ||
|
||
```yml | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up the Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Build with Maven | ||
run: mvn -B test | ||
|
||
- name: Generate JaCoCo Badge | ||
id: jacoco | ||
uses: cicirello/jacoco-badge-generator@v2 | ||
with: | ||
generate-branches-badge: true | ||
jacoco-csv-file: "**/jacoco.csv" | ||
|
||
- name: Log coverage percentage | ||
run: | | ||
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | ||
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | ||
- name: Commit the badge (if it changed) | ||
run: | | ||
if [[ `git status --porcelain` ]]; then | ||
git config --global user.name 'YOUR NAME HERE' | ||
git config --global user.email '[email protected]' | ||
git add -A | ||
git commit -m "Autogenerated JaCoCo coverage badge" | ||
git push | ||
fi | ||
``` | ||
#### Example Workflow 5: Multi-Module Project with Separate Badges for Each Module. | ||
If you would prefer to generate separate coverage badges for each of the | ||
modules of a multi-module project, then just include multiple steps of the | ||
|
@@ -907,7 +973,7 @@ jobs: | |
- name: Set up the Java JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
|
@@ -1111,6 +1177,18 @@ something like: | |
python3 -m jacoco_badge_generator --jacoco-csv-file reports/report1.csv reports/report2.csv | ||
``` | ||
|
||
In CLI mode, glob patterns will be handled by your shell. You can accomplish the above with: | ||
|
||
```Shell | ||
python3 -m jacoco_badge_generator --jacoco-csv-file reports/report*.csv | ||
``` | ||
|
||
Or perhaps all of your reports are named `jacoco.csv` but in different directories, then you can | ||
match all of them with: | ||
|
||
```Shell | ||
python3 -m jacoco_badge_generator --jacoco-csv-file **/jacoco.csv | ||
``` | ||
|
||
## Summary of Input Defaults | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | |
|
||
[project] | ||
name = "jacoco-badge-generator" | ||
version = "2.8.1" | ||
version = "2.9.0" | ||
authors = [ | ||
{ name="Vincent A. Cicirello", email="[email protected]" }, | ||
] | ||
|
@@ -46,6 +46,7 @@ exclude = [ | |
"/.github", | ||
"/images", | ||
"/src/entrypoint.py", | ||
"/tests", | ||
"/.dockerignore", | ||
"/action.yml", | ||
"/Dockerfile", | ||
|