-
Notifications
You must be signed in to change notification settings - Fork 0
356 lines (298 loc) · 11.6 KB
/
Copy pathbuild-wheels.yml
File metadata and controls
356 lines (298 loc) · 11.6 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
# TraceSmith - Multi-platform Build & Release Workflow
# Builds wheels for Linux, macOS (Intel/ARM), Windows
# Supports CUDA, Metal, ROCm backends
name: Build & Release
on:
push:
tags:
- 'v*'
pull_request:
branches: [main]
workflow_dispatch:
inputs:
publish_pypi:
description: 'Publish to PyPI'
required: false
default: 'false'
type: boolean
env:
CIBUILDWHEEL_VERSION: "2.16.2"
jobs:
# ===========================================================================
# Build Source Distribution
# ===========================================================================
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# ===========================================================================
# Build Linux Wheels (x86_64, with optional CUDA)
# ===========================================================================
build_linux_x86_64:
name: Build Linux x86_64 wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install cibuildwheel
run: pip install cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Build wheels
env:
CIBW_BUILD: "${{ matrix.python }}-manylinux_x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: |
yum install -y epel-release
yum install -y cmake3 ninja-build libunwind-devel
ln -sf /usr/bin/cmake3 /usr/local/bin/cmake
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=4
CIBW_TEST_COMMAND: |
python -c "import tracesmith; print(tracesmith.__version__)"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-x86_64-${{ matrix.python }}
path: ./wheelhouse/*.whl
# ===========================================================================
# Build Linux Wheels with CUDA
# ===========================================================================
build_linux_cuda:
name: Build Linux CUDA wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["cp310", "cp311", "cp312"]
cuda: ["11.8", "12.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install cibuildwheel
run: pip install cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Build CUDA wheels
env:
CIBW_BUILD: "${{ matrix.python }}-manylinux_x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: |
# Install CUDA toolkit
yum install -y epel-release
yum install -y cmake3 ninja-build libunwind-devel wget
ln -sf /usr/bin/cmake3 /usr/local/bin/cmake
# Install CUDA ${{ matrix.cuda }}
if [ "${{ matrix.cuda }}" = "11.8" ]; then
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm
rpm -i cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm || true
yum install -y cuda-toolkit-11-8 --nogpgcheck || true
else
wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-rhel7-12-1-local-12.1.0_530.30.02-1.x86_64.rpm
rpm -i cuda-repo-rhel7-12-1-local-12.1.0_530.30.02-1.x86_64.rpm || true
yum install -y cuda-toolkit-12-1 --nogpgcheck || true
fi
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=4
TRACESMITH_CUDA=1
CUDA_HOME=/usr/local/cuda
PATH=/usr/local/cuda/bin:$PATH
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair -w {dest_dir} {wheel} --exclude libcuda.so.1 --exclude libnvidia-ml.so.1
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-cuda${{ matrix.cuda }}-${{ matrix.python }}
path: ./wheelhouse/*.whl
# ===========================================================================
# Build macOS Wheels (Intel x86_64)
# ===========================================================================
build_macos_x86_64:
name: Build macOS x86_64 wheels
runs-on: macos-13 # Intel Mac
strategy:
fail-fast: false
matrix:
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
brew install cmake ninja
pip install cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Build wheels
env:
CIBW_BUILD: "${{ matrix.python }}-macosx_x86_64"
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=4
TRACESMITH_METAL=1
MACOSX_DEPLOYMENT_TARGET=10.15
CIBW_TEST_COMMAND: |
python -c "import tracesmith; print(tracesmith.__version__)"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-x86_64-${{ matrix.python }}
path: ./wheelhouse/*.whl
# ===========================================================================
# Build macOS Wheels (Apple Silicon ARM64)
# ===========================================================================
build_macos_arm64:
name: Build macOS ARM64 wheels
runs-on: macos-14 # Apple Silicon
strategy:
fail-fast: false
matrix:
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
brew install cmake ninja
pip install cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Build wheels
env:
CIBW_BUILD: "${{ matrix.python }}-macosx_arm64"
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=4
TRACESMITH_METAL=1
MACOSX_DEPLOYMENT_TARGET=11.0
CIBW_TEST_COMMAND: |
python -c "import tracesmith; print(tracesmith.__version__)"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-arm64-${{ matrix.python }}
path: ./wheelhouse/*.whl
# ===========================================================================
# Build Windows Wheels
# ===========================================================================
build_windows:
name: Build Windows wheels
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
pip install cibuildwheel==${{ env.CIBUILDWHEEL_VERSION }}
- name: Build wheels
env:
CIBW_BUILD: "${{ matrix.python }}-win_amd64"
CIBW_ENVIRONMENT: |
CMAKE_BUILD_PARALLEL_LEVEL=4
CIBW_TEST_COMMAND: |
python -c "import tracesmith; print(tracesmith.__version__)"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.python }}
path: ./wheelhouse/*.whl
# ===========================================================================
# Publish to PyPI
# ===========================================================================
publish:
name: Publish to PyPI
needs: [build_sdist, build_linux_x86_64, build_macos_x86_64, build_macos_arm64, build_windows]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List artifacts
run: ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# For test PyPI, uncomment below:
# repository-url: https://test.pypi.org/legacy/
# ===========================================================================
# Create GitHub Release
# ===========================================================================
release:
name: Create GitHub Release
needs: [build_sdist, build_linux_x86_64, build_linux_cuda, build_macos_x86_64, build_macos_arm64, build_windows]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: TraceSmith v${{ steps.version.outputs.VERSION }}
draft: false
prerelease: false
files: |
dist/*.whl
dist/*.tar.gz
body: |
## TraceSmith v${{ steps.version.outputs.VERSION }}
### Installation
```bash
# Standard installation
pip install tracesmith==${{ steps.version.outputs.VERSION }}
# With CUDA 12.x support
pip install tracesmith[cuda12]==${{ steps.version.outputs.VERSION }}
# With CUDA 11.x support
pip install tracesmith[cuda11]==${{ steps.version.outputs.VERSION }}
```
### Supported Platforms
| Platform | Python | Backend |
|----------|--------|---------|
| Linux x86_64 | 3.9-3.12 | CPU, CUDA 11.8, CUDA 12.1 |
| macOS x86_64 | 3.9-3.12 | CPU, Metal |
| macOS ARM64 | 3.9-3.12 | CPU, Metal |
| Windows x64 | 3.9-3.12 | CPU |
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.