forked from crossbario/autobahn-python
-
Notifications
You must be signed in to change notification settings - Fork 0
392 lines (343 loc) · 13.4 KB
/
Copy pathwheels.yml
File metadata and controls
392 lines (343 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
name: wheels
on:
# Build wheels on feature branches and PRs (test only)
push:
branches: ["**"]
pull_request:
branches: [master]
# Publish to GitHub Releases when merged to master
# Publish to PyPI when tagged
workflow_dispatch:
env:
# Ensure uv and just are available in PATH
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ===========================================================
# ⚠️ IMPORTANT NOTES ABOUT "arch" IN GITHUB ACTIONS ⚠️
#
# - GitHub Actions DOES NOT respect `arch:` for runner selection.
# - The *only* thing that decides which CPU architecture you get
# is the `runs-on:` label (e.g. ubuntu-24.04 vs ubuntu-24.04-arm64).
# - Any `arch:` key you see in a matrix is just *your own metadata*.
# It has NO effect on which runner is provisioned. ZERO. ZILCH.
# - This is confusing as hell, because many people expect `arch:`
# to actually request AMD64 vs ARM64, but GitHub silently ignores it.
#
# So: we put `arch:` in here purely for naming artifacts or using
# conditional logic in steps. But the "real" architecture is
# locked in by the value of `runs-on: ${{ matrix.os }}` below.
#
# ===========================================================
# ===========================================================
# 🤦♂️IMPORTANT NOTES ABOUT GITHUB ACTIONS RUNNER AVAILABILITY PAR 🤦♂️
#
# I. GitHub's runner availability is... "special":
#
# ✅ ALWAYS AVAILABLE (Fast, < 30 seconds):
# - ubuntu-* (x86_64) → Abundant, instant
# - windows-* (x86_64) → Reliable, quick
# - macos-15 (ARM64) → Apple Silicon, readily available
#
# 🕐 "PLEASE WAIT FOREVER" ZONE (Often > 1 hour waits):
# - ubuntu-*-arm64 → Limited pool, beta status
# - macos-12/13 (Intel) → Legacy hardware, being phased out
#
# WHY THIS HAPPENS:
# 1. GitHub prioritizes current hardware (ARM64 macOS > Intel macOS)
# 2. ARM64 Linux runners are still beta/limited capacity
# 3. Intel Macs are being phased out of GitHub's fleet
#
# II. There is no built-in way in Actions to auto-cancel a job if it
# stays queued too long waiting for a specific runner label.
#
# “Cancel this job if no runner has picked it up after 2 minutes.”
#
# This is another of those “WTF” gaps in Actions.
# ===========================================================
# --- Linux ---
- os: ubuntu-24.04 # ✅ GitHub-hosted Linux x86_64 (most common, always fast)
platform: linux
arch: x86_64
# --- macOS ---
- os: macos-15 # ✅ GitHub-hosted macOS Apple Silicon (current Macs, fast)
platform: macos
arch: arm64
# --- Windows ---
- os: windows-2022 # ✅ GitHub-hosted Windows x86_64 (mostly fast)
platform: windows
arch: x86_64
# --- Linux ---
# - os: ubuntu-24.04-arm64 # 🕐 Linux ARM64 (servers/edge, often waits forever)
# platform: linux
# arch: arm64
# --- macOS ---
# - os: macos-12 # 🕐 Intel macOS (legacy users, increasingly scarce, often waits forever)
# platform: macos
# arch: x86_64
# --- Windows ---
# ⚠️ GitHub does NOT provide Windows ARM64 hosted runners.
# If you want Windows ARM64 builds, you must either:
# - run a self-hosted Windows ARM64 runner, OR
# - cross-compile from AMD64 to ARM64 inside the workflow.
steps:
- name: Checkout code
uses: actions/checkout@v4
# we use the standard upstream installation on non-broken platforms.
- name: Install Just (Linux/macOS)
if: runner.os != 'Windows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
# we need to use this install wrapper on inheritently broken platforms (windows/powershell).
- name: Install Just (Windows)
if: runner.os == 'Windows'
uses: extractions/setup-just@v3
with:
just-version: "1.42.3"
github-token: ${{ secrets.GITHUB_TOKEN }}
# we use the standard upstream installation on non-broken platforms.
- name: Install uv (Linux/macOS)
if: runner.os != 'Windows'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# we need to use this install wrapper on inheritently broken platforms (windows/powershell).
- name: Install uv (Windows)
if: runner.os == 'Windows'
uses: astral-sh/setup-uv@v6
with:
version: "0.7.19"
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify toolchain installation (Linux/macOS)
if: runner.os != 'Windows'
run: |
just --version
uv --version
shell: bash
- name: Verify toolchain installation (Windows)
if: runner.os == 'Windows'
run: |
just --version
uv --version
shell: pwsh
- name: Setup uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key:
uv-cache-${{ matrix.platform }}-${{ matrix.arch
}}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
uv-cache-${{ matrix.platform }}-${{ matrix.arch }}-
uv-cache-${{ matrix.platform }}-
- name: Build pure Python wheels (Linux only)
if: matrix.platform == 'linux'
run: |
# Build pure Python wheels WITHOUT NVX acceleration
# This provides maximum compatibility across Linux distributions
export AUTOBAHN_USE_NVX=0
just build-all
shell: bash
- name: Build binary wheels with NVX (macOS)
if: matrix.platform == 'macos'
run: |
# Build binary wheels WITH NVX acceleration for macOS
export AUTOBAHN_USE_NVX=1
just build-all
shell: bash
- name: Build binary wheels with NVX (Windows)
if: matrix.platform == 'windows'
run: |
# Build binary wheels WITH NVX acceleration for Windows
$env:AUTOBAHN_USE_NVX = "1"
just build-all
shell: pwsh
- name: List built artifacts (Linux/macOS)
if: runner.os != 'Windows'
run: |
echo "Built wheels:"
ls -la dist/
shell: bash
- name: List built artifacts (Windows)
if: runner.os == 'Windows'
run: |
Write-Host "Built wheels:"
Get-ChildItem dist
shell: pwsh
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform }}-${{ matrix.arch }}
path: dist/*.whl
retention-days: 30
- name: Verify wheels built without NVX (Linux x86_64 only)
if:
matrix.platform == 'linux' && matrix.arch == 'x86_64'
run: |
# Verify that wheels were built without NVX acceleration
echo "==> Wheels built without NVX (should be pure Python or at least NVX-free):"
ls -la dist/*.whl || echo "No wheels found"
echo ""
echo "==> Source distribution:"
ls -la dist/*.tar.gz || echo "No source dist found"
echo ""
echo "==> Wheel count: $(ls dist/*.whl 2>/dev/null | wc -l)"
shell: bash
- name: Upload source distribution (Linux x86_64 only)
if:
matrix.platform == 'linux' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v4
with:
name: source-distribution
path: dist/*.tar.gz
retention-days: 30
- name: Upload Linux wheels without NVX (Linux x86_64 only)
if:
matrix.platform == 'linux' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v4
with:
name: linux-wheels-no-nvx
path: dist/*.whl
retention-days: 30
publish-github-releases:
name: Publish to GitHub Releases
needs: build-wheels
runs-on: ubuntu-latest
if:
github.ref == 'refs/heads/master' && github.event_name ==
'push'
steps:
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist/
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: source-distribution
path: dist/
- name: Download Linux wheels without NVX
uses: actions/download-artifact@v4
with:
name: linux-wheels-no-nvx
path: dist/
- name: List all artifacts
run: |
echo "All built artifacts:"
ls -la dist/
echo ""
echo "Binary wheels (macOS/Windows): $(ls dist/*macos*.whl dist/*win*.whl 2>/dev/null | wc -l)"
echo "Linux wheels (no NVX): $(ls dist/*linux*.whl 2>/dev/null | wc -l)"
echo "Source distributions: $(ls dist/*.tar.gz 2>/dev/null | wc -l)"
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Generate release tag based on timestamp and commit
RELEASE_TAG="wheels-$(date +'%Y%m%d')-${{ github.sha }}"
# Delete existing release if it exists (ignore errors)
gh release delete "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --yes || true
# Create release
gh release create "$RELEASE_TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "Wheels Build - $(date +'%Y-%m-%d')" \
--notes "Automated wheel build from commit ${{ github.sha }}
## Included Platforms
- Linux (x86_64, ARM64)
- macOS (x86_64 Intel, ARM64 Apple Silicon)
- Windows (x86_64)
## Python Versions
- CPython 3.11, 3.12, 3.13, 3.14
- PyPy 3.11
## Installation
Download the appropriate wheel for your platform and install with:
\`\`\`bash
pip install <downloaded-wheel-file>
\`\`\`" \
dist/*
publish-pypi:
name: Publish to PyPI
needs: build-wheels
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
environment:
name: pypi
url: https://pypi.org/p/autobahn
permissions:
id-token: write # For trusted publishing
steps:
- name: Download macOS wheels only
uses: actions/download-artifact@v4
with:
name: wheels-macos-arm64
path: dist/
- name: Download Windows wheels only
uses: actions/download-artifact@v4
with:
name: wheels-windows-x86_64
path: dist/
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: source-distribution
path: dist/
- name: Download Linux wheels without NVX
uses: actions/download-artifact@v4
with:
name: linux-wheels-no-nvx
path: dist/
- name: List artifacts for PyPI (selective publishing)
run: |
echo "Publishing to PyPI (selective - excludes Linux binary wheels):"
ls -la dist/
echo ""
echo "macOS wheels: $(ls dist/*macos*.whl 2>/dev/null | wc -l)"
echo "Windows wheels: $(ls dist/*win*.whl 2>/dev/null | wc -l)"
echo "Linux wheels (fallback, no NVX): $(ls dist/*linux*.whl 2>/dev/null | wc -l)"
echo "Source distributions: $(ls dist/*.tar.gz 2>/dev/null | wc -l)"
echo ""
echo "Total PyPI artifacts: $(ls dist/* | wc -l)"
echo ""
echo "⚠️ NOTE: Linux binary wheels are excluded from PyPI publishing"
echo " but are available from GitHub Releases."
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Uses trusted publishing - no API token needed
# Configure at: https://pypi.org/manage/account/publishing/
verbose: true
publish-rtd:
name: Publish docs to RTD
needs: build-wheels
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Trigger RTD build
env:
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
run: |
if [ -n "$RTD_TOKEN" ]; then
echo "Triggering Read the Docs build for autobahn..."
curl -X POST \
-H "Authorization: Token $RTD_TOKEN" \
"https://readthedocs.org/api/v3/projects/autobahn/versions/latest/builds/"
else
echo "RTD_TOKEN not configured, skipping RTD build trigger"
fi