Skip to content

Update ci.yml

Update ci.yml #27

Workflow file for this run

name: CI
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python 3.11
run: |
uv python install 3.11
uv venv
- name: Install dev dependencies
run: |
uv pip install -e ".[dev]"
uv pip install types-requests pandas-stubs
- name: Run ruff linting
run: |
uv run ruff check allocator/ tests/
- name: Run ruff formatting check
run: |
uv run ruff format --check allocator/ tests/
- name: Run mypy type checking
run: |
uv run mypy allocator/ || echo "Type checking has known issues, continuing..."
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
run: |
uv python install ${{ matrix.python-version }}
uv venv
- name: Install core dependencies
run: |
uv pip install -e ".[test]"
- name: Install optional dependencies for comprehensive testing
run: |
uv pip install ortools scipy
- name: Test with pytest (core functionality)
run: |
uv run pytest tests/ --cov=allocator --cov-report=xml --cov-report=term-missing -v --tb=short
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: matrix.python-version == '3.11'
with:
file: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
test-algorithms:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python 3.11
run: |
uv python install 3.11
uv venv
- name: Install all optional dependencies
run: |
uv pip install -e ".[test,algorithms,geo]"
- name: Test advanced algorithms
run: |
uv run pytest tests/api/ -k "ortools or google" -v --tb=short
build:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python 3.11
run: |
uv python install 3.11
uv venv
- name: Build package
run: |
uv build
- name: Check package
run: |
uv tool run twine check dist/*