Skip to content

Commit eead479

Browse files
authored
Setup test coverage (text & html reports available in CI) (osuAkatsuki#609)
* add coverage dep * add .coverage to .gitignore * coverage run & report in exec-tests script * html cov report * report --show-missing --fail-under=45 * upload code cov artifact in ci
1 parent 59b17c8 commit eead479

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

.github/workflows/test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,9 @@ jobs:
6565
- name: Stop containers
6666
if: always()
6767
run: docker-compose down
68+
69+
- name: Archive code coverage results
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: code-coverage-report
73+
path: coverage/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tools/cf_records.txt
1616
/.db-data/
1717
/.redis-data/
1818
poetry.toml
19+
.coverage

poetry.lock

Lines changed: 65 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pytest-asyncio = "0.23.5"
7272
asgi-lifespan = "2.1.0"
7373
respx = "0.20.2"
7474
tzdata = "2024.1"
75+
coverage = "^7.4.1"
7576

7677
[tool.poetry.group.dev.dependencies]
7778
pre-commit = "3.6.1"

scripts/run-tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ execDBStatement "source /srv/root/migrations/base.sql"
5656

5757
# Run tests
5858
echo "Running tests..."
59-
pytest -vv -s tests/
59+
coverage run -m pytest -vv -s tests/
60+
coverage report --show-missing --fail-under=45
61+
coverage html

0 commit comments

Comments
 (0)