Skip to content

Commit 7df484b

Browse files
authored
Merge pull request #36 from Brijeshthummar02/java-11
Enhance Java 11 CI workflow with improved logging and coverage reporting
2 parents 1c7eb59 + 605b1cb commit 7df484b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/java-11.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ on:
2626
# build execution
2727
pull_request:
2828
types: [ labeled, opened, synchronize, reopened ]
29-
29+
3030
jobs:
3131
build:
32-
3332
runs-on: ubuntu-latest
3433

3534
steps:
36-
- uses: actions/checkout@v4
35+
- name: Checkout Repository
36+
uses: actions/checkout@v4
37+
3738
- name: Set up JDK 11
3839
uses: actions/setup-java@v4
3940
with:
@@ -59,8 +60,8 @@ jobs:
5960

6061
- name: Log coverage percentages to workflow output
6162
run: |
62-
echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}"
63-
echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}"
63+
echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}%"
64+
echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}%"
6465
6566
- name: Upload JaCoCo coverage report
6667
uses: actions/upload-artifact@v4
@@ -81,11 +82,17 @@ jobs:
8182
if: ${{ github.event_name == 'pull_request' }}
8283
run: |
8384
REPORT=$(<.github/badges/coverage-summary_java-11.json)
85+
if [[ -z "$REPORT" ]]; then
86+
echo "Coverage report not found!" >&2
87+
exit 1
88+
fi
89+
8490
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
8591
BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
8692
NEWLINE=$'\n'
87-
BODY="## JaCoCo Test Coverage Summary Statistics (java-11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
88-
gh pr comment ${{github.event.pull_request.number}} -b "${BODY}"
93+
BODY="## JaCoCo Test Coverage Summary Statistics (Java 11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
94+
95+
gh pr comment ${{ github.event.pull_request.number }} -b "${BODY}"
8996
continue-on-error: true
9097
env:
9198
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)