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:
name: wheel run (py ${{ matrix.python-version }})
needs: wheel-build
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: 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
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