Compare commits
3 Commits
main
...
c45423f7f3
| Author | SHA1 | Date | |
|---|---|---|---|
| c45423f7f3 | |||
| 75a50987d3 | |||
| d6b9d7af3e |
@@ -0,0 +1,7 @@
|
|||||||
|
[run]
|
||||||
|
branch = True
|
||||||
|
source = .
|
||||||
|
|
||||||
|
[report]
|
||||||
|
omit =
|
||||||
|
tests/*
|
||||||
@@ -39,8 +39,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Install dev requirements
|
||||||
|
run: python3 -m pip install -r requirements-dev.txt
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: python3 -m unittest discover -t . -s tests/unit -v
|
run: python3 -m coverage run -m unittest discover -t . -s tests/unit -v
|
||||||
|
|
||||||
|
- name: Report unit coverage
|
||||||
|
run: python3 -m coverage report -m
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -62,5 +68,11 @@ jobs:
|
|||||||
echo "docker not on PATH — integration tests will skip"
|
echo "docker not on PATH — integration tests will skip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Install dev requirements
|
||||||
|
run: python3 -m pip install -r requirements-dev.txt
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: python3 -m unittest discover -t . -s tests/integration -v
|
run: python3 -m coverage run -m unittest discover -t . -s tests/integration -v
|
||||||
|
|
||||||
|
- name: Report integration coverage
|
||||||
|
run: python3 -m coverage report -m
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- '**.py'
|
- '**.py'
|
||||||
- '.pylintrc'
|
- '.pylintrc'
|
||||||
|
- '.coveragerc'
|
||||||
|
- '.gitea/workflows/update-badges.yml'
|
||||||
- 'pyrightconfig.json'
|
- 'pyrightconfig.json'
|
||||||
|
- 'requirements-dev.txt'
|
||||||
|
- 'tests/**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -37,6 +41,15 @@ jobs:
|
|||||||
echo "score=$SCORE" >> $GITHUB_OUTPUT
|
echo "score=$SCORE" >> $GITHUB_OUTPUT
|
||||||
echo "Pylint score: $SCORE"
|
echo "Pylint score: $SCORE"
|
||||||
|
|
||||||
|
- name: Run tests and extract coverage
|
||||||
|
id: coverage
|
||||||
|
run: |
|
||||||
|
python -m coverage run -m unittest discover -t . -s tests/unit -v
|
||||||
|
python -m coverage run -a -m unittest discover -t . -s tests/integration -v
|
||||||
|
TOTAL=$(python -m coverage report --format=total)
|
||||||
|
echo "total=$TOTAL" >> $GITHUB_OUTPUT
|
||||||
|
echo "Coverage total: $TOTAL"
|
||||||
|
|
||||||
- name: Run pyright and check errors
|
- name: Run pyright and check errors
|
||||||
id: pyright
|
id: pyright
|
||||||
run: |
|
run: |
|
||||||
@@ -49,9 +62,13 @@ jobs:
|
|||||||
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_TOTAL="${{ steps.coverage.outputs.total }}"
|
||||||
|
|
||||||
PYLINT_SCORE_ENCODED=$(echo "$PYLINT_SCORE" | sed 's|/|%2F|g')
|
PYLINT_SCORE_ENCODED=$(echo "$PYLINT_SCORE" | sed 's|/|%2F|g')
|
||||||
|
|
||||||
|
if [ -n "$COVERAGE_TOTAL" ]; then
|
||||||
|
sed -i "s|/badge/coverage-[^)]*|/badge/coverage-${COVERAGE_TOTAL}%25-brightgreen|" README.md
|
||||||
|
fi
|
||||||
if [ -n "$PYLINT_SCORE_ENCODED" ]; then
|
if [ -n "$PYLINT_SCORE_ENCODED" ]; then
|
||||||
sed -i "s|/badge/pylint-[^)]*|/badge/pylint-${PYLINT_SCORE_ENCODED}-brightgreen|" README.md
|
sed -i "s|/badge/pylint-[^)]*|/badge/pylint-${PYLINT_SCORE_ENCODED}-brightgreen|" README.md
|
||||||
fi
|
fi
|
||||||
@@ -60,7 +77,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Updated badges:"
|
echo "Updated badges:"
|
||||||
grep -E "pylint|pyright" README.md | head -2
|
grep -E "coverage|pylint|pyright" README.md | head -3
|
||||||
|
|
||||||
- name: Commit and push badge updates
|
- name: Commit and push badge updates
|
||||||
run: |
|
run: |
|
||||||
@@ -73,7 +90,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'"- Coverage: ${{ steps.coverage.outputs.total }}"$'\n'"- Pylint: ${{ steps.pylint.outputs.score }}"$'\n'"- Pyright: ${{ steps.pyright.outputs.errors }} errors"$'\n\n'"[skip ci]"
|
||||||
git commit -m "$MSG"
|
git commit -m "$MSG"
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
# bot-bottle
|
# bot-bottle
|
||||||
|
|
||||||
[](https://gitea.dideric.is/didericis/bot-bottle/actions?workflow=test.yml)
|
[](https://gitea.dideric.is/didericis/bot-bottle/actions?workflow=test.yml)
|
||||||
|
[](https://coverage.readthedocs.io/)
|
||||||
[](https://github.com/PyCQA/pylint)
|
[](https://github.com/PyCQA/pylint)
|
||||||
[](https://github.com/microsoft/pyright)
|
[](https://github.com/microsoft/pyright)
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
pylint>=3.0.0
|
pylint>=3.0.0
|
||||||
pyright>=1.1.300
|
pyright>=1.1.300
|
||||||
|
coverage>=7.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user