Merge pull request #90 from StevenBtw/dev #457
This file contains hidden or 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: ci | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Run linter | |
| run: uv run ruff check solvor/ | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Run type checker | |
| run: uv run ty check solvor/ | |
| test-solvers: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| strategy: | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --extra dev | |
| - name: Run solver tests with coverage | |
| run: uv run pytest tests/solvors/ -v --cov=solvor --cov-report=xml --cov-report=term-missing --cov-fail-under=88 --junitxml=junit.xml | |
| - name: Upload coverage reports to Codecov | |
| if: matrix.python-version == '3.13' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: true | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() && matrix.python-version == '3.13' }} | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./junit.xml | |
| test-rust: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| python-version: "3.13" | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - run: uv sync --extra dev | |
| - name: Build Rust extension | |
| run: uv run maturin develop --release | |
| - name: Run tests with Rust backend | |
| run: uv run pytest tests/solvors/ -v -k "Rust" --no-cov | |
| - name: Verify Rust backend is used | |
| run: | | |
| uv run python -c "from solvor.rust import rust_available; assert rust_available(), 'Rust should be available'" | |
| test-examples: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| strategy: | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --extra dev | |
| - name: Run example tests | |
| run: uv run pytest tests/examples/ -v -m examples --no-cov | |
| test-docs: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| python-version: "3.14" | |
| - run: uv sync --extra dev --extra docs | |
| - name: Test docs build | |
| run: uv run pytest tests/test_docs.py -v -m docs --no-cov |