-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (142 loc) · 4.61 KB
/
Copy pathci.yml
File metadata and controls
150 lines (142 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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