Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,60 @@ on:
branches: [main]

jobs:
test:
# Pre-commit runs once (not for each Python version)
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
python-version: '3.12'
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: uv.lock

- name: Sync dependencies
run: |
uv sync --locked --extra cpu --dev

run: uv sync --locked --extra cpu --dev
- name: Cache pre-commit
uses: actions/cache@v5
with:
path: ~/.cache/pre-commit/
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

key: pre-commit-3.12-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit checks
run: uv run pre-commit run --all-files
env:
SKIP: no-commit-to-branch

# Tests run in parallel across Python versions
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: uv.lock

- name: Sync dependencies
run: uv sync --locked --extra cpu --dev

- name: Run tests with coverage
run: |
uv run pytest --cov=city2graph --cov-report=xml
run: uv run pytest --cov=city2graph --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # Set CODECOV_TOKEN in repository secrets
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ repos:
- pandas-stubs
- pytest
- shapely
- torch
- types-torch
- torch-geometric
- types-requests