@@ -12,28 +12,28 @@ jobs:
1212 runs-on : ubuntu-latest
1313
1414 steps :
15- - name : Checkout repository
15+ - name : 🧾 Checkout repository
1616 uses : actions/checkout@v4
1717
18- - name : Set up JDK 8 (Temurin)
18+ - name : ☕ Set up JDK 8 (Temurin)
1919 uses : actions/setup-java@v4
2020 with :
21- distribution : ' temurin'
22- java-version : ' 8 '
21+ distribution : temurin
22+ java-version : 8
2323 cache : maven
2424
25- - name : Enable tests in pom.xml
25+ - name : 🧩 Ensure tests are enabled in pom.xml
2626 run : |
2727 echo "🔧 Ensuring tests are enabled in pom.xml..."
2828 sed -i 's/<skipTests>true<\/skipTests>/<skipTests>false<\/skipTests>/g' pom.xml || true
2929
30- - name : Run tests and generate JaCoCo report
30+ - name : 🧪 Run tests and generate JaCoCo report
3131 run : mvn clean test -Dtest='Test*' jacoco:report -Dgpg.skip=true
3232
3333 - name : 📊 Extract coverage from JaCoCo HTML report
3434 id : extract_coverage
3535 run : |
36- echo "Extracting coverage summary from JaCoCo HTML report..."
36+ echo "📊 Extracting coverage summary from JaCoCo HTML report..."
3737
3838 REPORT="target/site/jacoco/index.html"
3939
5757 echo "instruction=${INSTRUCTION}" >> $GITHUB_OUTPUT
5858 echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
5959
60+ - name : 🚦 Enforce coverage threshold
61+ run : |
62+ MIN_INSTRUCTION=90
63+ MIN_BRANCH=80
64+
65+ INSTRUCTION=${{ steps.extract_coverage.outputs.instruction }}
66+ BRANCH=${{ steps.extract_coverage.outputs.branch }}
67+
68+ echo "🧾 Required minimums:"
69+ echo " • Instruction: ${MIN_INSTRUCTION}%"
70+ echo " • Branch: ${MIN_BRANCH}%"
71+ echo ""
72+ echo "📈 Actual coverage:"
73+ echo " • Instruction: ${INSTRUCTION}%"
74+ echo " • Branch: ${BRANCH}%"
75+
76+ if [ "$INSTRUCTION" -lt "$MIN_INSTRUCTION" ]; then
77+ echo "❌ Instruction coverage (${INSTRUCTION}%) is below the threshold (${MIN_INSTRUCTION}%)"
78+ exit 1
79+ fi
80+
81+ if [ "$BRANCH" -lt "$MIN_BRANCH" ]; then
82+ echo "❌ Branch coverage (${BRANCH}%) is below the threshold (${MIN_BRANCH}%)"
83+ exit 1
84+ fi
85+
86+ echo "✅ Coverage thresholds met!"
87+
6088 - name : 💬 Post coverage summary as PR comment
6189 uses : marocchino/sticky-pull-request-comment@v2
6290 with :
0 commit comments