name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
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 -- -D warnings
- name: build
run: cargo build --workspace
- name: test
run: cargo test --workspace
python:
name: maturin develop + import
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: build + import smoke test
run: |
python -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop -m crates/srs-py/Cargo.toml
python -c "import peteksim; print(peteksim.version())"
wheels:
name: wheel build + run (py ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
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: ${{ matrix.python-version }}
allow-prereleases: true
- name: install maturin
run: pip install maturin
- name: build release wheel
run: maturin build --release -m crates/srs-py/Cargo.toml --out dist
- name: install wheel + run run_box_model
run: |
pip install dist/peteksim-*.whl
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