@@ -78,45 +78,29 @@ jobs:
78
78
# ----------------------------------------------
79
79
# check coverage percentage
80
80
# ----------------------------------------------
81
- - name : Check coverage percentage
82
- if : steps.override.outputs.override == 'false'
81
+ - name : Report coverage percentage
83
82
run : |
84
83
COVERAGE_FILE="coverage.xml"
85
84
if [ ! -f "$COVERAGE_FILE" ]; then
86
85
echo "ERROR: Coverage file not found at $COVERAGE_FILE"
87
86
exit 1
88
87
fi
89
-
88
+
90
89
# Install xmllint if not available
91
90
if ! command -v xmllint &> /dev/null; then
92
91
sudo apt-get update && sudo apt-get install -y libxml2-utils
93
92
fi
94
-
93
+
95
94
COVERED=$(xmllint --xpath "string(//coverage/@lines-covered)" "$COVERAGE_FILE")
96
95
TOTAL=$(xmllint --xpath "string(//coverage/@lines-valid)" "$COVERAGE_FILE")
97
-
98
- # Use Python for floating-point math
96
+
97
+ # Calculate percentage using Python for precision
99
98
PERCENTAGE=$(python3 -c "covered=${COVERED}; total=${TOTAL}; print(round((covered/total)*100, 2))")
100
-
101
- echo "Branch Coverage: ${PERCENTAGE}%"
102
- echo "Required Coverage: 85%"
103
-
104
- # Use Python to compare the coverage with 85
105
- python3 -c "import sys; sys.exit(0 if float('${PERCENTAGE}') >= 85 else 1)"
106
- if [ $? -eq 1 ]; then
107
- echo "ERROR: Coverage is ${PERCENTAGE}%, which is less than the required 85%"
108
- exit 1
109
- else
110
- echo "SUCCESS: Coverage is ${PERCENTAGE}%, which meets the required 85%"
111
- fi
99
+
100
+ echo "📊 Branch Coverage: ${PERCENTAGE}%"
112
101
# ----------------------------------------------
113
102
# coverage enforcement summary
114
103
# ----------------------------------------------
115
- - name : Coverage enforcement summary
104
+ - name : Coverage summary
116
105
run : |
117
- if [ "${{ steps.override.outputs.override }}" == "true" ]; then
118
- echo "⚠️ Coverage checks bypassed: ${{ steps.override.outputs.reason }}"
119
- echo "Please ensure this override is justified and temporary"
120
- else
121
- echo "✅ Coverage checks enforced - minimum 85% required"
122
- fi
106
+ echo "Coverage calculation complete. No minimum enforced."
0 commit comments