-
Notifications
You must be signed in to change notification settings - Fork 39
166 lines (138 loc) · 4.5 KB
/
publish.yml
File metadata and controls
166 lines (138 loc) · 4.5 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
name: Build and Publish
on:
release:
types: [published]
permissions:
contents: read
jobs:
# Build wheels on Linux using manylinux containers
build-linux:
name: Build Linux ${{ matrix.arch }} wheels
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
strategy:
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
artifact: wheels-linux-x86_64
- arch: aarch64
runner: ubuntu-24.04-arm
container: quay.io/pypa/manylinux_2_28_aarch64
artifact: wheels-linux-aarch64
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: dnf install -y openssl-devel perl-IPC-Cmd openblas-devel
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install maturin
run: /opt/python/cp312-cp312/bin/pip install maturin
- name: Build wheels
run: |
expected=0
for pyver in 39 310 311 312 313 314; do
pybin="/opt/python/cp${pyver}-cp${pyver}/bin/python"
if [ ! -f "$pybin" ]; then
echo "ERROR: Expected Python interpreter not found: $pybin"
exit 1
fi
/opt/python/cp312-cp312/bin/maturin build --release --out dist -i "$pybin" --features extension-module,openblas
expected=$((expected + 1))
done
actual=$(ls dist/*.whl 2>/dev/null | wc -l)
echo "Built $actual wheels (expected $expected)"
if [ "$actual" -ne "$expected" ]; then
echo "ERROR: Expected $expected wheels but found $actual"
exit 1
fi
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: dist/*.whl
# Build wheels on macOS ARM64 (native build)
# Note: macOS x86_64 skipped - Intel runners retired, users can install from sdist
build-macos-arm:
name: Build macOS ARM64 wheels
runs-on: macos-14
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install maturin
run: pip install maturin
- name: Build wheel
run: maturin build --release --out dist --features extension-module,accelerate
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-macos-arm64-py${{ matrix.python-version }}
path: dist/*.whl
# Build wheels on Windows
build-windows:
name: Build Windows wheels
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install maturin
run: pip install maturin
- name: Build wheel
run: maturin build --release --out dist --features extension-module
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-windows-py${{ matrix.python-version }}
path: dist/*.whl
# Build source distribution
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install maturin
run: pip install maturin
- name: Build sdist
run: maturin sdist --out dist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
# Publish to PyPI
publish:
name: Publish to PyPI
needs: [build-linux, build-macos-arm, build-windows, build-sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1