lab-coverage-maksktl created by GitHub Classroom
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
782 B

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
- 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