Update tests #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- '.github/workflows/tests.yml' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'pyproject.toml' | |
- '.github/workflows/tests.yml' | |
permissions: | |
contents: read | |
pull-requests: write # Required for codecov PR comments | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11", "3.12", "3.13"] | |
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 -e ".[dev]" | |
- name: Create results directory | |
run: mkdir -p pytest-results | |
- name: Run tests | |
run: | | |
pytest tests/ --cov=mobility_db_api --cov-report=xml --json-report --json-report-file=pytest-results/results.json | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: bdamokos/mobility-db-api | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: pytest-results/results.json |