Bundle data files in pip package and fix hardcoded paths #257
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: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Install uv (fast Python + package manager) and enable caching | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v7 | |
| # Cache uv tool + resolver cache | |
| - name: Cache uv caches | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cache/uv | |
| key: uv-cache-${{ runner.os }}-${{ hashFiles('pyproject.toml', 'uv.lock') }} | |
| # Sync environment from lock if present so tool versions come from pyproject.toml/uv.lock | |
| - name: Sync deps (locked if available) | |
| shell: bash | |
| run: | | |
| if [[ -f uv.lock ]]; then | |
| uv sync --extra dev --frozen | |
| else | |
| uv sync --extra dev | |
| fi | |
| - name: ruff check | |
| run: uv run ruff check s2and scripts tests | |
| - name: ruff format (s2and/) | |
| run: uv run ruff format --check s2and | |
| - name: ruff format (scripts/*.py) | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| files=(scripts/*.py) | |
| if (( ${#files[@]} )); then | |
| uv run ruff format --check "${files[@]}" | |
| fi | |
| typecheck-and-test: | |
| name: typecheck-and-test (${{ matrix.lane }}) | |
| runs-on: ubuntu-latest | |
| needs: [lint] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lane: [py-only, rust-enabled] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v7 | |
| # Optional: ensure a specific Python (uv can also manage this on its own) | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Setup Rust | |
| if: matrix.lane == 'rust-enabled' | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo build | |
| if: matrix.lane == 'rust-enabled' | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| s2and_rust/target | |
| key: cargo-${{ runner.os }}-${{ hashFiles('s2and_rust/Cargo.lock') }} | |
| restore-keys: | | |
| cargo-${{ runner.os }}- | |
| # Cache uv resolver + wheels + project venv | |
| - name: Cache uv + venv | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cache/uv | |
| .venv | |
| key: uv-venv-${{ runner.os }}-py311-${{ matrix.lane }}-${{ hashFiles('pyproject.toml', 'uv.lock') }} | |
| restore-keys: | | |
| uv-venv-${{ runner.os }}-py311-${{ matrix.lane }}- | |
| uv-venv-${{ runner.os }}-py311- | |
| uv-venv- | |
| # Sync environment from lock if present (fast; no network if cached) | |
| - name: Sync deps (locked if available) | |
| shell: bash | |
| run: | | |
| if [[ -f uv.lock ]]; then | |
| if [[ "${{ matrix.lane }}" == "rust-enabled" ]]; then | |
| uv sync --extra dev --extra rust --frozen | |
| else | |
| uv sync --extra dev --frozen | |
| fi | |
| else | |
| # No lock present; resolve once, then install | |
| if [[ "${{ matrix.lane }}" == "rust-enabled" ]]; then | |
| uv sync --extra dev --extra rust | |
| else | |
| uv sync --extra dev | |
| fi | |
| fi | |
| # Build/install Rust extension for parity tests | |
| - name: Build Rust extension | |
| if: matrix.lane == 'rust-enabled' | |
| run: uv run --with maturin maturin develop -m s2and_rust/Cargo.toml | |
| - name: "Rust parity guardrail: feature parity" | |
| if: matrix.lane == 'rust-enabled' | |
| run: uv run pytest -q tests/test_feature_port_parity.py | |
| - name: "Rust parity guardrail: signature preprocess parity" | |
| if: matrix.lane == 'rust-enabled' | |
| run: uv run pytest -q tests/test_rust_signature_preprocess.py | |
| - name: "Rust parity guardrail: batch chunking/fallback parity" | |
| if: matrix.lane == 'rust-enabled' | |
| run: uv run pytest -q tests/test_rust_batch_chunking.py | |
| - name: "Rust parity guardrail: JSON ingest parity" | |
| if: matrix.lane == 'rust-enabled' | |
| run: uv run pytest -q tests/test_rust_from_json_paths.py | |
| # Type checking (ty with tuned migration rules) | |
| - name: ty (s2and) | |
| run: | | |
| uv run ty check s2and \ | |
| --ignore unresolved-import \ | |
| --ignore unused-type-ignore-comment \ | |
| --ignore possibly-missing-attribute \ | |
| --ignore unresolved-global | |
| - name: ty (scripts) | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| files=(scripts/*.py) | |
| if (( ${#files[@]} )); then | |
| uv run ty check "${files[@]}" \ | |
| --ignore unresolved-import \ | |
| --ignore unused-type-ignore-comment \ | |
| --ignore possibly-missing-attribute \ | |
| --ignore unresolved-global \ | |
| --ignore unresolved-reference \ | |
| --ignore unresolved-attribute | |
| fi | |
| - name: pytest (coverage, py-only) | |
| if: matrix.lane == 'py-only' | |
| env: | |
| # keep startup lean; avoid user-level plugins on hosted runners | |
| PYTHONPATH: . | |
| S2AND_BACKEND: python | |
| run: | | |
| uv run pytest tests/ \ | |
| --cov=s2and --cov-report=term-missing --cov-fail-under=40 | |
| - name: pytest (coverage, rust-enabled) | |
| if: matrix.lane == 'rust-enabled' | |
| env: | |
| # keep startup lean; avoid user-level plugins on hosted runners | |
| PYTHONPATH: . | |
| run: | | |
| uv run pytest tests/ \ | |
| --cov=s2and --cov-report=term-missing --cov-fail-under=40 |