DocsGPT/.github/workflows/pytest.yml
2023-08-16 16:35:48 +02:00

40 lines
1.2 KiB
YAML

name: Run python tests with pytest
on: [push, pull_request]
jobs:
pytest_and_coverage:
name: Run tests and count coverage
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
cd application
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
python -m pytest --cov=application --cov=scripts --cov=extensions --cov-report xml:/tmp/coverage.xml
- name: Coverage
if: github.event_name == 'pull_request' && matrix.python-version == '3.11'
uses: orgoro/coverage@v3
with:
coverageFile: /tmp/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.1
thresholdNew: 0.01
thresholdModified: 0.01