-
Notifications
You must be signed in to change notification settings - Fork 287
286 lines (253 loc) · 9.25 KB
/
_build_python_wheels.yml
File metadata and controls
286 lines (253 loc) · 9.25 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# .github/workflows/_build_python_wheels.yml
name: _build_python_wheels
on:
workflow_call:
inputs:
version:
type: string
required: false
default: ""
upload_artifacts:
type: boolean
required: false
default: true
use_latest_ci:
type: boolean
required: false
default: true
description: "Use latest CI configuration and scripts from master branch"
commit:
type: string
required: false
default: ""
description: "Specific commit to checkout for building wheels"
outputs:
artifact_name:
description: "Name of the uploaded artifact containing wheels"
value: ${{ jobs.collect.outputs.artifact_name }}
jobs:
linux:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- target: x86_64
runner: ubuntu-latest
manylinux: 2_34
- target: x86_64
runner: ubuntu-latest
manylinux: musllinux_1_2
- target: aarch64
runner: ubuntu-24.04-arm
manylinux: auto
- target: aarch64
runner: ubuntu-24.04-arm
manylinux: musllinux_1_2
steps:
- name: Download latest copy script from master
if: inputs.use_latest_ci
run: |
curl -sSL "https://raw.githubusercontent.com/${{ github.repository }}/master/scripts/copy-latest-from-master.sh" \
-o /tmp/copy-latest-from-master.sh
chmod +x /tmp/copy-latest-from-master.sh
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- name: Save and apply latest CI from master
if: inputs.use_latest_ci
run: |
/tmp/copy-latest-from-master.sh save .github scripts
/tmp/copy-latest-from-master.sh apply
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Rust with cache
uses: ./.github/actions/utils/setup-rust-with-cache
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
working-directory: foreign/python
before-script-linux: |
# manylinux_2_28 uses yum, not dnf
if command -v dnf &> /dev/null; then
dnf install -y perl-IPC-Cmd
elif command -v yum &> /dev/null; then
yum install -y perl-IPC-Cmd
fi
manylinux: ${{ matrix.manylinux }}
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13
sccache: "true"
- name: Upload wheels
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}-${{ matrix.manylinux }}
path: foreign/python/dist
retention-days: 7
macos:
runs-on: ${{ matrix.target == 'x86_64' && 'macos-15-intel' || 'macos-15' }}
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- name: Download latest copy script from master
if: inputs.use_latest_ci
run: |
curl -sSL "https://raw.githubusercontent.com/${{ github.repository }}/master/scripts/copy-latest-from-master.sh" \
-o /tmp/copy-latest-from-master.sh
chmod +x /tmp/copy-latest-from-master.sh
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- name: Save and apply latest CI from master
if: inputs.use_latest_ci
run: |
/tmp/copy-latest-from-master.sh save .github scripts
/tmp/copy-latest-from-master.sh apply
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
working-directory: foreign/python
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13
sccache: "true"
- name: Upload wheels
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: foreign/python/dist
retention-days: 7
windows:
if: false # TODO(hubcio): temporarily disabled
runs-on: windows-latest
steps:
- name: Download latest copy script from master
if: inputs.use_latest_ci
shell: bash
run: |
curl -sSL "https://raw.githubusercontent.com/${{ github.repository }}/master/scripts/copy-latest-from-master.sh" \
-o /tmp/copy-latest-from-master.sh
chmod +x /tmp/copy-latest-from-master.sh
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- name: Save and apply latest CI from master
if: inputs.use_latest_ci
shell: bash
run: |
/tmp/copy-latest-from-master.sh save .github scripts
/tmp/copy-latest-from-master.sh apply
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
architecture: x64
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: x86_64
working-directory: foreign/python
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13
sccache: "true"
- name: Upload wheels
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-windows-x64
path: foreign/python/dist
retention-days: 7
sdist:
runs-on: ubuntu-latest
steps:
- name: Download latest copy script from master
if: inputs.use_latest_ci
run: |
curl -sSL "https://raw.githubusercontent.com/${{ github.repository }}/master/scripts/copy-latest-from-master.sh" \
-o /tmp/copy-latest-from-master.sh
chmod +x /tmp/copy-latest-from-master.sh
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- name: Save and apply latest CI from master
if: inputs.use_latest_ci
run: |
/tmp/copy-latest-from-master.sh save .github scripts
/tmp/copy-latest-from-master.sh apply
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
working-directory: foreign/python
args: --out dist
- name: Upload sdist
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: foreign/python/dist
retention-days: 7
collect:
name: Collect all wheels
needs: [linux, macos, sdist] # TODO(hubcio): add windows back when re-enabled
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
outputs:
artifact_name: ${{ steps.output.outputs.artifact_name }}
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: List wheels
run: |
echo "## 📦 Built Python Wheels" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Platform | Architecture | File |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-------------|------|" >> $GITHUB_STEP_SUMMARY
for wheel in dist/*.whl; do
filename=$(basename "$wheel")
if [[ "$filename" == *"linux"* ]]; then platform="Linux"
elif [[ "$filename" == *"macosx"* ]]; then platform="macOS"
elif [[ "$filename" == *"win"* ]]; then platform="Windows"
else platform="Universal"; fi
if [[ "$filename" == *"x86_64"* ]] || [[ "$filename" == *"amd64"* ]]; then arch="x86_64"
elif [[ "$filename" == *"aarch64"* ]] || [[ "$filename" == *"arm64"* ]]; then arch="arm64"
elif [[ "$filename" == *"i686"* ]]; then arch="x86"
else arch="any"; fi
echo "| $platform | $arch | \`$filename\` |" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Total wheels built:** $(ls -1 dist/*.whl | wc -l)" >> $GITHUB_STEP_SUMMARY
- name: Upload combined artifact
uses: actions/upload-artifact@v4
with:
name: python-wheels-all
path: dist
retention-days: 30
- id: output
run: echo "artifact_name=python-wheels-all" >> $GITHUB_OUTPUT