File tree Expand file tree Collapse file tree 2 files changed +89
-1
lines changed
Expand file tree Collapse file tree 2 files changed +89
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Java CI
2+ on : [push, pull_request]
3+
4+ permissions :
5+ contents : write # Required to push the badge SVG back to the repo
6+ actions : read # Optional: helpful for some internal metadata
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ - name : Set up JDK
14+ uses : actions/setup-java@v4
15+ with :
16+ java-version : ' 17'
17+ distribution : ' temurin'
18+ - name : Build and Test
19+ run : mvn test # or ./gradlew test
20+ - name : Generate JaCoCo Badge
21+ uses : cicirello/jacoco-badge-generator@v2
22+ with :
23+ # Maven's default JaCoCo CSV location
24+ jacoco-csv-file : target/site/jacoco/jacoco.csv
25+ badges-directory : .github/badges
26+ generate-branches-badge : true
27+ generate-summary : true
28+ - name : Log coverage percentage
29+ run : |
30+ echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
31+ echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
32+
33+ - name : Commit and push badges
34+ if : github.event_name != 'pull_request'
35+ run : |
36+ cd .github/badges
37+ if [[ `git status --porcelain` ]]; then
38+ git config --global user.name 'github-actions'
39+ git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
40+ git add *.svg
41+ git commit -m "Autogenerated JaCoCo coverage badge"
42+ git push
43+ fi
Original file line number Diff line number Diff line change 236236 </plugin >
237237 <plugin >
238238 <artifactId >maven-surefire-plugin</artifactId >
239- <version >2.22.0</version >
239+ <version >3.2.5</version >
240+ <configuration >
241+ <threadCount >1</threadCount >
242+ <includes >
243+ <include >**/*Test.java</include >
244+ </includes >
245+ </configuration >
246+ <dependencies >
247+ <dependency >
248+ <groupId >org.apache.maven.surefire</groupId >
249+ <artifactId >surefire-junit4</artifactId >
250+ <version >3.2.5</version >
251+ </dependency >
252+ </dependencies >
240253 </plugin >
241254 <plugin >
242255 <artifactId >maven-jar-plugin</artifactId >
325338 </execution >
326339 </executions >
327340 </plugin >
341+ <plugin >
342+ <groupId >org.jacoco</groupId >
343+ <artifactId >jacoco-maven-plugin</artifactId >
344+ <version >0.8.14</version >
345+ <executions >
346+ <execution >
347+ <id >default-prepare-agent</id >
348+ <phase >initialize</phase >
349+ <goals >
350+ <goal >prepare-agent</goal >
351+ </goals >
352+ </execution >
353+ <execution >
354+ <id >report</id >
355+ <phase >test</phase >
356+ <goals >
357+ <goal >report</goal >
358+ </goals >
359+ <configuration >
360+ <formats >
361+ <format >HTML</format >
362+ <format >XML</format >
363+ <format >CSV</format >
364+ </formats >
365+ </configuration >
366+ </execution >
367+ </executions >
368+ </plugin >
328369 </plugins >
329370 </pluginManagement >
330371
331372 <plugins >
373+ <plugin >
374+ <groupId >org.jacoco</groupId >
375+ <artifactId >jacoco-maven-plugin</artifactId >
376+ </plugin >
332377 <plugin >
333378 <artifactId >maven-compiler-plugin</artifactId >
334379 <configuration >
You can’t perform that action at this time.
0 commit comments