@@ -78,45 +78,29 @@ jobs:
7878 # ----------------------------------------------
7979 # check coverage percentage
8080 # ----------------------------------------------
81- - name : Check coverage percentage
82- if : steps.override.outputs.override == 'false'
81+ - name : Report coverage percentage
8382 run : |
8483 COVERAGE_FILE="coverage.xml"
8584 if [ ! -f "$COVERAGE_FILE" ]; then
8685 echo "ERROR: Coverage file not found at $COVERAGE_FILE"
8786 exit 1
8887 fi
89-
88+
9089 # Install xmllint if not available
9190 if ! command -v xmllint &> /dev/null; then
9291 sudo apt-get update && sudo apt-get install -y libxml2-utils
9392 fi
94-
93+
9594 COVERED=$(xmllint --xpath "string(//coverage/@lines-covered)" "$COVERAGE_FILE")
9695 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
9998 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}%"
112101 # ----------------------------------------------
113102 # coverage enforcement summary
114103 # ----------------------------------------------
115- - name : Coverage enforcement summary
104+ - name : Coverage summary
116105 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