[claude] Enforce coverage threshold in CI workflow (#935) #1061

Merged
claude merged 1 commits from claude/issue-935 into main 2026-03-23 02:19:27 +00:00

View File

@@ -50,6 +50,7 @@ jobs:
run: pip install tox run: pip install tox
- name: Run tests (via tox) - name: Run tests (via tox)
id: tests
run: tox -e ci run: tox -e ci
# Posts a check annotation + PR comment showing pass/fail counts. # Posts a check annotation + PR comment showing pass/fail counts.
@@ -63,6 +64,20 @@ jobs:
comment_title: "Test Results" comment_title: "Test Results"
report_individual_runs: true report_individual_runs: true
- name: Enforce coverage floor (60%)
if: always() && steps.tests.outcome == 'success'
run: |
python -c "
import xml.etree.ElementTree as ET, sys
tree = ET.parse('reports/coverage.xml')
rate = float(tree.getroot().attrib['line-rate']) * 100
print(f'Coverage: {rate:.1f}%')
if rate < 60:
print(f'FAIL: Coverage {rate:.1f}% is below 60% floor')
sys.exit(1)
print('PASS: Coverage is above 60% floor')
"
# Coverage report available as a downloadable artifact in the Actions tab # Coverage report available as a downloadable artifact in the Actions tab
- name: Upload coverage report - name: Upload coverage report
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4