mirror of
https://github.com/QualityInUse/lab-coverage-maksktl.git
synced 2026-08-05 13:55:28 +03:00
28 lines
782 B
YAML
28 lines
782 B
YAML
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 |