Files

160 lines
5.5 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build - ${{ matrix.platform.os_name }} - ${{ matrix.platform.backend }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
# Windows Vulkan
- os_name: Windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
backend: vulkan
features: vulkan
bin: qwen3_tts.exe
name: qwen3-tts-windows-x64-vulkan.zip
llama_url: https://github.com/ggerganov/llama.cpp/releases/download/b7885/llama-b7885-bin-win-vulkan-x64.zip
ort_url: https://github.com/microsoft/onnxruntime/releases/download/v1.23.2/onnxruntime-win-x64-1.23.2.zip
# Windows CUDA 12
- os_name: Windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
backend: cuda
features: cuda
bin: qwen3_tts.exe
name: qwen3-tts-windows-x64-cuda12.zip
llama_url: https://github.com/ggerganov/llama.cpp/releases/download/b7885/llama-b7885-bin-win-cuda-12.4-x64.zip
ort_url: https://github.com/microsoft/onnxruntime/releases/download/v1.23.2/onnxruntime-win-x64-gpu-1.23.2.zip
# Linux Vulkan
- os_name: Linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
backend: vulkan
features: vulkan
bin: qwen3_tts
name: qwen3-tts-linux-x64-vulkan.tar.gz
llama_url: https://github.com/ggerganov/llama.cpp/releases/download/b7885/llama-b7885-bin-ubuntu-vulkan-x64.tar.gz
ort_url: https://github.com/microsoft/onnxruntime/releases/download/v1.23.2/onnxruntime-linux-x64-1.23.2.tgz
# macOS Metal
- os_name: macOS-ARM64
os: macos-14
target: aarch64-apple-darwin
backend: metal
features: "" # No specific feature needed for Metal? Or 'metal'? Cargo.toml doesn't have 'metal'.
bin: qwen3_tts
name: qwen3-tts-macos-arm64.tar.gz
llama_url: https://github.com/ggerganov/llama.cpp/releases/download/b7885/llama-b7885-bin-macos-arm64.tar.gz
ort_url: https://github.com/microsoft/onnxruntime/releases/download/v1.23.2/onnxruntime-osx-arm64-1.23.2.tgz
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev pkg-config libssl-dev
- name: Build Binary
run: cargo build --release --target ${{ matrix.platform.target }} --features "${{ matrix.platform.features }}"
- name: Prepare Distribution
shell: bash
run: |
mkdir -p dist
mkdir -p dist/runtime
mkdir -p dist/models
mkdir -p dist/speakers
# Copy Binary
cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} dist/
# Copy Readme
cp README.md dist/
# Copy Speakers
cp -r speakers/* dist/speakers/
- name: Download and Bundle Runtimes (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
# Download Llama.cpp
$llamaUrl = "${{ matrix.platform.llama_url }}"
Invoke-WebRequest -Uri $llamaUrl -OutFile "llama.zip"
Expand-Archive -Path "llama.zip" -DestinationPath "dist/runtime" -Force
rm llama.zip
# Download ONNX Runtime
$ortUrl = "${{ matrix.platform.ort_url }}"
Invoke-WebRequest -Uri $ortUrl -OutFile "ort.zip"
Expand-Archive -Path "ort.zip" -DestinationPath "ort_temp" -Force
Copy-Item "ort_temp/*/lib/*.dll" -Destination "dist/runtime" -Recurse
rm ort.zip
rm ort_temp -Recurse -Force
- name: Download and Bundle Runtimes (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
# Download Llama.cpp
# Check if URL exists (optional but good practice)
wget -O llama.tar.gz "${{ matrix.platform.llama_url }}"
tar -xzvf llama.tar.gz -C dist/runtime
rm llama.tar.gz
# Download ONNX Runtime
wget -O ort.tgz "${{ matrix.platform.ort_url }}"
mkdir ort_temp
tar -xzvf ort.tgz -C ort_temp
# Copy libs
find ort_temp -name "*.so*" -exec cp {} dist/runtime/ \;
find ort_temp -name "*.dylib" -exec cp {} dist/runtime/ \;
rm ort.tgz
rm -rf ort_temp
- name: Archive Release (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
Compress-Archive -Path dist/* -DestinationPath ${{ matrix.platform.name }}
- name: Archive Release (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
tar -czvf ${{ matrix.platform.name }} -C dist .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}
path: ${{ matrix.platform.name }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ matrix.platform.name }}