-
Notifications
You must be signed in to change notification settings - Fork 26
171 lines (144 loc) · 5.22 KB
/
Copy pathpynumaflow-lite.yml
File metadata and controls
171 lines (144 loc) · 5.22 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: pynumaflow-lite
on:
push:
branches: ["main", "release/*"]
paths:
- "packages/pynumaflow-lite/**"
- ".github/workflows/pynumaflow-lite.yml"
pull_request:
branches: ["main", "release/*"]
paths:
- "packages/pynumaflow-lite/**"
- ".github/workflows/pynumaflow-lite.yml"
permissions:
contents: read
jobs:
lint:
name: Format, lint, and test
runs-on: ubuntu-24.04
defaults:
run:
working-directory: packages/pynumaflow-lite
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: "3.10"
working-directory: packages/pynumaflow-lite
- name: Set up Rust
run: |
rustup toolchain install stable --profile minimal --component clippy --component rustfmt
rustup default stable
- name: Install dependencies
run: uv sync --group dev
- name: Check Rust formatting
run: cargo fmt --all --check
- name: Check Python formatting
run: uv run ruff format --check pynumaflow_lite/ tests/ manifests/
- name: Ruff lint
run: uv run ruff check .
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::module_inception
- name: Run tests for Python versions
shell: bash
run: |
set -euo pipefail
for python_version in 3.10 3.11 3.12 3.13 3.14; do
echo "::group::Python ${python_version}"
uv python install "${python_version}"
uv sync --group dev --python "${python_version}"
uv pip install --python "${python_version}" "maturin>=1.14,<2.0"
uv run --python "${python_version}" maturin develop
uv run --python "${python_version}" pytest -v
export PYTHONHOME="$(uv run --python "${python_version}" python -c 'import sys; print(sys.base_prefix)')"
cargo test
unset PYTHONHOME
echo "::endgroup::"
done
build-wheels:
name: Build wheel ${{ matrix.platform.artifact }} py${{ matrix.python-version }}
needs: lint
runs-on: ${{ matrix.platform.os }}
defaults:
run:
working-directory: packages/pynumaflow-lite
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
artifact: linux-x86_64
manylinux: "2014"
linux: true
- os: macos-15
target: aarch64-apple-darwin
artifact: macos-aarch64
manylinux: "off"
linux: false
- os: windows-2025
target: x86_64-pc-windows-msvc
artifact: windows-x86_64
manylinux: "off"
linux: false
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}
working-directory: packages/pynumaflow-lite
- name: Set up Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Install dependencies
run: |
uv sync --group dev --python ${{ matrix.python-version }}
uv pip install --python ${{ matrix.python-version }} "maturin>=1.14,<2.0"
- name: Install extension
run: uv run --python ${{ matrix.python-version }} maturin develop
- name: Run Python tests
if: runner.os != 'Windows'
run: uv run --python ${{ matrix.python-version }} pytest -v
- name: Run Rust tests
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
export PYTHONHOME="$(uv run --python ${{ matrix.python-version }} python -c 'import sys; print(sys.base_prefix)')"
cargo test
- name: Run Windows smoke test
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
uv run --python ${{ matrix.python-version }} python -c "import pynumaflow_lite; from pynumaflow_lite import mapper; print('pynumaflow-lite import ok')"
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
command: build
working-directory: packages/pynumaflow-lite
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux }}
args: >-
--release
--out dist
-i ${{ matrix.platform.linux && format('python{0}', matrix.python-version) || 'python' }}
- name: Upload wheel artifact
uses: actions/upload-artifact@v7
with:
name: pynumaflow-lite-${{ matrix.platform.artifact }}-py${{ matrix.python-version }}
path: packages/pynumaflow-lite/dist/*.whl
if-no-files-found: error
compression-level: 0