ci(badges): add coverage percentage to quality badges
test / integration (pull_request) Successful in 16s
test / unit (pull_request) Successful in 43s
test / unit (push) Successful in 44s
lint / lint (push) Successful in 1m49s
test / integration (push) Successful in 18s
Update Quality Badges / update-badges (push) Successful in 1m53s
test / integration (pull_request) Successful in 16s
test / unit (pull_request) Successful in 43s
test / unit (push) Successful in 44s
lint / lint (push) Successful in 1m49s
test / integration (push) Successful in 18s
Update Quality Badges / update-badges (push) Successful in 1m53s
The update-badges workflow only refreshed pylint and pyright. Add a coverage step that runs the unit suite under coverage.py, extracts the TOTAL percentage, and updates a new coverage badge in the README. Also trigger the workflow on .coveragerc changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkwFXLFff9PYPy4wgVBJp9
This commit was merged in pull request #278.
This commit is contained in:
@@ -8,6 +8,7 @@ on:
|
|||||||
- '**.py'
|
- '**.py'
|
||||||
- '.pylintrc'
|
- '.pylintrc'
|
||||||
- 'pyrightconfig.json'
|
- 'pyrightconfig.json'
|
||||||
|
- '.coveragerc'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -45,10 +46,19 @@ jobs:
|
|||||||
echo "errors=$ERRORS" >> $GITHUB_OUTPUT
|
echo "errors=$ERRORS" >> $GITHUB_OUTPUT
|
||||||
echo "Pyright errors: $ERRORS"
|
echo "Pyright errors: $ERRORS"
|
||||||
|
|
||||||
|
- name: Run coverage and extract percentage
|
||||||
|
id: coverage
|
||||||
|
run: |
|
||||||
|
python -m coverage run -m unittest discover -t . -s tests/unit > /dev/null 2>&1 || true
|
||||||
|
PERCENT=$(python -m coverage report 2>/dev/null | grep '^TOTAL' | grep -oP '\d+(?=%)' | tail -1)
|
||||||
|
echo "percent=$PERCENT" >> $GITHUB_OUTPUT
|
||||||
|
echo "Coverage: $PERCENT%"
|
||||||
|
|
||||||
- name: Update badges in README
|
- name: Update badges in README
|
||||||
run: |
|
run: |
|
||||||
PYLINT_SCORE="${{ steps.pylint.outputs.score }}"
|
PYLINT_SCORE="${{ steps.pylint.outputs.score }}"
|
||||||
PYRIGHT_ERRORS="${{ steps.pyright.outputs.errors }}"
|
PYRIGHT_ERRORS="${{ steps.pyright.outputs.errors }}"
|
||||||
|
COVERAGE_PERCENT="${{ steps.coverage.outputs.percent }}"
|
||||||
|
|
||||||
PYLINT_SCORE_ENCODED=$(echo "$PYLINT_SCORE" | sed 's|/|%2F|g')
|
PYLINT_SCORE_ENCODED=$(echo "$PYLINT_SCORE" | sed 's|/|%2F|g')
|
||||||
|
|
||||||
@@ -58,9 +68,12 @@ jobs:
|
|||||||
if [ -n "$PYRIGHT_ERRORS" ]; then
|
if [ -n "$PYRIGHT_ERRORS" ]; then
|
||||||
sed -i "s|/badge/pyright-[^)]*|/badge/pyright-${PYRIGHT_ERRORS}%20errors-brightgreen|" README.md
|
sed -i "s|/badge/pyright-[^)]*|/badge/pyright-${PYRIGHT_ERRORS}%20errors-brightgreen|" README.md
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$COVERAGE_PERCENT" ]; then
|
||||||
|
sed -i "s|/badge/coverage-[^)]*|/badge/coverage-${COVERAGE_PERCENT}%25-brightgreen|" README.md
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Updated badges:"
|
echo "Updated badges:"
|
||||||
grep -E "pylint|pyright" README.md | head -2
|
grep -E "pylint|pyright|coverage" README.md | head -3
|
||||||
|
|
||||||
- name: Commit and push badge updates
|
- name: Commit and push badge updates
|
||||||
run: |
|
run: |
|
||||||
@@ -73,7 +86,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "Badge changes detected, committing..."
|
echo "Badge changes detected, committing..."
|
||||||
git add README.md
|
git add README.md
|
||||||
MSG="chore: update quality badges"$'\n\n'"- Pylint: ${{ steps.pylint.outputs.score }}"$'\n'"- Pyright: ${{ steps.pyright.outputs.errors }} errors"$'\n\n'"[skip ci]"
|
MSG="chore: update quality badges"$'\n\n'"- Pylint: ${{ steps.pylint.outputs.score }}"$'\n'"- Pyright: ${{ steps.pyright.outputs.errors }} errors"$'\n'"- Coverage: ${{ steps.coverage.outputs.percent }}%"$'\n\n'"[skip ci]"
|
||||||
git commit -m "$MSG"
|
git commit -m "$MSG"
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
[](https://gitea.dideric.is/didericis/bot-bottle/actions?workflow=test.yml)
|
[](https://gitea.dideric.is/didericis/bot-bottle/actions?workflow=test.yml)
|
||||||
[](https://github.com/PyCQA/pylint)
|
[](https://github.com/PyCQA/pylint)
|
||||||
[](https://github.com/microsoft/pyright)
|
[](https://github.com/microsoft/pyright)
|
||||||
|
[](https://coverage.readthedocs.io/)
|
||||||
|
|
||||||
**Problem:** Developer wants to run a coding agent without supervision, but they don't want a prompt injected or misbehaving agent wrecking their environment or exfiltrating sensitive data.
|
**Problem:** Developer wants to run a coding agent without supervision, but they don't want a prompt injected or misbehaving agent wrecking their environment or exfiltrating sensitive data.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user