-
Notifications
You must be signed in to change notification settings - Fork 764
801 lines (711 loc) · 33.1 KB
/
wheels.yml
File metadata and controls
801 lines (711 loc) · 33.1 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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
name: wheels
on:
# Build wheels on feature branches and PRs (test only)
push:
branches: ["**"]
tags:
- 'v*'
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:
identifiers:
# GitHub needs to know where .cicd/workflows/identifiers.yml lives at parse time,
# and submodules aren't included in that context! thus the following does NOT work:
# uses: ./.cicd/workflows/identifiers.yml
# we MUST reference the remote repo directly:
uses: wamp-proto/wamp-cicd/.github/workflows/identifiers.yml@main
# IMPORTANT: we still need .cicd as a Git submodule in the using repo though!
# because e.g. identifiers.yml wants to access scripts/sanitize.sh !
build-wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
needs: identifiers
runs-on: ${{ matrix.os }}
env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
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
with:
submodules: recursive
# 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
# skip broken platform ("Error: The template is not valid. .github/workflows/wheels.yml (Line: 182, Col: 13):
# hashFiles('pyproject.toml') failed. Fail to hash files under directory '/Users/runner/work/autobahn-python/autobahn-python'")
if: matrix.platform != 'macos'
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 source distribution (Linux x86_64 only)
if: matrix.platform == 'linux' && matrix.arch == 'x86_64'
run: |
# Build source distribution (only once, on Linux x86_64)
# Source distributions are platform-independent
just build-sourcedist
shell: bash
- name: Force file system sync (post-build, pre-validation) - Linux
if: matrix.platform == 'linux'
run: |
echo "======================================================================"
echo "==> Forcing File System Sync (Post-Build)"
echo "======================================================================"
echo ""
echo "Flushing all file system buffers to disk to ensure wheels are fully"
echo "written before validation and checksumming."
echo ""
sync
echo "✅ All buffers flushed to disk"
echo ""
shell: bash
- name: Validate wheels integrity (Linux only)
if: matrix.platform == 'linux'
run: |
set -o pipefail
echo "======================================================================"
echo "==> Validating Wheel Integrity (Fail Fast)"
echo "======================================================================"
echo ""
echo "Installing twine for validation..."
# Use --break-system-packages for consistency (safe in CI)
python3 -m pip install --break-system-packages git+https://github.com/pypa/packaging.git
python3 -m pip install --break-system-packages git+https://github.com/pypa/twine.git
echo ""
echo "==> Validation environment:"
echo "Python: $(python3 --version)"
echo "twine: $(twine --version)"
echo ""
# Initialize validation output file
VALIDATION_FILE="dist/VALIDATION.txt"
echo "Wheel Validation Results - Build Time (wheels workflow)" > "$VALIDATION_FILE"
echo "=========================================================" >> "$VALIDATION_FILE"
echo "" >> "$VALIDATION_FILE"
echo "Validation Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> "$VALIDATION_FILE"
echo "Platform: Linux (pure Python, no NVX)" >> "$VALIDATION_FILE"
echo "Python: $(python3 --version)" >> "$VALIDATION_FILE"
echo "twine: $(twine --version)" >> "$VALIDATION_FILE"
echo "" >> "$VALIDATION_FILE"
HAS_ERRORS=0
for wheel in dist/*.whl; do
if [ ! -f "$wheel" ]; then
echo "⚠️ No wheels found in dist/"
continue
fi
WHEEL_NAME=$(basename "$wheel")
echo "==> Validating: $WHEEL_NAME"
echo "" >> "$VALIDATION_FILE"
echo "Wheel: $WHEEL_NAME" >> "$VALIDATION_FILE"
echo "---" >> "$VALIDATION_FILE"
# Test 1: ZIP integrity
echo " [1/3] ZIP integrity test..."
if unzip -t "$wheel" > /dev/null 2>&1; then
echo " ✅ ZIP test PASS"
echo " ZIP test: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ ZIP test FAIL - wheel is corrupted!"
echo " ZIP test: FAIL - wheel is corrupted!" >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
# Test 2: Python zipfile module
echo " [2/3] Python zipfile test..."
if python3 -m zipfile -t "$wheel" > /dev/null 2>&1; then
echo " ✅ Python zipfile test PASS"
echo " Python zipfile test: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ Python zipfile test FAIL - wheel is corrupted!"
echo " Python zipfile test: FAIL - wheel is corrupted!" >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
# Test 3: twine check
echo " [3/3] Twine validation..."
twine check "$wheel" 2>&1 | tee /tmp/twine_output.txt
TWINE_EXIT=${PIPESTATUS[0]}
if [ "$TWINE_EXIT" -eq 0 ] && ! grep -Eqi "ERROR|FAILED|InvalidDistribution" /tmp/twine_output.txt; then
echo " ✅ Twine check PASS"
echo " Twine check: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ Twine check FAIL"
cat /tmp/twine_output.txt
echo " Twine check: FAIL" >> "$VALIDATION_FILE"
cat /tmp/twine_output.txt >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
rm -f /tmp/twine_output.txt
echo ""
done
if [ $HAS_ERRORS -eq 1 ]; then
echo "" >> "$VALIDATION_FILE"
echo "RESULT: VALIDATION FAILED" >> "$VALIDATION_FILE"
echo "======================================================================"
echo "❌ WHEEL VALIDATION FAILED"
echo "======================================================================"
echo ""
echo "DO NOT PROCEED - corrupted wheels must NOT become artifacts!"
exit 1
else
echo "" >> "$VALIDATION_FILE"
echo "RESULT: ALL VALIDATIONS PASSED" >> "$VALIDATION_FILE"
echo "======================================================================"
echo "✅ All wheels validated successfully"
echo "======================================================================"
echo ""
echo "Validation results written to: $VALIDATION_FILE"
fi
shell: bash
- name: Generate SHA256 checksums (Linux only)
if: matrix.platform == 'linux'
run: |
echo "======================================================================"
echo "==> Generating SHA256 Checksums for Chain of Custody"
echo "======================================================================"
echo ""
echo "OpenSSL version:"
openssl version
echo ""
# Force sync before checksumming
echo "Forcing sync before checksumming..."
sync
echo "✅ Buffers flushed"
echo ""
# Change to dist directory to generate relative paths
cd dist
CHECKSUM_FILE="CHECKSUMS.sha256"
# Generate checksums for all wheels
echo "Generating checksums for wheels..."
for wheel in *.whl; do
if [ -f "$wheel" ]; then
sync
openssl sha256 "$wheel" | tee -a "$CHECKSUM_FILE"
fi
done
echo ""
echo "==> Generated checksum file:"
cat "$CHECKSUM_FILE"
echo ""
cd ..
shell: bash
- name: Force file system sync (post-checksum, pre-upload) - Linux
if: matrix.platform == 'linux'
run: |
echo "======================================================================"
echo "==> Forcing File System Sync (Post-Checksum)"
echo "======================================================================"
echo ""
sync
echo "✅ All buffers flushed to disk"
echo ""
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: Force file system sync (post-build, pre-validation) - macOS
if: matrix.platform == 'macos'
run: |
echo "======================================================================"
echo "==> Forcing File System Sync (Post-Build)"
echo "======================================================================"
echo ""
sync
echo "✅ All buffers flushed to disk"
echo ""
shell: bash
- name: Validate wheels integrity (macOS only)
if: matrix.platform == 'macos'
run: |
set -o pipefail
echo "======================================================================"
echo "==> Validating Wheel Integrity (macOS)"
echo "======================================================================"
echo ""
# Use --break-system-packages since this is an ephemeral CI runner
python3 -m pip install --break-system-packages git+https://github.com/pypa/packaging.git
python3 -m pip install --break-system-packages git+https://github.com/pypa/twine.git
echo ""
VALIDATION_FILE="dist/VALIDATION.txt"
echo "Wheel Validation Results - Build Time (wheels workflow)" > "$VALIDATION_FILE"
echo "=========================================================" >> "$VALIDATION_FILE"
echo "" >> "$VALIDATION_FILE"
echo "Validation Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> "$VALIDATION_FILE"
echo "Platform: macOS ARM64 (binary with NVX)" >> "$VALIDATION_FILE"
echo "Python: $(python3 --version)" >> "$VALIDATION_FILE"
echo "twine: $(twine --version)" >> "$VALIDATION_FILE"
echo "" >> "$VALIDATION_FILE"
HAS_ERRORS=0
for wheel in dist/*.whl; do
[ -f "$wheel" ] || continue
WHEEL_NAME=$(basename "$wheel")
echo "==> Validating: $WHEEL_NAME"
echo "" >> "$VALIDATION_FILE"
echo "Wheel: $WHEEL_NAME" >> "$VALIDATION_FILE"
echo "---" >> "$VALIDATION_FILE"
if unzip -t "$wheel" > /dev/null 2>&1; then
echo " ✅ ZIP test PASS"
echo " ZIP test: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ ZIP test FAIL"
echo " ZIP test: FAIL" >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
if python3 -m zipfile -t "$wheel" > /dev/null 2>&1; then
echo " ✅ Python zipfile test PASS"
echo " Python zipfile test: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ Python zipfile test FAIL"
echo " Python zipfile test: FAIL" >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
twine check "$wheel" 2>&1 | tee /tmp/twine_output.txt
if [ ${PIPESTATUS[0]} -eq 0 ] && ! grep -Eqi "ERROR|FAILED" /tmp/twine_output.txt; then
echo " ✅ Twine check PASS"
echo " Twine check: PASS" >> "$VALIDATION_FILE"
else
echo " ❌ Twine check FAIL"
echo " Twine check: FAIL" >> "$VALIDATION_FILE"
cat /tmp/twine_output.txt >> "$VALIDATION_FILE"
HAS_ERRORS=1
fi
rm -f /tmp/twine_output.txt
done
if [ $HAS_ERRORS -eq 1 ]; then
echo "RESULT: VALIDATION FAILED" >> "$VALIDATION_FILE"
echo "❌ WHEEL VALIDATION FAILED"
exit 1
else
echo "RESULT: ALL VALIDATIONS PASSED" >> "$VALIDATION_FILE"
echo "✅ All wheels validated successfully"
fi
shell: bash
- name: Generate SHA256 checksums (macOS only)
if: matrix.platform == 'macos'
run: |
echo "==> Generating SHA256 checksums..."
sync
cd dist
for wheel in *.whl; do
[ -f "$wheel" ] && openssl sha256 "$wheel" | tee -a CHECKSUMS.sha256
done
cat CHECKSUMS.sha256
cd ..
shell: bash
- name: Force file system sync (post-checksum) - macOS
if: matrix.platform == 'macos'
run: sync
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: Validate wheels integrity (Windows only)
if: matrix.platform == 'windows'
run: |
Write-Host "======================================================================"
Write-Host "==> Validating Wheel Integrity (Windows)"
Write-Host "======================================================================"
Write-Host ""
# Use --break-system-packages for consistency (safe in CI)
python -m pip install --break-system-packages git+https://github.com/pypa/packaging.git
python -m pip install --break-system-packages git+https://github.com/pypa/twine.git
Write-Host ""
$validationFile = "dist\VALIDATION.txt"
"Wheel Validation Results - Build Time (wheels workflow)" | Out-File -FilePath $validationFile -Encoding UTF8
"=========================================================" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"Validation Date: $((Get-Date).ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss UTC'))" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"Platform: Windows x86_64 (binary with NVX)" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"Python: $(python --version)" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"twine: $(twine --version)" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"" | Out-File -FilePath $validationFile -Append -Encoding UTF8
$hasErrors = $false
Get-ChildItem dist\*.whl | ForEach-Object {
$wheelName = $_.Name
Write-Host "==> Validating: $wheelName"
"" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"Wheel: $wheelName" | Out-File -FilePath $validationFile -Append -Encoding UTF8
"---" | Out-File -FilePath $validationFile -Append -Encoding UTF8
# Test 1: ZIP integrity (using Expand-Archive test)
try {
[System.IO.Compression.ZipFile]::OpenRead($_.FullName).Dispose()
Write-Host " ✅ ZIP test PASS"
" ZIP test: PASS" | Out-File -FilePath $validationFile -Append -Encoding UTF8
} catch {
Write-Host " ❌ ZIP test FAIL"
" ZIP test: FAIL" | Out-File -FilePath $validationFile -Append -Encoding UTF8
$hasErrors = $true
}
# Test 2: Python zipfile module
$zipfileTest = python -m zipfile -t $_.FullName 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " ✅ Python zipfile test PASS"
" Python zipfile test: PASS" | Out-File -FilePath $validationFile -Append -Encoding UTF8
} else {
Write-Host " ❌ Python zipfile test FAIL"
" Python zipfile test: FAIL" | Out-File -FilePath $validationFile -Append -Encoding UTF8
$hasErrors = $true
}
# Test 3: twine check
$twineOutput = twine check $_.FullName 2>&1 | Out-String
if ($LASTEXITCODE -eq 0 -and $twineOutput -notmatch "ERROR|FAILED") {
Write-Host " ✅ Twine check PASS"
" Twine check: PASS" | Out-File -FilePath $validationFile -Append -Encoding UTF8
} else {
Write-Host " ❌ Twine check FAIL"
" Twine check: FAIL" | Out-File -FilePath $validationFile -Append -Encoding UTF8
$twineOutput | Out-File -FilePath $validationFile -Append -Encoding UTF8
$hasErrors = $true
}
}
if ($hasErrors) {
"RESULT: VALIDATION FAILED" | Out-File -FilePath $validationFile -Append -Encoding UTF8
Write-Host "❌ WHEEL VALIDATION FAILED"
exit 1
} else {
"RESULT: ALL VALIDATIONS PASSED" | Out-File -FilePath $validationFile -Append -Encoding UTF8
Write-Host "✅ All wheels validated successfully"
}
shell: pwsh
- name: Generate SHA256 checksums (Windows only)
if: matrix.platform == 'windows'
run: |
Write-Host "==> Generating SHA256 checksums..."
Set-Location dist
$checksumFile = "CHECKSUMS.sha256"
Get-ChildItem *.whl | ForEach-Object {
$hash = (Get-FileHash -Algorithm SHA256 $_.Name).Hash.ToLower()
$line = "SHA256($($_.Name))= $hash"
Write-Host $line
$line | Out-File -FilePath $checksumFile -Append -Encoding UTF8
}
Get-Content $checksumFile
Set-Location ..
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 with cryptographic verification
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: wheels-${{ matrix.platform }}-${{ matrix.arch }}
path: dist/
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: Verify source distribution integrity (Linux x86_64 only)
if: matrix.platform == 'linux' && matrix.arch == 'x86_64'
run: |
echo "======================================================================"
echo "==> Source Distribution Integrity Verification (Issue #1716)"
echo "======================================================================"
echo ""
echo "OpenSSL version:"
openssl version
echo ""
echo "Creating cryptographic fingerprints and verification logs for"
echo "supply chain integrity - ensures no corruption from build → artifact → release."
echo ""
for tarball in dist/*.tar.gz; do
if [ ! -f "$tarball" ]; then
echo "⚠️ No source distribution found in dist/"
continue
fi
BASENAME=$(basename "$tarball")
VERIFY_FILE="dist/${BASENAME%.tar.gz}.verify.txt"
echo "==> Verifying: $BASENAME"
echo ""
# Create verification report
{
echo "========================================================================"
echo "Source Distribution Integrity Verification Report"
echo "========================================================================"
echo ""
echo "Verification performed at origin (wheels workflow)"
echo "This report ensures artifact integrity through the entire pipeline."
echo ""
echo "------------------------------------------------------------------------"
echo "Metadata"
echo "------------------------------------------------------------------------"
echo "Filename: $BASENAME"
echo "Timestamp: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
echo "Workflow: ${{ github.workflow }}"
echo "Run ID: ${{ github.run_id }}"
echo "Runner OS: ${{ runner.os }}"
echo "Runner Arch: ${{ runner.arch }}"
echo "Commit SHA: ${{ github.sha }}"
echo "Ref: ${{ github.ref }}"
echo ""
echo "------------------------------------------------------------------------"
echo "File Properties"
echo "------------------------------------------------------------------------"
ls -lh "$tarball"
echo ""
echo "File size (bytes): $(stat -c%s "$tarball" 2>/dev/null || stat -f%z "$tarball")"
echo ""
echo "------------------------------------------------------------------------"
echo "Cryptographic Fingerprint (SHA256)"
echo "------------------------------------------------------------------------"
openssl sha256 "$tarball"
echo ""
echo "------------------------------------------------------------------------"
echo "Gzip Integrity Test"
echo "------------------------------------------------------------------------"
if gzip -tv "$tarball"; then
echo ""
echo "Gzip exit code: 0"
echo "Result: ✅ PASS (no trailing garbage)"
else
echo ""
echo "Gzip exit code: $?"
echo "Result: ❌ FAIL"
exit 1
fi
echo ""
echo "------------------------------------------------------------------------"
echo "Tar Extraction Test"
echo "------------------------------------------------------------------------"
echo "Testing with GNU tar (lists contents without extracting):"
if tar -tzf "$tarball" > /tmp/tar_contents.txt 2>&1; then
echo "Result: ✅ PASS (tar can read archive)"
echo "File count: $(wc -l < /tmp/tar_contents.txt)"
echo ""
echo "First 10 files:"
head -10 /tmp/tar_contents.txt
rm -f /tmp/tar_contents.txt
else
TAR_EXIT=$?
echo "Result: ❌ FAIL (tar exit code $TAR_EXIT)"
cat /tmp/tar_contents.txt || true
rm -f /tmp/tar_contents.txt
exit 1
fi
echo ""
echo "------------------------------------------------------------------------"
echo "Binary Analysis"
echo "------------------------------------------------------------------------"
echo "Last 100 bytes (hex dump) - checking for trailing garbage:"
tail -c 100 "$tarball" | hexdump -C
echo ""
echo "------------------------------------------------------------------------"
echo "Verification Summary"
echo "------------------------------------------------------------------------"
echo "Overall Result: ✅ PASS - Archive is valid and extractable"
echo ""
echo "========================================================================"
echo "End of Verification Report"
echo "========================================================================"
} | tee "$VERIFY_FILE"
# Run actual validation tests and fail immediately on error
echo ""
echo "==> Running integrity checks..."
# Check for trailing garbage in gzip
GZIP_OUTPUT=$(gzip -tv "$tarball" 2>&1)
GZIP_EXIT_CODE=$?
if echo "$GZIP_OUTPUT" | grep -qi "trailing garbage"; then
echo ""
echo "❌ ERROR: Source distribution has trailing garbage!"
echo "This will cause tar extraction failures for users."
echo "See $VERIFY_FILE for full details."
echo ""
exit 1
fi
if [ $GZIP_EXIT_CODE -ne 0 ]; then
echo ""
echo "❌ ERROR: gzip test failed with exit code $GZIP_EXIT_CODE"
echo "See $VERIFY_FILE for full details."
echo ""
exit 1
fi
# Check tar extraction
if ! tar -tzf "$tarball" > /dev/null 2>&1; then
TAR_EXIT=$?
echo ""
echo "❌ ERROR: tar extraction test failed with exit code $TAR_EXIT"
echo "See $VERIFY_FILE for full details."
echo ""
exit 1
fi
echo "✅ $BASENAME verified successfully"
echo " Verification report: $VERIFY_FILE"
echo ""
done
echo "======================================================================"
echo "✅ All source distributions verified successfully"
echo "======================================================================"
echo ""
echo "Verification reports created:"
ls -lh dist/*.verify.txt
shell: bash
- name: Upload source distribution with cryptographic verification (Linux x86_64 only)
if: matrix.platform == 'linux' && matrix.arch == 'x86_64'
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: source-distribution
path: dist/
retention-days: 30
- name: Upload Linux wheels without NVX with cryptographic verification (Linux x86_64 only)
if: matrix.platform == 'linux' && matrix.arch == 'x86_64'
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: linux-wheels-no-nvx
path: dist/
retention-days: 30
# GitHub Releases, PyPI, and RTD publishing are now handled by the centralized 'release' workflow