-
Notifications
You must be signed in to change notification settings - Fork 8
409 lines (350 loc) · 13.4 KB
/
build-wheels-defined.yml
File metadata and controls
409 lines (350 loc) · 13.4 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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
name: defined-wheels
on:
workflow_dispatch:
inputs:
packages:
description: >
Generate wheels for given packages separated by space.
Requirement specifiers and markers can be used.
For example esptool~=4.5 esp-coredump~=1.2;sys_platform!='win32'
type: string
required: true
os_ubuntu_latest:
description: Build on ubuntu-latest(x86_64)
type: boolean
required: false
default: true
os_windows_latest:
description: Build on windows-latest(x86_64)
type: boolean
required: false
default: true
os_macos_latest:
description: Build on macos-latest(x86_64)
type: boolean
required: false
default: true
os_macos_arm64:
description: Build on macos M1(aarch64)
type: boolean
required: false
default: true
os_linux_armv7:
description: Build on linux armv7(aarch32)
type: boolean
required: false
default: true
os_linux_arm64:
description: Build on linux arm64(aarch64)
type: boolean
required: false
default: true
os_linux_armv7_legacy:
description: Build on linux armv7 legacy (bullseye, glibc 2.31)
type: boolean
required: false
default: false
env:
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
jobs:
get-supported-versions:
name: Get Supported Versions
uses: ./.github/workflows/get-supported-versions.yml
secrets: inherit
ubuntu-latest:
needs: get-supported-versions
name: linux x86_64
if: ${{ inputs.os_ubuntu_latest }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version}}
- name: Get Python version
run: |
python --version
python -m pip install --upgrade pip
- name: Install build dependencies
run: python -m pip install -r build_requirements.txt
- name: Install additional OS dependencies - Ubuntu
run: os_dependencies/ubuntu.sh
- name: Build wheels
run: |
python build_wheels_from_file.py --requirements ${{ inputs.packages }}
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels
windows-latest:
needs: get-supported-versions
name: windows x86_64
if: ${{ inputs.os_windows_latest }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version}}
- name: Get Python version
run: |
python --version
python -m pip install --upgrade pip
- name: Install build dependencies
run: python -m pip install -r build_requirements.txt
- name: Install additional OS dependencies - Windows
run: powershell -ExecutionPolicy Bypass -File os_dependencies/windows.ps1
- name: Build wheels
run: |
python build_wheels_from_file.py --requirements ${{ inputs.packages }}
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-windows-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels
macos-latest:
needs: get-supported-versions
name: macos x86_64
if: ${{ inputs.os_macos_latest }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version}}
- name: Get Python version
run: |
python --version
python -m pip install --upgrade pip
- name: Install build dependencies
run: python -m pip install -r build_requirements.txt
- name: Install additional OS dependencies - MacOS
run: os_dependencies/macos.sh
- name: Build wheels
env:
ARCHFLAGS: "-arch x86_64" # Force x86_64-only wheels, not universal2
run: |
python build_wheels_from_file.py --requirements ${{ inputs.packages }}
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-macos-x86_64-${{ matrix.python-version }}
path: ./downloaded_wheels
macos-m1:
needs: get-supported-versions
name: macos arm64
if: ${{ inputs.os_macos_arm64 }}
runs-on: macos-latest-xlarge # MacOS M1 GitHub beta runner - paid $0.16
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
# Temporary solution until Python version for build will be >= 3.10 (GitHub action support)
if: matrix.python-version >= '3.10'
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python - MacOS M1
# Temporary solution until Python version for build will be >= 3.10 (GitHub action support)
if: matrix.python-version < '3.10'
run: |
brew install python@${{ matrix.python-version }}
# change python symlink called with default command 'python'
ln -s -f /opt/homebrew/bin/python${{ matrix.python-version }} /usr/local/bin/python
- name: Get Python version
run: |
python --version
python -m pip install --upgrade pip
- name: Install build dependencies
run: python -m pip install -r build_requirements.txt
- name: Install additional OS dependencies - MacOS
run: os_dependencies/macos.sh
- name: Build wheels
env:
ARCHFLAGS: "-arch arm64" # Force arm64-only wheels, not universal2
run: |
python build_wheels_from_file.py --requirements ${{ inputs.packages }}
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-macos-arm64-${{ matrix.python-version }}
path: ./downloaded_wheels
linux-armv7:
needs: get-supported-versions
name: linux aarch32 (armv7)
if: ${{ inputs.os_linux_armv7 }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
steps:
- name: Set up QEMU for ARMv7
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7
- name: Checkout repository
uses: actions/checkout@v4
- name: Build wheels - ARMv7 (in Docker)
run: |
docker run --rm --platform linux/arm/v7 \
-v $(pwd):/work \
-w /work \
-e GH_TOKEN="${GH_TOKEN}" \
-e PIP_NO_CACHE_DIR=1 \
python:${{ matrix.python-version }}-bookworm \
bash -c "
set -e
python --version
# Install pip packages without cache to reduce memory usage
python -m pip install --no-cache-dir --upgrade pip
python -m pip install --no-cache-dir -r build_requirements.txt
bash os_dependencies/linux_arm.sh
# Source Rust environment after installation
. \$HOME/.cargo/env
python build_wheels_from_file.py --requirements '${{ inputs.packages }}'
"
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-armv7-${{ matrix.python-version }}
path: ./downloaded_wheels
linux-arm64:
needs: get-supported-versions
name: linux aarch64 (arm64)
if: ${{ inputs.os_linux_arm64 }}
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
container: python:${{ matrix.python-version }}-bookworm
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Python version
run: |
python --version
python -m pip install --upgrade pip
- name: Install build dependencies
run: python -m pip install -r build_requirements.txt
- name: Install additional OS dependencies - Linux ARM
run: sudo bash os_dependencies/linux_arm.sh
- name: Build wheels
run: |
python build_wheels_from_file.py --requirements ${{ inputs.packages }}
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-arm64-${{ matrix.python-version }}
path: ./downloaded_wheels
linux-armv7-legacy:
needs: get-supported-versions
name: linux aarch32 (armv7 legacy)
if: ${{ inputs.os_linux_armv7_legacy }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.get-supported-versions.outputs.supported_python) }}
exclude:
# Python 3.14 doesn't have bullseye images for ARM
- python-version: '3.14'
steps:
- name: Set up QEMU for ARMv7
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7
- name: Checkout repository
uses: actions/checkout@v4
- name: Build wheels - ARMv7 Legacy (in Docker)
# Build on Bullseye (glibc 2.31) for compatibility with older systems
run: |
docker run --rm --platform linux/arm/v7 \
-v $(pwd):/work \
-w /work \
-e GH_TOKEN="${GH_TOKEN}" \
-e PIP_NO_CACHE_DIR=1 \
python:${{ matrix.python-version }}-bullseye \
bash -c "
set -e
python --version
# Install pip packages without cache to reduce memory usage
python -m pip install --no-cache-dir --upgrade pip
python -m pip install --no-cache-dir -r build_requirements.txt
bash os_dependencies/linux_arm.sh
# Source Rust environment after installation
. \$HOME/.cargo/env
python build_wheels_from_file.py --requirements '${{ inputs.packages }}'
"
- name: Upload artifacts of downloaded_wheels directory
uses: actions/upload-artifact@v4
with:
name: wheels-download-directory-linux-armv7legacy-${{ matrix.python-version }}
path: ./downloaded_wheels
# Repair wheels for dynamically linked libraries on all platforms
# https://github.com/espressif/idf-python-wheels/blob/main/README.md#universal-wheel-tag---linking-of-dynamic-libraries
repair-wheels:
if: ${{ always() }}
needs: [get-supported-versions, ubuntu-latest, windows-latest, macos-latest, macos-m1, linux-armv7, linux-arm64, linux-armv7-legacy]
name: Repair wheels
uses: ./.github/workflows/wheels-repair.yml
upload-python-wheels:
if: ${{ always() }}
needs: [get-supported-versions, repair-wheels]
name: Upload Python wheels
uses: ./.github/workflows/upload-python-wheels.yml
with:
supported_python_versions: ${{ needs.get-supported-versions.outputs.supported_python }}
secrets: inherit
verify-s3-wheels:
if: ${{ always() }}
needs: [get-supported-versions, upload-python-wheels]
name: Verify S3 wheels against exclude list
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest Python version
id: python-version
run: |
VERSIONS='${{ needs.get-supported-versions.outputs.supported_python }}'
LATEST=$(echo "$VERSIONS" | jq -r '.[0]')
echo "version=$LATEST" >> $GITHUB_OUTPUT
- name: Setup Python ${{ steps.python-version.outputs.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ steps.python-version.outputs.version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r build_requirements.txt
- name: Verify S3 wheels
run: python verify_s3_wheels.py ${{ secrets.DL_BUCKET }} ${{ needs.get-supported-versions.outputs.oldest_supported_python }} '${{ needs.get-supported-versions.outputs.supported_python }}'