Skip to content

release 0.12.6: correctness fixes from a full review, and a website t… #98

release 0.12.6: correctness fixes from a full review, and a website t…

release 0.12.6: correctness fixes from a full review, and a website t… #98

Workflow file for this run

name: CI
on:
push:
branches: [main, modernize-rust-core]
tags: ["v*"]
pull_request:
permissions:
contents: read
jobs:
# --- Rust core: format, lint, unit tests (pure Rust, no Python) ---
core-test:
name: core (rust test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: rustfmt
run: cargo fmt --manifest-path core/Cargo.toml --check
- name: clippy
run: cargo clippy --manifest-path core/Cargo.toml --all-targets -- -D warnings
- name: cargo test
run: cargo test --manifest-path core/Cargo.toml
# --- Build abi3 wheels per platform and smoke-test the import on each OS.
# This is the cross-platform "does the abi3 wheel import + run" spike. ---
core-wheels:
name: core wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64
- os: macos-latest
target: universal2-apple-darwin
- os: windows-latest
target: x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Build wheel (maturin, abi3)
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --manifest-path core/Cargo.toml --out dist
target: ${{ matrix.target }}
manylinux: auto
sccache: true
- name: Smoke-test the wheel (import + run tests)
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install numpy pytest
python -m pip install --no-index --find-links dist isobenefit
python -m pytest core/tests_py -q
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl
# --- Source distribution (lets pip build from source when no wheel matches) ---
core-sdist:
name: core sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --manifest-path core/Cargo.toml --out dist
- uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist/*.tar.gz
# --- Publish to PyPI on a version tag (e.g. v0.1.0) via trusted publishing ---
core-publish:
name: publish core to PyPI
needs: [core-test, core-wheels, core-sdist]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: wheels-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
# --- Plugin test suite (headless): the pure pipeline (grid/routing/osm helpers) against a
# freshly built engine wheel, so plugin<->core drift is caught in CI, not in QGIS. ---
plugin-tests:
name: plugin (pytest vs fresh wheel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build engine wheel (maturin, abi3)
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --manifest-path core/Cargo.toml --out dist
manylinux: auto
sccache: true
- name: Run the plugin test suite
run: |
python -m pip install --upgrade pip
python -m pip install numpy shapely pytest
python -m pip install --no-index --find-links dist isobenefit
python -m pytest tests -q
# --- Build the QGIS plugin zip (the isobenefit_qgis/ folder only, never core/) ---
plugin:
name: plugin (lint + zip)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Lint
run: |
python -m pip install ruff
ruff check isobenefit_qgis
- name: Build plugin zip
run: |
mkdir -p dist
# the plugin repository requires a licence file inside the zip
cp LICENSE isobenefit_qgis/LICENSE
zip -r dist/isobenefit_qgis.zip isobenefit_qgis \
-x '*/__pycache__/*' '*.pyc'
- uses: actions/upload-artifact@v4
with:
name: plugin-zip
path: dist/isobenefit_qgis.zip