Skip to content

Commit 8a9950e

Browse files
committed
fix coverage reporting if I can for the github action
1 parent 512d93d commit 8a9950e

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,38 +172,32 @@ jobs:
172172
run: |
173173
echo "### 🧪 Test & Coverage Summary" >> $GITHUB_STEP_SUMMARY
174174
175-
# 1. CHECK OVERALL TEST STATUS
176175
if [[ "${{ needs.test.result }}" != "success" ]]; then
177176
echo "❌ **Test Suite Failed**" >> $GITHUB_STEP_SUMMARY
178-
echo "Coverage check skipped because tests failed." >> $GITHUB_STEP_SUMMARY
179177
exit 1
180178
fi
181179
echo "✅ **Test Suite Passed**" >> $GITHUB_STEP_SUMMARY
182180
183-
# 2. COMBINE COVERAGE (Only 3.13 files exist here)
184181
uv tool install coverage
185-
186-
# Move the specific 3.13 files to root
187182
mv all-results/.coverage* .
188183
189184
echo "Merging coverage files..."
190185
uv tool run coverage combine
191186
192-
# 3. ENFORCE 85%
193-
OUTPUT=$(uv tool run coverage report --show-missing --fail-under=85 2>&1)
194-
EXIT_CODE=$?
187+
OUTPUT=$(uv tool run coverage report --show-missing --fail-under=85 2>&1) || EXIT_CODE=$?
195188
189+
# Show the report in the console logs
196190
echo "$OUTPUT"
197191
192+
# Write the report to the GitHub Summary UI
198193
echo '```' >> $GITHUB_STEP_SUMMARY
199194
echo "$OUTPUT" >> $GITHUB_STEP_SUMMARY
200195
echo '```' >> $GITHUB_STEP_SUMMARY
201196
202-
if [ $EXIT_CODE -ne 0 ]; then
197+
# Now we handle the exit code
198+
if [ "${EXIT_CODE:-0}" -ne 0 ]; then
203199
echo "❌ **Coverage Failed:** Python 3.13 coverage is below 85%." >> $GITHUB_STEP_SUMMARY
204-
# Exit with the original code to fail the build
205200
exit $EXIT_CODE
206201
else
207202
echo "✅ **Coverage Passed:** 85% coverage achieved (Py3.13)." >> $GITHUB_STEP_SUMMARY
208-
exit 0
209203
fi

0 commit comments

Comments
 (0)