-
Notifications
You must be signed in to change notification settings - Fork 0
732 lines (638 loc) · 25 KB
/
release.yml
File metadata and controls
732 lines (638 loc) · 25 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
test_only:
description: 'Test build without publishing'
type: boolean
default: false
jobs:
# Build source distribution
build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# ============================================================================
# Linux: Build native module for CUDA 13.x
# NOTE: CUDA 12.x build commented out - kept for future CUDA 14.x parallel builds
# ============================================================================
# build-linux-native-cu12:
# runs-on: ubuntu-22.04
#
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# fetch-depth: 1
#
# - name: Set up Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"
#
# - name: Install CUDA Toolkit 12.6
# uses: Jimver/cuda-toolkit@v0.2.29
# with:
# cuda: "12.6.2"
# method: "network"
# linux-local-args: '["--toolkit"]'
#
# - name: Install build dependencies
# run: |
# python -m pip install --upgrade pip
# pip install pybind11 ninja cmake
#
# - name: Build native module (CUDA 12.x)
# run: |
# mkdir -p build-cu12
# cd build-cu12
# cmake ../native \
# -DCMAKE_BUILD_TYPE=Release \
# -DPYBIND11_FINDPYTHON=ON \
# -Dpybind11_DIR=$(python -c "import pybind11; print(pybind11.get_cmake_dir())") \
# -DCMAKE_CUDA_ARCHITECTURES="80;86;89;90" \
# -DMODULE_SUFFIX="_cu129"
# cmake --build . --config Release -j$(nproc)
#
# # Find and copy the built module
# find . -name "_pygpukit_native_cu129*.so" -exec cp {} ../native_cu129.so \;
# ls -la ../native_cu129.so
#
# - name: Upload native module
# uses: actions/upload-artifact@v4
# with:
# name: linux-native-cu129
# path: native_cu129.so
build-linux-native-cu13:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install CUDA Toolkit 13.0
uses: Jimver/cuda-toolkit@v0.2.29
with:
cuda: "13.0.2"
method: "network"
linux-local-args: '["--toolkit"]'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install pybind11 ninja cmake
- name: Build native module (CUDA 13.x)
run: |
mkdir -p build-cu13
cd build-cu13
cmake ../native \
-DCMAKE_BUILD_TYPE=Release \
-DPYBIND11_FINDPYTHON=ON \
-Dpybind11_DIR=$(python -c "import pybind11; print(pybind11.get_cmake_dir())") \
-DCMAKE_CUDA_ARCHITECTURES="80;86;89;90;100;120a" \
-DMODULE_SUFFIX="_cu131"
cmake --build . --config Release -j$(nproc)
# Find and copy the built module
find . -name "_pygpukit_native_cu131*.so" -exec cp {} ../native_cu131.so \;
ls -la ../native_cu131.so
- name: Upload native module
uses: actions/upload-artifact@v4
with:
name: linux-native-cu131
path: native_cu131.so
# Merge Linux native modules into final wheel
build-linux:
runs-on: ubuntu-22.04
needs: [build-linux-native-cu13]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install CUDA Toolkit (for headers)
uses: Jimver/cuda-toolkit@v0.2.29
with:
cuda: "13.0.2"
method: "network"
linux-local-args: '["--toolkit"]'
# NOTE: CUDA 12.x module download commented out
# - name: Download CUDA 12.x native module
# uses: actions/download-artifact@v4
# with:
# name: linux-native-cu129
# path: prebuilt
- name: Download CUDA 13.x native module
uses: actions/download-artifact@v4
with:
name: linux-native-cu131
path: prebuilt
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build scikit-build-core pybind11 ninja cmake auditwheel patchelf maturin
- name: Prepare prebuilt native modules
run: |
# Get the correct Python extension suffix
SUFFIX=$(python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
echo "Python extension suffix: $SUFFIX"
# Rename and copy to src/pygpukit/
# NOTE: Only CUDA 13.x module included
cp prebuilt/native_cu131.so "src/pygpukit/_pygpukit_native_cu131${SUFFIX}"
ls -la src/pygpukit/_pygpukit_native*
- name: Build Rust module
run: |
cd rust/pygpukit-python
maturin build --release --interpreter python
# Extract and copy the Rust extension to src/pygpukit/
cd ../target/wheels
unzip -o *.whl -d ../rust-extracted
find ../rust-extracted -name "_pygpukit_rust*.so" -exec cp {} ../../../src/pygpukit/ \;
ls -la ../../../src/pygpukit/*.so || true
env:
RUSTFLAGS: ""
- name: Build wheel (skip native build, use prebuilt)
run: |
# Create a minimal wheel with just Python code
python -m build --wheel
env:
# Skip native build since we have prebuilt modules
PYGPUKIT_SKIP_NATIVE_BUILD: "1"
CMAKE_CUDA_ARCHITECTURES: "80;86;89;90;100;120a"
- name: Inject prebuilt native modules into wheel
run: |
# scikit-build-core doesn't include prebuilt .so files, so we inject them manually
cd dist
WHEEL=$(ls *.whl)
echo "Injecting native modules into $WHEEL"
# Unzip wheel
unzip -q "$WHEEL" -d wheel-contents
# Copy prebuilt native modules
cp ../src/pygpukit/_pygpukit_native*.so wheel-contents/pygpukit/ || true
cp ../src/pygpukit/_pygpukit_rust*.so wheel-contents/pygpukit/ || true
# Show what we're including
echo "=== Files in pygpukit/ ==="
ls -la wheel-contents/pygpukit/
# Update RECORD file (required for valid wheel)
cd wheel-contents
# Dynamically find dist-info folder
DIST_INFO=$(ls -d pygpukit-*.dist-info | head -1)
echo "Found dist-info folder: $DIST_INFO"
# Generate RECORD with ALL files (pygpukit/ + dist-info/)
{
# All files in pygpukit/
find pygpukit -type f | while read f; do
hash=$(python -c "import hashlib, base64; print('sha256=' + base64.urlsafe_b64encode(hashlib.sha256(open('$f', 'rb').read()).digest()).rstrip(b'=').decode())")
size=$(stat -c%s "$f")
echo "$f,$hash,$size"
done
# All files in dist-info/ except RECORD
find "$DIST_INFO" -type f ! -name RECORD | while read f; do
hash=$(python -c "import hashlib, base64; print('sha256=' + base64.urlsafe_b64encode(hashlib.sha256(open('$f', 'rb').read()).digest()).rstrip(b'=').decode())")
size=$(stat -c%s "$f")
echo "$f,$hash,$size"
done
# RECORD itself (no hash)
echo "$DIST_INFO/RECORD,,"
} > "$DIST_INFO/RECORD"
# Repack wheel
cd ..
rm "$WHEEL"
cd wheel-contents
zip -rq "../$WHEEL" .
cd ../..
rm -rf dist/wheel-contents
- name: Show wheel info before repair
run: |
ls -la dist/
echo "=== Extension modules in wheel ==="
python -m zipfile -l dist/*.whl | grep -E '\.so|\.pyd' || echo "No extension modules found!"
- name: Repair wheel with auditwheel
run: |
auditwheel repair dist/*.whl \
--wheel-dir dist-repaired \
--exclude libcudart.so.12 \
--exclude libcudart.so.13 \
--exclude libcuda.so.1 \
--exclude libnvrtc.so.12 \
--exclude libnvrtc.so.13 \
--exclude libnvrtc-builtins.so.12.6 \
--exclude libnvrtc-builtins.so.13.0 \
--plat manylinux_2_35_x86_64
rm dist/*.whl
mv dist-repaired/*.whl dist/
- name: Show wheel info after repair
run: |
ls -la dist/
echo "=== Extension modules in wheel ==="
python -m zipfile -l dist/*.whl | grep -E '\.so|\.pyd'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel-linux-py312
path: dist/*.whl
# ============================================================================
# Windows: Build native module for CUDA 13.x
# NOTE: CUDA 12.x build commented out - kept for future CUDA 14.x parallel builds
# ============================================================================
# build-windows-native-cu12:
# runs-on: [self-hosted, Windows, X64, cuda]
#
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# fetch-depth: 1
#
# - name: Set up Python 3.12
# shell: pwsh
# run: |
# pyenv install 3.12 --skip-existing
# pyenv local 3.12
# python --version
#
# - name: Clean previous builds
# shell: pwsh
# run: |
# if (Test-Path build-cu12) { Remove-Item -Recurse -Force build-cu12 }
#
# - name: Install build dependencies
# shell: pwsh
# run: |
# python -m pip install --upgrade pip
# pip install pybind11 ninja cmake
#
# - name: Build native module (CUDA 12.x)
# shell: cmd
# run: |
# @REM Set up VS environment
# call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
# @REM Use CUDA 12.x
# set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.9"
# set "PATH=%CUDA_PATH%\bin;%PATH%"
#
# @REM Get pybind11 cmake dir
# for /f "delims=" %%i in ('python -c "import pybind11; print(pybind11.get_cmake_dir())"') do set PYBIND11_DIR=%%i
#
# mkdir build-cu12
# cd build-cu12
# cmake ..\native -G Ninja ^
# -DCMAKE_BUILD_TYPE=Release ^
# -DPYBIND11_FINDPYTHON=ON ^
# -Dpybind11_DIR="%PYBIND11_DIR%" ^
# -DCMAKE_CUDA_ARCHITECTURES="80;86;89;90" ^
# -DMODULE_SUFFIX="_cu129"
# cmake --build . --config Release
#
# - name: Copy native module
# shell: pwsh
# run: |
# $ext = Get-ChildItem build-cu12 -Filter "_pygpukit_native_cu129*.pyd" -Recurse | Select-Object -First 1
# if ($ext) {
# Copy-Item $ext.FullName "native_cu129.pyd"
# Write-Host "Copied: $($ext.Name)"
# } else {
# Write-Error "Native module not found!"
# exit 1
# }
# Get-ChildItem native_cu129.pyd
#
# - name: Upload native module
# uses: actions/upload-artifact@v4
# with:
# name: windows-native-cu129
# path: native_cu129.pyd
build-windows-native-cu13:
runs-on: [self-hosted, Windows, X64, cuda]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Set up Python 3.12
shell: pwsh
run: |
pyenv install 3.12 --skip-existing
pyenv local 3.12
python --version
- name: Clean previous builds
shell: pwsh
run: |
if (Test-Path build-cu13) { Remove-Item -Recurse -Force build-cu13 }
- name: Install build dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install pybind11 ninja cmake
- name: Build native module (CUDA 13.x)
shell: cmd
run: |
@REM Set up VS environment
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
@REM Use CUDA 13.1
set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1"
set "PATH=%CUDA_PATH%\bin;%PATH%"
@REM Get pybind11 cmake dir
for /f "delims=" %%i in ('python -c "import pybind11; print(pybind11.get_cmake_dir())"') do set PYBIND11_DIR=%%i
mkdir build-cu13
cd build-cu13
cmake ..\native -G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DPYBIND11_FINDPYTHON=ON ^
-Dpybind11_DIR="%PYBIND11_DIR%" ^
-DCMAKE_CUDA_ARCHITECTURES="80;86;89;90;100;120a" ^
-DMODULE_SUFFIX="_cu131"
cmake --build . --config Release
- name: Copy native module
shell: pwsh
run: |
$ext = Get-ChildItem build-cu13 -Filter "_pygpukit_native_cu131*.pyd" -Recurse | Select-Object -First 1
if ($ext) {
Copy-Item $ext.FullName "native_cu131.pyd"
Write-Host "Copied: $($ext.Name)"
} else {
Write-Error "Native module not found!"
exit 1
}
Get-ChildItem native_cu131.pyd
- name: Upload native module
uses: actions/upload-artifact@v4
with:
name: windows-native-cu131
path: native_cu131.pyd
# Merge Windows native modules into final wheel
build-windows:
runs-on: [self-hosted, Windows, X64, cuda]
needs: [build-windows-native-cu13]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Set up Python 3.12
shell: pwsh
run: |
pyenv install 3.12 --skip-existing
pyenv local 3.12
python --version
- name: Set up Rust
shell: pwsh
run: |
if (-not (Get-Command rustup -ErrorAction SilentlyContinue)) {
Write-Host "Installing rustup..."
Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
.\rustup-init.exe -y --default-toolchain stable
Remove-Item rustup-init.exe
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
}
rustup default stable
rustup update
rustc --version
cargo --version
- name: Clean previous builds
shell: pwsh
run: |
if (Test-Path dist) { Remove-Item -Recurse -Force dist }
if (Test-Path build) { Remove-Item -Recurse -Force build }
if (Test-Path rust/target) { Remove-Item -Recurse -Force rust/target }
Get-ChildItem -Filter "*.egg-info" -Directory | Remove-Item -Recurse -Force
# NOTE: CUDA 12.x module download commented out
# - name: Download CUDA 12.x native module
# uses: actions/download-artifact@v4
# with:
# name: windows-native-cu129
# path: prebuilt
- name: Download CUDA 13.x native module
uses: actions/download-artifact@v4
with:
name: windows-native-cu131
path: prebuilt
- name: Install build dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install build scikit-build-core pybind11 ninja cmake maturin
- name: Prepare prebuilt native modules
shell: pwsh
run: |
# Get the correct Python extension suffix
$suffix = python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
Write-Host "Python extension suffix: $suffix"
# Rename and copy to src/pygpukit/
# NOTE: Only CUDA 13.x module included
Copy-Item "prebuilt/native_cu131.pyd" "src/pygpukit/_pygpukit_native_cu131$suffix"
Get-ChildItem src/pygpukit/_pygpukit_native*
- name: Build Rust module
shell: pwsh
run: |
cd rust/pygpukit-python
maturin build --release --interpreter python
$wheel = Get-ChildItem ../target/wheels/*.whl | Select-Object -First 1
Expand-Archive -Path $wheel.FullName -DestinationPath ../target/rust-extracted -Force
$ext = Get-ChildItem ../target/rust-extracted/_pygpukit_rust*.pyd -Recurse | Select-Object -First 1
if ($ext) {
Copy-Item $ext.FullName ../../src/pygpukit/
Write-Host "Copied Rust extension: $($ext.Name)"
}
Get-ChildItem ../../src/pygpukit/*.pyd
- name: Build wheel (skip native build, use prebuilt)
shell: cmd
run: |
@REM Set up VS environment
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1"
set "PATH=%CUDA_PATH%\bin;%PATH%"
set "PYGPUKIT_SKIP_NATIVE_BUILD=1"
python -m build --wheel
env:
CMAKE_CUDA_ARCHITECTURES: "80;86;89;90;100;120a"
- name: Inject prebuilt native modules into wheel
shell: pwsh
run: |
# scikit-build-core doesn't include prebuilt .pyd files, so we inject them manually
cd dist
$wheel = Get-ChildItem *.whl | Select-Object -First 1
Write-Host "Injecting native modules into $($wheel.Name)"
# Unzip wheel
Expand-Archive -Path $wheel.FullName -DestinationPath wheel-contents -Force
# Copy prebuilt native modules
Get-ChildItem ../src/pygpukit/_pygpukit_native*.pyd | ForEach-Object {
Copy-Item $_.FullName wheel-contents/pygpukit/
Write-Host "Copied: $($_.Name)"
}
Get-ChildItem ../src/pygpukit/_pygpukit_rust*.pyd -ErrorAction SilentlyContinue | ForEach-Object {
Copy-Item $_.FullName wheel-contents/pygpukit/
Write-Host "Copied: $($_.Name)"
}
# Show what we're including
Write-Host "=== Files in pygpukit/ ==="
Get-ChildItem wheel-contents/pygpukit/
# Update RECORD file (required for valid wheel)
# Dynamically find dist-info folder
$distInfo = Get-ChildItem wheel-contents -Directory -Filter "pygpukit-*.dist-info" | Select-Object -First 1
$distInfoName = $distInfo.Name
Write-Host "Found dist-info folder: $distInfoName"
$recordPath = "wheel-contents/$distInfoName/RECORD"
$wheelContentsPath = (Resolve-Path "wheel-contents").Path
$newRecord = @()
# All files in pygpukit/ (recursive)
Get-ChildItem wheel-contents/pygpukit -File -Recurse | ForEach-Object {
$relativePath = $_.FullName.Substring($wheelContentsPath.Length + 1).Replace('\', '/')
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
$hash = [System.Security.Cryptography.SHA256]::Create().ComputeHash($bytes)
$hashB64 = [Convert]::ToBase64String($hash).TrimEnd('=').Replace('+', '-').Replace('/', '_')
$size = $_.Length
$newRecord += "$relativePath,sha256=$hashB64,$size"
}
# All files in dist-info/ except RECORD (including subdirectories like licenses/)
Get-ChildItem "wheel-contents/$distInfoName" -File -Recurse | Where-Object { $_.Name -ne "RECORD" } | ForEach-Object {
$distInfoPath = (Resolve-Path "wheel-contents/$distInfoName").Path
$relativePath = $distInfoName + "/" + $_.FullName.Substring($distInfoPath.Length + 1).Replace('\', '/')
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
$hash = [System.Security.Cryptography.SHA256]::Create().ComputeHash($bytes)
$hashB64 = [Convert]::ToBase64String($hash).TrimEnd('=').Replace('+', '-').Replace('/', '_')
$size = $_.Length
$newRecord += "$relativePath,sha256=$hashB64,$size"
}
# RECORD itself (no hash)
$newRecord += "$distInfoName/RECORD,,"
# Write with Unix line endings (LF only)
$newRecord -join "`n" | Set-Content -Path $recordPath -NoNewline -Encoding utf8NoBOM
Add-Content -Path $recordPath -Value "" -NoNewline -Encoding utf8NoBOM
# Repack wheel
Remove-Item $wheel.FullName
Compress-Archive -Path wheel-contents/* -DestinationPath "$($wheel.Name).zip"
Rename-Item "$($wheel.Name).zip" $wheel.Name
Remove-Item wheel-contents -Recurse -Force
- name: Verify wheel contents
shell: pwsh
run: |
Get-ChildItem dist/*.whl | ForEach-Object {
Write-Host "Built: $($_.Name)"
Write-Host "=== Wheel contents ==="
python -m zipfile -l $_.FullName | Select-String -Pattern "\.pyd|\.so"
}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel-windows-py312
path: dist/*.whl
# ============================================================================
# Publish
# ============================================================================
publish-testpypi:
runs-on: ubuntu-latest
needs: [build-linux, build-windows, build-sdist]
if: github.event_name == 'push' || !inputs.test_only
environment: testpypi
permissions:
id-token: write
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Download Linux wheel
uses: actions/download-artifact@v4
with:
name: wheel-linux-py312
path: dist
- name: Download Windows wheel
uses: actions/download-artifact@v4
with:
name: wheel-windows-py312
path: dist
- name: List dist contents
run: |
echo "=== Artifacts to publish ==="
ls -la dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish-pypi:
runs-on: ubuntu-latest
needs: publish-testpypi
if: github.event_name == 'push' || !inputs.test_only
environment: pypi
permissions:
id-token: write
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Download Linux wheel
uses: actions/download-artifact@v4
with:
name: wheel-linux-py312
path: dist
- name: Download Windows wheel
uses: actions/download-artifact@v4
with:
name: wheel-windows-py312
path: dist
- name: List dist contents
run: |
echo "=== Artifacts to publish ==="
ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
github-release:
runs-on: ubuntu-latest
needs: [build-sdist, build-linux, build-windows, publish-pypi]
if: github.event_name == 'push'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
generate_release_notes: true