Skip to content

Commit 1ec501f

Browse files
pszymkowiakclaude
andauthored
feat: cross-platform support for Linux CUDA and Windows (#8)
- Add qwen-native backend using qwen3-tts-rs (pure Rust, candle-based) with auto-device detection (CPU/Metal/CUDA) - Replace afplay with rodio for cross-platform audio playback - Gate say/qwen backends and chat/stt modules behind #[cfg(target_os = "macos")] - Add feature flags: metal (macOS GPU), cuda (NVIDIA GPU) - Platform-aware defaults: say on macOS, qwen-native on Linux/Windows - CI matrix: macOS (Metal), Ubuntu (CPU), Windows (CPU) - Release builds: aarch64-apple-darwin, x86_64-apple-darwin, x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc - Platform-aware sox install hints (brew/apt/choco) - Conditional tests: macOS-only tests gated, new qwen-native tests Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c557509 commit 1ec501f

20 files changed

Lines changed: 895 additions & 162 deletions

.github/workflows/ci.yml

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,53 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
check:
14-
runs-on: macos-latest
13+
test:
14+
name: ${{ matrix.name }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- name: macOS (Metal)
21+
os: macos-latest
22+
features: metal
23+
deps: ""
24+
- name: Linux (CPU)
25+
os: ubuntu-latest
26+
features: ""
27+
deps: libasound2-dev
28+
- name: Windows (CPU)
29+
os: windows-latest
30+
features: ""
31+
deps: ""
32+
1533
steps:
1634
- uses: actions/checkout@v4
1735

1836
- name: Install Rust
1937
uses: dtolnay/rust-toolchain@stable
2038

39+
- name: Install system deps (Linux)
40+
if: matrix.deps != ''
41+
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.deps }}
42+
2143
- name: Cache cargo
2244
uses: actions/cache@v4
2345
with:
2446
path: |
2547
~/.cargo/registry
2648
~/.cargo/git
2749
target
28-
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-cargo-check-
50+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
51+
52+
- name: Build
53+
run: cargo build ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
54+
55+
- name: Run tests
56+
run: cargo test ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
3157

3258
- name: Check formatting
3359
run: cargo fmt -- --check
3460

3561
- name: Clippy
36-
run: cargo clippy -- -D warnings
37-
38-
test:
39-
runs-on: macos-latest
40-
steps:
41-
- uses: actions/checkout@v4
42-
43-
- name: Install Rust
44-
uses: dtolnay/rust-toolchain@stable
45-
46-
- name: Cache cargo
47-
uses: actions/cache@v4
48-
with:
49-
path: |
50-
~/.cargo/registry
51-
~/.cargo/git
52-
target
53-
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
54-
restore-keys: |
55-
${{ runner.os }}-cargo-test-
56-
57-
- name: Run tests
58-
run: cargo test
62+
run: cargo clippy ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }} -- -D warnings

.github/workflows/release.yml

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,30 @@ env:
2222
CARGO_TERM_COLOR: always
2323

2424
jobs:
25-
build-and-release:
26-
name: Build and upload release assets
27-
runs-on: macos-latest
25+
build:
26+
name: Build ${{ matrix.target }}
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- target: aarch64-apple-darwin
33+
os: macos-latest
34+
features: metal
35+
archive: tar.gz
36+
- target: x86_64-apple-darwin
37+
os: macos-latest
38+
features: metal
39+
archive: tar.gz
40+
- target: x86_64-unknown-linux-gnu
41+
os: ubuntu-latest
42+
features: ""
43+
archive: tar.gz
44+
deps: libasound2-dev
45+
- target: x86_64-pc-windows-msvc
46+
os: windows-latest
47+
features: ""
48+
archive: zip
2849

2950
steps:
3051
- name: Checkout
@@ -33,37 +54,48 @@ jobs:
3354
- name: Install Rust
3455
uses: dtolnay/rust-toolchain@stable
3556
with:
36-
targets: x86_64-apple-darwin,aarch64-apple-darwin
57+
targets: ${{ matrix.target }}
3758

38-
- name: Cache cargo
39-
uses: actions/cache@v4
40-
with:
41-
path: |
42-
~/.cargo/registry
43-
~/.cargo/git
44-
target
45-
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
46-
restore-keys: |
47-
${{ runner.os }}-cargo-release-
48-
49-
- name: Build aarch64-apple-darwin
50-
run: cargo build --release --target aarch64-apple-darwin
59+
- name: Install system deps (Linux)
60+
if: matrix.deps != ''
61+
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.deps }}
5162

52-
- name: Build x86_64-apple-darwin
53-
run: cargo build --release --target x86_64-apple-darwin
63+
- name: Build
64+
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features != '' && format('--features {0}', matrix.features) || '' }}
5465

55-
- name: Package
66+
- name: Package (tar.gz)
67+
if: matrix.archive == 'tar.gz'
5668
run: |
57-
mkdir -p release
58-
cd target/aarch64-apple-darwin/release
59-
tar -czvf ../../../release/vox-aarch64-apple-darwin.tar.gz vox
60-
cd ../../../target/x86_64-apple-darwin/release
61-
tar -czvf ../../../release/vox-x86_64-apple-darwin.tar.gz vox
69+
cd target/${{ matrix.target }}/release
70+
tar -czvf ../../../vox-${{ matrix.target }}.${{ matrix.archive }} vox
71+
cd ../../..
6272
63-
- name: Create checksums
73+
- name: Package (zip)
74+
if: matrix.archive == 'zip'
75+
shell: bash
6476
run: |
65-
cd release
66-
shasum -a 256 *.tar.gz > checksums.txt
77+
cd target/${{ matrix.target }}/release
78+
7z a ../../../vox-${{ matrix.target }}.zip vox.exe
79+
cd ../../..
80+
81+
- name: Upload artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: vox-${{ matrix.target }}
85+
path: vox-${{ matrix.target }}.${{ matrix.archive }}
86+
87+
release:
88+
name: Create Release
89+
needs: [build]
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v4
94+
95+
- name: Download all artifacts
96+
uses: actions/download-artifact@v4
97+
with:
98+
path: artifacts
6799

68100
- name: Get version
69101
id: version
@@ -76,6 +108,16 @@ jobs:
76108
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
77109
fi
78110
111+
- name: Flatten artifacts
112+
run: |
113+
mkdir -p release
114+
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release/ \;
115+
116+
- name: Create checksums
117+
run: |
118+
cd release
119+
sha256sum * > checksums.txt
120+
79121
- name: Upload Release Assets
80122
if: github.event_name == 'release' || github.event_name == 'workflow_call'
81123
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)