Skip to content

Commit dc7f6c6

Browse files
committed
feat: add CUDA builds for Linux and Windows
- CI: add Linux (CUDA) and Windows (CUDA) test targets - Release: add CUDA variants (vox-*-cuda.tar.gz/zip) - Uses Jimver/cuda-toolkit@v0.2.22 with CUDA 12.6.3 - CUDA binaries ship alongside CPU binaries in releases
1 parent 6831a0a commit dc7f6c6

2 files changed

Lines changed: 50 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ jobs:
2626
os: ubuntu-latest
2727
features: ""
2828
deps: libasound2-dev
29+
- name: Linux (CUDA)
30+
os: ubuntu-latest
31+
features: cuda
32+
deps: libasound2-dev
33+
cuda: true
2934
- name: Windows (CPU)
3035
os: windows-latest
3136
features: ""
3237
deps: ""
38+
- name: Windows (CUDA)
39+
os: windows-latest
40+
features: cuda
41+
cuda: true
42+
deps: ""
3343

3444
steps:
3545
- uses: actions/checkout@v4
@@ -41,14 +51,22 @@ jobs:
4151
if: matrix.deps != ''
4252
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.deps }}
4353

54+
- name: Install CUDA toolkit
55+
if: matrix.cuda == true
56+
uses: Jimver/cuda-toolkit@v0.2.22
57+
with:
58+
cuda: '12.6.3'
59+
method: network
60+
sub-packages: '["nvcc", "cudart"]'
61+
4462
- name: Cache cargo
4563
uses: actions/cache@v4
4664
with:
4765
path: |
4866
~/.cargo/registry
4967
~/.cargo/git
5068
target
51-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
key: ${{ runner.os }}-${{ matrix.features }}-cargo-${{ hashFiles('**/Cargo.lock') }}
5270

5371
- name: Build
5472
run: cargo build ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
@@ -57,6 +75,7 @@ jobs:
5775
run: cargo test ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
5876

5977
- name: Check formatting
78+
if: matrix.cuda != true
6079
run: cargo fmt -- --check
6180

6281
- name: Clippy

.github/workflows/release.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,33 @@ jobs:
3333
os: macos-latest
3434
features: metal
3535
archive: tar.gz
36+
artifact_suffix: ""
3637
# x86_64-apple-darwin removed: ort (via piper-rs) has no prebuilt
3738
# binaries for Intel Macs. Intel Macs are EOL.
3839
- target: x86_64-unknown-linux-gnu
3940
os: ubuntu-latest
4041
features: ""
4142
archive: tar.gz
4243
deps: libasound2-dev
43-
# TODO: aarch64-unknown-linux-gnu requires cross-compilation setup
44-
# Re-enable once CI cross-compile is working (#56)
44+
artifact_suffix: ""
45+
- target: x86_64-unknown-linux-gnu
46+
os: ubuntu-latest
47+
features: cuda
48+
archive: tar.gz
49+
deps: libasound2-dev
50+
cuda: true
51+
artifact_suffix: "-cuda"
4552
- target: x86_64-pc-windows-msvc
4653
os: windows-latest
4754
features: ""
4855
archive: zip
56+
artifact_suffix: ""
57+
- target: x86_64-pc-windows-msvc
58+
os: windows-latest
59+
features: cuda
60+
archive: zip
61+
cuda: true
62+
artifact_suffix: "-cuda"
4963

5064
steps:
5165
- name: Checkout
@@ -56,35 +70,43 @@ jobs:
5670
with:
5771
targets: ${{ matrix.target }}
5872

59-
- name: Install system deps (Linux native)
60-
if: matrix.deps != '' && matrix.cross != true
73+
- name: Install system deps (Linux)
74+
if: matrix.deps != ''
6175
run: |
6276
sudo apt-get update
6377
sudo apt-get install -y ${{ matrix.deps }}
6478
79+
- name: Install CUDA toolkit
80+
if: matrix.cuda == true
81+
uses: Jimver/cuda-toolkit@v0.2.22
82+
with:
83+
cuda: '12.6.3'
84+
method: network
85+
sub-packages: '["nvcc", "cudart"]'
86+
6587
- name: Build
6688
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
6789

6890
- name: Package (tar.gz)
6991
if: matrix.archive == 'tar.gz'
7092
run: |
7193
cd target/${{ matrix.target }}/release
72-
tar -czvf ../../../vox-${{ matrix.target }}.${{ matrix.archive }} vox
94+
tar -czvf ../../../vox-${{ matrix.target }}${{ matrix.artifact_suffix }}.${{ matrix.archive }} vox
7395
cd ../../..
7496
7597
- name: Package (zip)
7698
if: matrix.archive == 'zip'
7799
shell: bash
78100
run: |
79101
cd target/${{ matrix.target }}/release
80-
7z a ../../../vox-${{ matrix.target }}.zip vox.exe
102+
7z a ../../../vox-${{ matrix.target }}${{ matrix.artifact_suffix }}.zip vox.exe
81103
cd ../../..
82104
83105
- name: Upload artifact
84106
uses: actions/upload-artifact@v4
85107
with:
86-
name: vox-${{ matrix.target }}
87-
path: vox-${{ matrix.target }}.${{ matrix.archive }}
108+
name: vox-${{ matrix.target }}${{ matrix.artifact_suffix }}
109+
path: vox-${{ matrix.target }}${{ matrix.artifact_suffix }}.${{ matrix.archive }}
88110

89111
release:
90112
name: Upload Release Assets

0 commit comments

Comments
 (0)