peteksim 0.1.11

petekSim — the SIMULATION layer: dynamic/engineering appraisal (recoverable/forecast) + PVT + the appraisal facade over the petek subsurface-modelling stack, consolidated into one crate.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

jobs:
  rust:
    name: cargo build / clippy / test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2.9.1
      - name: fmt
        run: cargo fmt --all --check
      - name: clippy (warnings = errors)
        run: cargo clippy --workspace --all-targets --all-features -- -D warnings
      - name: test
        run: cargo test --workspace --all-features

  wheel-build:
    name: build abi3 wheel once
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2.9.1
      - uses: actions/setup-python@v6
        with:
          python-version: "3.10"
      - run: pip install maturin
      - run: maturin build --release -m crates/srs-py/Cargo.toml --out dist
      - uses: actions/upload-artifact@v7
        with:
          name: peteksim-abi3-wheel
          path: dist/*.whl

  wheel-test:
    # Import + run the same abi3 wheel across the Python matrix so a
    # toolchain regression (e.g. a pyo3 that can't link a new CPython — the
    # 0.24-vs-3.14 blocker) is caught here, not by users. abi3-py310 means one
    # wheel spans 3.10+, but we still build AND import on each interpreter so a
    # per-version link/ABI break surfaces.
    name: wheel run (py ${{ matrix.python-version }})
    needs: wheel-build
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # 3.10 = the abi3 floor (abi3-py310, requires-python >=3.10); through
        # the latest stable CPython.
        python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
          allow-prereleases: true
      - uses: actions/download-artifact@v8
        with:
          name: peteksim-abi3-wheel
          path: dist
      - name: install wheel + run run_box_model
        # Install the freshly built local wheel by path (never PyPI's peteksim);
        # runtime deps (petektools + petekstatic) resolve from PyPI.
        run: |
          for attempt in 1 2 3 4 5 6; do
            pip install --no-cache-dir --only-binary=:all: dist/peteksim-*.whl && break
            if [ "$attempt" = "6" ]; then
              exit 1
            fi
            sleep $((attempt * 20))
          done
          python - <<'PY'
          import peteksim
          r = peteksim.run_box_model(
              area_km2=(0.32, 0.4, 0.52), gross_height_m=(12, 15, 20),
              porosity=0.25, net_to_gross=0.8, water_saturation=0.3, fvf=1.25,
              fluid="oil", contact_m=2743, realizations=2000, seed=1,
          )
          assert r.p90 < r.p50 < r.p10, (r.p90, r.p50, r.p10)
          assert len(r.samples) == r.realizations == 2000
          print("peteksim", peteksim.version(), "ok:", r)
          PY
      - name: installed-wheel Python suite
        if: matrix.python-version == '3.12'
        run: |
          pip install pytest
          python -m pytest crates/srs-py/tests -q