feat: add flexible pruning strategy system to GSP algorithm #712
Workflow file for this run
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: Code Quality | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize, reopened, edited, ready_for_review ] | |
| jobs: | |
| code-quality: | |
| name: Code Quality (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@f06b870e0a91d23284a3013acc55e6f88ab4b904 # v7.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen --extra dev | |
| - name: Check lockfile freshness | |
| if: matrix.python-version == '3.12' | |
| run: | | |
| set -e | |
| if ! uv lock --check; then | |
| echo "::error::uv.lock is out of sync with pyproject.toml" | |
| echo "Running 'uv lock' to show what needs to be updated..." | |
| uv lock | |
| echo "" | |
| echo "Please run 'uv lock' locally and commit the changes:" | |
| git --no-pager diff uv.lock | |
| exit 1 | |
| fi | |
| echo "✓ Lockfile is up to date" | |
| - name: Run tests with coverage | |
| run: | | |
| uv run pytest --cov=gsppy --cov-branch --cov-report=term-missing:skip-covered --cov-report=xml | |
| - name: Run ty | |
| run: uv run ty check . | |
| - name: Run pyright | |
| run: uv run pyright | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: coverage-${{ matrix.python-version }} | |
| path: coverage.xml | |
| if-no-files-found: ignore | |
| rust-backend: | |
| name: Rust Backend (Python 3.12) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@f06b870e0a91d23284a3013acc55e6f88ab4b904 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| enable-cache: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen --extra dev | |
| - name: Build Rust extension | |
| run: | | |
| # Ensure a cargo env file exists so that Makefile's `source "$HOME/.cargo/env"` does not fail | |
| if [ ! -f "$HOME/.cargo/env" ]; then | |
| mkdir -p "$HOME/.cargo" | |
| printf '# no-op cargo env for CI; Rust is already available in PATH\n' > "$HOME/.cargo/env" | |
| fi | |
| make rust-build | |
| - name: Run tests (Rust backend) | |
| env: | |
| GSPPY_BACKEND: rust | |
| run: uv run pytest |