-
Notifications
You must be signed in to change notification settings - Fork 8
221 lines (201 loc) · 8.18 KB
/
wheels-repair.yml
File metadata and controls
221 lines (201 loc) · 8.18 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
name: repair-wheels
# Repairs 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
# - Windows: delvewheel (bundles DLLs)
# - macOS: delocate (bundles dylibs)
# - Linux: auditwheel (bundles SOs)
on:
workflow_call:
jobs:
repair-wheels:
name: Repair ${{ matrix.platform }} wheels
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
platform:
- Windows
- macOS ARM
- macOS Intel
- Linux x86_64
- Linux ARM64
- Linux ARMv7
- Linux ARMv7 Legacy
include:
- platform: Windows
runner: windows-latest
tool: delvewheel
arch: windows-x86_64
- platform: macOS ARM
runner: macos-latest
tool: delocate
arch: macos-arm64
- platform: macOS Intel
runner: macos-15-intel
tool: delocate
arch: macos-x86_64
- platform: Linux x86_64
runner: ubuntu-latest
tool: auditwheel
manylinux_platform: manylinux_2_34_x86_64
arch: linux-x86_64
- platform: Linux ARM64
runner: ubuntu-latest
tool: auditwheel
manylinux_platform: manylinux_2_34_aarch64
setup_qemu: true
qemu_platform: arm64
docker_platform: linux/arm64
arch: linux-arm64
- platform: Linux ARMv7
runner: ubuntu-latest
tool: auditwheel
manylinux_platform: idf-python-wheels-armv7l
docker_image: ghcr.io/espressif/github-esp-dockerfiles/idf-python-wheels-armv7l:v1
setup_qemu: true
qemu_platform: arm
docker_platform: linux/arm/v7
arch: linux-armv7
- platform: Linux ARMv7 Legacy
runner: ubuntu-latest
tool: auditwheel
manylinux_platform: idf-python-wheels-armv7l-legacy
docker_image: ghcr.io/espressif/github-esp-dockerfiles/idf-python-wheels-armv7l-legacy:v1
setup_qemu: true
qemu_platform: arm
docker_platform: linux/arm/v7
arch: linux-armv7legacy
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download wheel artifacts
uses: actions/download-artifact@v4
with:
# Download only artifacts for this specific architecture to avoid mixing wheels
# (especially important for ARMv7 vs ARMv7 Legacy which produce same-named wheels)
pattern: wheels-download-directory-${{ matrix.arch }}-*
path: ./downloaded_wheels
merge-multiple: true
- name: Check for wheels
id: check-wheels
run: |
if [ -d "./downloaded_wheels" ] && [ -n "$(find ./downloaded_wheels -name '*.whl' 2>/dev/null)" ]; then
echo "has_wheels=true" >> $GITHUB_OUTPUT
echo "Found wheels to repair"
else
echo "has_wheels=false" >> $GITHUB_OUTPUT
echo "No wheels found for ${{ matrix.platform }} - skipping repair"
fi
shell: bash
- name: Setup Python
if: steps.check-wheels.outputs.has_wheels == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up QEMU
if: matrix.setup_qemu && steps.check-wheels.outputs.has_wheels == 'true'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.qemu_platform }}
- name: Install repair tool - Windows
if: matrix.tool == 'delvewheel' && steps.check-wheels.outputs.has_wheels == 'true'
run: python -m pip install delvewheel
- name: Install repair tool - macOS
if: matrix.tool == 'delocate' && steps.check-wheels.outputs.has_wheels == 'true'
run: python -m pip install delocate
- name: Install OS dependencies - macOS
if: matrix.tool == 'delocate' && steps.check-wheels.outputs.has_wheels == 'true'
run: bash os_dependencies/macos.sh
- name: Install dependencies and repair - Windows/macOS
if: matrix.tool != 'auditwheel' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
python -m pip install -r build_requirements.txt
python repair_wheels.py
- name: Repair Linux x86_64 wheels in manylinux container
if: matrix.platform == 'Linux x86_64' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
-v $(pwd):/work \
-w /work \
quay.io/pypa/${{ matrix.manylinux_platform }} \
bash -c "
bash os_dependencies/manylinux.sh
python3 -m ensurepip --default-pip || curl -sS https://bootstrap.pypa.io/get-pip.py | python3
python3 -m pip install --upgrade pip
python3 -m pip install --ignore-installed -r build_requirements.txt
python3 repair_wheels.py
"
- name: Repair Linux ARM64 wheels in manylinux container
if: matrix.platform == 'Linux ARM64' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
-v $(pwd):/work \
-w /work \
quay.io/pypa/${{ matrix.manylinux_platform }} \
bash -c "
bash os_dependencies/manylinux.sh
python3 -m ensurepip --default-pip || curl -sS https://bootstrap.pypa.io/get-pip.py | python3
python3 -m pip install --upgrade pip
python3 -m pip install --ignore-installed -r build_requirements.txt
python3 repair_wheels.py
"
- name: Repair Linux ARMv7 wheels in manylinux container
# Using --break-system-packages and --ignore-installed to avoid conflicts with system packages
if: matrix.platform == 'Linux ARMv7' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
-v $(pwd):/work \
-w /work \
${{ matrix.docker_image }} \
bash -c "
bash os_dependencies/linux_arm.sh
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages --ignore-installed -r build_requirements.txt
python3 repair_wheels.py
"
- name: Repair Linux ARMv7 Legacy wheels in manylinux container
# Using --break-system-packages and --ignore-installed to avoid conflicts with system packages
if: matrix.platform == 'Linux ARMv7 Legacy' && steps.check-wheels.outputs.has_wheels == 'true'
run: |
docker run --rm \
--platform ${{ matrix.docker_platform }} \
-v $(pwd):/work \
-w /work \
${{ matrix.docker_image }} \
bash -c "
bash os_dependencies/linux_arm.sh
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages --ignore-installed -r build_requirements.txt
python3 repair_wheels.py
"
- name: Re-upload artifacts with repaired wheels
if: steps.check-wheels.outputs.has_wheels == 'true'
uses: actions/upload-artifact@v4
with:
name: wheels-repaired-${{ matrix.arch }}
path: ./downloaded_wheels
overwrite: true
retention-days: 1
merge-all-wheels:
name: Merge all repaired wheels
needs: repair-wheels
runs-on: ubuntu-latest
steps:
- name: Download all repaired wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-repaired-*
path: ./all_wheels
merge-multiple: true
- name: List merged wheels
run: |
echo "Total merged wheels:"
find ./all_wheels -name "*.whl" | wc -l
- name: Upload merged wheels
uses: actions/upload-artifact@v4
with:
name: wheels-repaired-all
path: ./all_wheels
retention-days: 1