File tree Expand file tree Collapse file tree 3 files changed +51
-56
lines changed Expand file tree Collapse file tree 3 files changed +51
-56
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ name: Java CI with Gradle
22on :
33 push :
44 branches : [ master ]
5+ pull_request :
6+ branches : [ master ]
57 workflow_dispatch :
68
79jobs :
@@ -11,40 +13,12 @@ jobs:
1113 steps :
1214 - uses : actions/checkout@v4
1315
14- - name : Set up JDK
16+ - name : Set up JDK 21
1517 uses : actions/setup-java@v4
1618 with :
17- distribution : ' temurin'
18- java-version : ' 21'
19- cache : ' gradle'
20-
21- - name : Grant execute permission for gradlew
22- run : chmod +x gradlew
19+ distribution : temurin
20+ java-version : 21
21+ cache : gradle
2322
2423 - name : Build with Gradle
2524 run : ./gradlew githubWorkflowTest --no-daemon -i
26-
27- - name : Run Test Coverage
28- run : ./gradlew jacocoTestReport -i -PexecutionData='/home/runner/work/java-interview-coding/java-interview-coding/build/jacoco/jacocoTest.exec'
29-
30- - name : Generate JaCoCo Badge
31- uses : cicirello/jacoco-badge-generator@v2
32- with :
33- generate-branches-badge : true
34- jacoco-csv-file : build/reports/jacoco/test/jacocoTestReport.csv
35-
36- - name : Commit the badge (if it changed)
37- run : |
38- if [[ `git status --porcelain` ]]; then
39- git config --global user.name 'Github workflow'
40- git config --global user.email 'nowhere@gmail.com'
41- git add -A
42- git commit -m "Autogenerated JaCoCo coverage badge"
43- git push
44- fi
45-
46- - name : Upload JaCoCo coverage report
47- uses : actions/upload-artifact@v4
48- with :
49- name : jacoco-report
50- path : build/jacocoHtml/
Original file line number Diff line number Diff line change 1+ name : Calculate test coverage & update GH badges
2+ on :
3+ workflow_dispatch :
4+
5+ jobs :
6+ build :
7+ runs-on : ubuntu-latest
8+
9+ steps :
10+ - uses : actions/checkout@v4
11+
12+ - name : Set up JDK 21
13+ uses : actions/setup-java@v4
14+ with :
15+ distribution : temurin
16+ java-version : 21
17+ cache : gradle
18+
19+ - name : Build with Gradle
20+ run : ./gradlew githubWorkflowTest --no-daemon -i
21+
22+ - name : Run Test Coverage
23+ run : ./gradlew jacocoTestReport -i -PexecutionData='/home/runner/work/java-interview-coding/java-interview-coding/build/jacoco/jacocoTest.exec'
24+
25+ - name : Generate JaCoCo Badge
26+ uses : cicirello/jacoco-badge-generator@v2
27+ with :
28+ generate-branches-badge : true
29+ jacoco-csv-file : build/reports/jacoco/test/jacocoTestReport.csv
30+
31+ - name : Commit the badge (if it changed)
32+ run : |
33+ if [[ `git status --porcelain` ]]; then
34+ git config --global user.name 'Github workflow'
35+ git config --global user.email 'nowhere@gmail.com'
36+ git add -A
37+ git commit -m "Autogenerated JaCoCo coverage badge"
38+ git push
39+ fi
40+
41+ - name : Upload JaCoCo coverage report
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : jacoco-report
45+ path : build/jacocoHtml/
You can’t perform that action at this time.
0 commit comments