mirror of
https://github.com/QualityInUse/lab-coverage-maksktl.git
synced 2026-08-05 13:55:28 +03:00
lab coverage
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user