Skip to content

Commit 106f2b8

Browse files
ci: add Windows CUDA 12 build workflow (conda toolkit, RTX 4070)
1 parent 9a0ccb3 commit 106f2b8

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: windows-cuda-build
2+
3+
on:
4+
push:
5+
branches:
6+
- ci/**
7+
- main
8+
- dev
9+
- release-0.2
10+
pull_request:
11+
branches:
12+
- main
13+
- dev
14+
- release-0.2
15+
workflow_dispatch:
16+
inputs:
17+
cuda_architectures:
18+
description: "CMake CUDA architectures (default targets RTX 4070 / compute 8.9)"
19+
required: false
20+
default: "89-real"
21+
22+
env:
23+
# CUDA 12.x toolkit installed via conda. The NVIDIA .exe installer crashes on
24+
# GitHub windows runners (Jimver/cuda-toolkit#388/#436), so we use the conda
25+
# nvidia channel package instead.
26+
CUDA_TOOLKIT_VERSION: "12.6.3"
27+
CUDA_ARCHITECTURES: "89-real"
28+
29+
jobs:
30+
build:
31+
name: Windows CUDA 12
32+
runs-on: windows-2022
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Check loader/catalog sync
39+
shell: pwsh
40+
run: |
41+
python tools/check_loader_catalog_sync.py --self-test
42+
python tools/check_loader_catalog_sync.py
43+
44+
- name: Set up Miniconda
45+
uses: conda-incubator/setup-miniconda@v3
46+
with:
47+
auto-update-conda: true
48+
activate-environment: cuda
49+
python-version: "3.11"
50+
51+
- name: Install CUDA toolkit (conda)
52+
shell: pwsh
53+
run: |
54+
conda install -n cuda -y -c nvidia "cuda-toolkit=$env:CUDA_TOOLKIT_VERSION"
55+
$condaRoot = (conda info --base).Trim()
56+
$cudaPath = Join-Path $condaRoot "envs\cuda\Library"
57+
if (-not (Test-Path (Join-Path $cudaPath "bin\nvcc.exe"))) {
58+
throw "nvcc.exe not found under $cudaPath after conda install"
59+
}
60+
"CUDA_PATH=$cudaPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
61+
"CUDAToolkit_ROOT=$cudaPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
62+
63+
- name: Report CUDA version
64+
shell: pwsh
65+
run: |
66+
& "$env:CUDA_PATH\bin\nvcc.exe" --version
67+
68+
- name: Resolve CUDA architectures
69+
shell: pwsh
70+
run: |
71+
$arch = "${{ github.event.inputs.cuda_architectures }}"
72+
if ([string]::IsNullOrWhiteSpace($arch)) { $arch = $env:CUDA_ARCHITECTURES }
73+
"CUDA_ARCHITECTURES=$arch" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
74+
Write-Host "Building for CUDA architectures: $arch"
75+
76+
- name: Build audiocpp_cli
77+
shell: pwsh
78+
run: |
79+
.\scripts\build_windows.ps1 `
80+
-Preset windows-cuda-release `
81+
-CudaArchitectures $env:CUDA_ARCHITECTURES `
82+
-Target audiocpp_cli
83+
84+
- name: Build audiocpp_server
85+
shell: pwsh
86+
run: |
87+
.\scripts\build_windows.ps1 `
88+
-Preset windows-cuda-release `
89+
-CudaArchitectures $env:CUDA_ARCHITECTURES `
90+
-Target audiocpp_server
91+
92+
- name: Build audiocpp_gguf
93+
shell: pwsh
94+
run: |
95+
.\scripts\build_windows.ps1 `
96+
-Preset windows-cuda-release `
97+
-CudaArchitectures $env:CUDA_ARCHITECTURES `
98+
-Target audiocpp_gguf
99+
100+
- name: Collect binaries
101+
shell: pwsh
102+
run: |
103+
$out = "dist"
104+
New-Item -ItemType Directory -Force -Path $out | Out-Null
105+
Get-ChildItem -Path build -Recurse -Filter *.exe |
106+
Where-Object { $_.Name -match "^audiocpp_" } |
107+
ForEach-Object { Copy-Item $_.FullName -Destination $out -Force }
108+
Get-ChildItem $out
109+
110+
- name: Upload CUDA binaries
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: audiocpp-windows-cuda12
114+
path: dist/*.exe
115+
if-no-files-found: error

0 commit comments

Comments
 (0)