lab coverage

This commit is contained in:
e-maks
2024-03-03 22:01:50 +03:00
parent 371401d1b4
commit be15eb4d1b
7 changed files with 184 additions and 9 deletions
+28
View File
@@ -0,0 +1,28 @@
name: lab-coverage
on: [push]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11.6'
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.7.1'
- name: Install dependencies
run: poetry install; poetry add pytest; poetry add pytest-mock; poetry add pytest-cov
- name: Run pytest-cov
run: poetry run pytest tests/ --cov=app --cov-branch --cov-report json:coverage.json
- name: Check coverage threshold
run: |
coverage=$(jq -r '.totals.percent_covered' coverage.json)
if [ $(echo "$coverage >= 85" | bc -l) -eq 1 ]; then
echo "coverage $coverage% is ok"
else
exit 1
fi