slide-deck-ai / .github /workflows /pr-workflow.yml
barunsaha's picture
Update PR workflow to cover multiple Python version
7809586
name: PR Check
on:
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov
- name: Run tests with coverage
run: |
pytest tests/unit --asyncio-mode=auto --cov=src/slidedeckai --cov-report=xml --cov-report=html
- name: Upload test results and coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: pytest-results-py${{ matrix.python-version }}
path: |
htmlcov
coverage.xml
retention-days: 30
- name: Coverage Report
uses: codecov/codecov-action@v5
with:
# Provide the Codecov upload token from repo secrets
token: ${{ secrets.CODECOV_TOKEN }}
# Path to the coverage XML produced by pytest-cov
files: ./coverage.xml
# Fail the job if Codecov returns an error
fail_ci_if_error: true
verbose: true