release 0.12.7: version tags publish a GitHub release with the plugin… #102
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: | |
| push: | |
| branches: [main, modernize-rust-core] | |
| tags: ["v*"] | |
| pull_request: | |
| # run manually against an existing tag (Actions -> CI -> Run workflow, pick the | |
| # tag as the ref) to backfill a GitHub release; PyPI skips already-published files | |
| workflow_dispatch: | |
| 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 | |
| skip-existing: true | |
| # --- 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 | |
| # --- GitHub release on a version tag: the plugin zip + engine wheels, so the | |
| # plugin is downloadable straight from the repository's Releases page --- | |
| github-release: | |
| name: github release | |
| needs: [core-publish, plugin] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: plugin-zip | |
| merge-multiple: true | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/isobenefit_qgis.zip | |
| dist/*.whl | |
| generate_release_notes: true |