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