Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb9ec687cb | ||
|
|
d297540053 | ||
|
|
cc24511b87 | ||
|
|
23c013bbac | ||
|
|
34797b295d |
@@ -32,23 +32,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python toolcache (macOS)
|
- name: Install uv
|
||||||
if: matrix.platform == 'macos'
|
uses: astral-sh/setup-uv@v4
|
||||||
run: |
|
|
||||||
mkdir -p ${{ github.workspace }}/.toolcache
|
|
||||||
echo "AGENT_TOOLSDIRECTORY=${{ github.workspace }}/.toolcache" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
||||||
with:
|
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
|
|
||||||
- name: Install Python build tools
|
|
||||||
run: python -m pip install --upgrade pip setuptools wheel
|
|
||||||
|
|
||||||
- name: Build sidecar
|
- name: Build sidecar
|
||||||
working-directory: python
|
working-directory: python
|
||||||
run: python build_sidecar.py --cpu-only
|
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
||||||
|
|
||||||
- name: Upload sidecar artifact
|
- name: Upload sidecar artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -97,13 +89,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
brew install --quiet create-dmg || true
|
brew install --quiet create-dmg || true
|
||||||
|
|
||||||
- name: Install system dependencies (Windows)
|
|
||||||
if: matrix.platform == 'windows'
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
# Ensure Visual Studio Build Tools are available (usually pre-installed on runners)
|
|
||||||
Write-Host "Windows build environment ready"
|
|
||||||
|
|
||||||
- name: Download sidecar artifact
|
- name: Download sidecar artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
name: Build & Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
tags: ["v*"]
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
PYTHON_VERSION: "3.11"
|
|
||||||
NODE_VERSION: "20"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-sidecar:
|
|
||||||
name: Build sidecar (${{ matrix.target }})
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- runner: ubuntu-20.04
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
platform: linux
|
|
||||||
- runner: windows-latest
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
platform: windows
|
|
||||||
- runner: macos-13
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
platform: macos-intel
|
|
||||||
- runner: macos-14
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
platform: macos-arm
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
|
|
||||||
- name: Build sidecar
|
|
||||||
working-directory: python
|
|
||||||
run: python build_sidecar.py --cpu-only
|
|
||||||
|
|
||||||
- name: Upload sidecar artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: sidecar-${{ matrix.target }}
|
|
||||||
path: python/dist/voice-to-notes-sidecar/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
build-tauri:
|
|
||||||
name: Build app (${{ matrix.target }})
|
|
||||||
needs: build-sidecar
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- runner: ubuntu-20.04
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
platform: linux
|
|
||||||
- runner: windows-latest
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
platform: windows
|
|
||||||
- runner: macos-13
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
platform: macos-intel
|
|
||||||
- runner: macos-14
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
platform: macos-arm
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install Rust stable
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Install system dependencies (Linux)
|
|
||||||
if: matrix.platform == 'linux'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
|
||||||
|
|
||||||
- name: Download sidecar artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: sidecar-${{ matrix.target }}
|
|
||||||
path: src-tauri/binaries/
|
|
||||||
|
|
||||||
- name: Make sidecar executable (Unix)
|
|
||||||
if: matrix.platform != 'windows'
|
|
||||||
run: chmod +x src-tauri/binaries/voice-to-notes-sidecar-${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Install npm dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build Tauri app
|
|
||||||
run: npm run tauri build
|
|
||||||
env:
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_CONFIG: '{"bundle":{"externalBin":["binaries/voice-to-notes-sidecar"]}}'
|
|
||||||
|
|
||||||
- name: Upload app artifacts (Linux)
|
|
||||||
if: matrix.platform == 'linux'
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: app-${{ matrix.target }}
|
|
||||||
path: |
|
|
||||||
src-tauri/target/release/bundle/deb/*.deb
|
|
||||||
src-tauri/target/release/bundle/appimage/*.AppImage
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
- name: Upload app artifacts (Windows)
|
|
||||||
if: matrix.platform == 'windows'
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: app-${{ matrix.target }}
|
|
||||||
path: |
|
|
||||||
src-tauri/target/release/bundle/msi/*.msi
|
|
||||||
src-tauri/target/release/bundle/nsis/*.exe
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
- name: Upload app artifacts (macOS)
|
|
||||||
if: startsWith(matrix.platform, 'macos')
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: app-${{ matrix.target }}
|
|
||||||
path: |
|
|
||||||
src-tauri/target/release/bundle/dmg/*.dmg
|
|
||||||
src-tauri/target/release/bundle/macos/*.app
|
|
||||||
retention-days: 30
|
|
||||||
+34
-9
@@ -59,42 +59,67 @@ def get_target_triple() -> str:
|
|||||||
return f"{arch}-unknown-{system}"
|
return f"{arch}-unknown-{system}"
|
||||||
|
|
||||||
|
|
||||||
|
def _has_uv() -> bool:
|
||||||
|
"""Check if uv is available."""
|
||||||
|
try:
|
||||||
|
subprocess.run(["uv", "--version"], capture_output=True, check=True)
|
||||||
|
return True
|
||||||
|
except (FileNotFoundError, subprocess.CalledProcessError):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def create_venv_and_install(cpu_only: bool) -> Path:
|
def create_venv_and_install(cpu_only: bool) -> Path:
|
||||||
"""Create a fresh venv and install dependencies."""
|
"""Create a fresh venv and install dependencies.
|
||||||
|
|
||||||
|
Uses uv if available (much faster), falls back to standard venv + pip.
|
||||||
|
"""
|
||||||
venv_dir = BUILD_DIR / "sidecar-venv"
|
venv_dir = BUILD_DIR / "sidecar-venv"
|
||||||
if venv_dir.exists():
|
if venv_dir.exists():
|
||||||
shutil.rmtree(venv_dir)
|
shutil.rmtree(venv_dir)
|
||||||
|
|
||||||
|
use_uv = _has_uv()
|
||||||
|
|
||||||
|
if use_uv:
|
||||||
|
print(f"[build] Creating venv with uv at {venv_dir}")
|
||||||
|
subprocess.run(
|
||||||
|
["uv", "venv", "--python", f"{sys.version_info.major}.{sys.version_info.minor}",
|
||||||
|
str(venv_dir)],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
else:
|
||||||
print(f"[build] Creating venv at {venv_dir}")
|
print(f"[build] Creating venv at {venv_dir}")
|
||||||
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
|
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
|
||||||
|
|
||||||
# Determine python path inside venv — use `python -m pip` instead of
|
# Determine python path inside venv
|
||||||
# calling pip directly to avoid permission errors on Windows
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
python = str(venv_dir / "Scripts" / "python")
|
python = str(venv_dir / "Scripts" / "python")
|
||||||
else:
|
else:
|
||||||
python = str(venv_dir / "bin" / "python")
|
python = str(venv_dir / "bin" / "python")
|
||||||
|
|
||||||
def pip_install(*args: str) -> None:
|
def pkg_install(*args: str) -> None:
|
||||||
|
if use_uv:
|
||||||
|
subprocess.run(["uv", "pip", "install", "--python", python, *args], check=True)
|
||||||
|
else:
|
||||||
subprocess.run([python, "-m", "pip", *args], check=True)
|
subprocess.run([python, "-m", "pip", *args], check=True)
|
||||||
|
|
||||||
# Upgrade pip
|
if not use_uv:
|
||||||
pip_install("install", "--upgrade", "pip", "setuptools", "wheel")
|
# Upgrade pip (uv doesn't need this)
|
||||||
|
pkg_install("install", "--upgrade", "pip", "setuptools", "wheel")
|
||||||
|
|
||||||
# Install torch (CPU-only to avoid bundling ~2GB of CUDA libs)
|
# Install torch (CPU-only to avoid bundling ~2GB of CUDA libs)
|
||||||
if cpu_only:
|
if cpu_only:
|
||||||
print("[build] Installing PyTorch (CPU-only)")
|
print("[build] Installing PyTorch (CPU-only)")
|
||||||
pip_install(
|
pkg_install(
|
||||||
"install", "torch", "torchaudio",
|
"install", "torch", "torchaudio",
|
||||||
"--index-url", "https://download.pytorch.org/whl/cpu",
|
"--index-url", "https://download.pytorch.org/whl/cpu",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print("[build] Installing PyTorch (default, may include CUDA)")
|
print("[build] Installing PyTorch (default, may include CUDA)")
|
||||||
pip_install("install", "torch", "torchaudio")
|
pkg_install("install", "torch", "torchaudio")
|
||||||
|
|
||||||
# Install project and dev deps (includes pyinstaller)
|
# Install project and dev deps (includes pyinstaller)
|
||||||
print("[build] Installing project dependencies")
|
print("[build] Installing project dependencies")
|
||||||
pip_install("install", "-e", f"{SCRIPT_DIR}[dev]")
|
pkg_install("install", "-e", f"{SCRIPT_DIR}[dev]")
|
||||||
|
|
||||||
return Path(python)
|
return Path(python)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user