All checks were successful
Build Sidecars / Bump sidecar version and tag (push) Successful in 7s
Release / Bump version and tag (push) Successful in 5s
Build Sidecars / Build Sidecar (macOS) (push) Successful in 4m32s
Release / Build App (macOS) (push) Successful in 1m16s
Build Sidecars / Build Sidecar (Linux) (push) Successful in 16m28s
Release / Build App (Linux) (push) Successful in 4m26s
Build Sidecars / Build Sidecar (Windows) (push) Successful in 33m5s
Release / Build App (Windows) (push) Successful in 3m29s
Diarization: Audio.crop patch now pads short segments with zeros to match the expected duration. pyannote batches embeddings with vstack which requires uniform tensor sizes — the last segment of a file can be shorter than the 10s window. CI: Reordered sidecar workflow to check for python/ changes FIRST, before bumping version or configuring git. All subsequent steps are gated on has_changes. This prevents unnecessary version bumps and build runs when only app code changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
403 lines
15 KiB
YAML
403 lines
15 KiB
YAML
name: Build Sidecars
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['python/**']
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
bump-sidecar-version:
|
|
name: Bump sidecar version and tag
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.bump.outputs.version }}
|
|
tag: ${{ steps.bump.outputs.tag }}
|
|
has_changes: ${{ steps.check_changes.outputs.has_changes }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Check for python changes
|
|
id: check_changes
|
|
run: |
|
|
# If triggered by workflow_dispatch, always build
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
# Check if any python/ files changed in this commit
|
|
CHANGED=$(git diff --name-only HEAD~1 HEAD -- python/ 2>/dev/null || echo "")
|
|
if [ -n "$CHANGED" ]; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
echo "Python changes detected: $CHANGED"
|
|
else
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
echo "No python/ changes detected, skipping sidecar build"
|
|
fi
|
|
|
|
- name: Configure git
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
|
|
- name: Bump sidecar patch version
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
id: bump
|
|
run: |
|
|
# Read current version from python/pyproject.toml
|
|
CURRENT=$(grep '^version = ' python/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
|
echo "Current sidecar version: ${CURRENT}"
|
|
|
|
# Increment patch number
|
|
MAJOR=$(echo "${CURRENT}" | cut -d. -f1)
|
|
MINOR=$(echo "${CURRENT}" | cut -d. -f2)
|
|
PATCH=$(echo "${CURRENT}" | cut -d. -f3)
|
|
NEW_PATCH=$((PATCH + 1))
|
|
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
|
echo "New sidecar version: ${NEW_VERSION}"
|
|
|
|
# Update python/pyproject.toml
|
|
sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" python/pyproject.toml
|
|
|
|
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
|
echo "tag=sidecar-v${NEW_VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Commit and tag
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
NEW_VERSION="${{ steps.bump.outputs.version }}"
|
|
TAG="${{ steps.bump.outputs.tag }}"
|
|
git add python/pyproject.toml
|
|
git commit -m "chore: bump sidecar version to ${NEW_VERSION} [skip ci]"
|
|
git tag "${TAG}"
|
|
|
|
# Push using token for authentication (rebase in case another workflow pushed first)
|
|
REMOTE_URL=$(git remote get-url origin | sed "s|://|://gitea-actions:${BUILD_TOKEN}@|")
|
|
git pull --rebase "${REMOTE_URL}" main || true
|
|
git push "${REMOTE_URL}" HEAD:main
|
|
git push "${REMOTE_URL}" "${TAG}"
|
|
|
|
- name: Create Gitea release
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ steps.bump.outputs.tag }}"
|
|
VERSION="${{ steps.bump.outputs.version }}"
|
|
RELEASE_NAME="Sidecar v${VERSION}"
|
|
|
|
curl -s -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated sidecar build.\", \"draft\": false, \"prerelease\": false}" \
|
|
"${REPO_API}/releases"
|
|
echo "Created release: ${RELEASE_NAME}"
|
|
|
|
build-sidecar-linux:
|
|
name: Build Sidecar (Linux)
|
|
needs: bump-sidecar-version
|
|
if: needs.bump-sidecar-version.outputs.has_changes == 'true'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.bump-sidecar-version.outputs.tag }}
|
|
|
|
- name: Install uv
|
|
run: |
|
|
if command -v uv &> /dev/null; then
|
|
echo "uv already installed: $(uv --version)"
|
|
else
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
fi
|
|
|
|
- name: Install ffmpeg
|
|
run: sudo apt-get update && sudo apt-get install -y ffmpeg
|
|
|
|
- name: Set up Python
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Build sidecar (CUDA)
|
|
working-directory: python
|
|
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --with-cuda
|
|
|
|
- name: Package sidecar (CUDA)
|
|
run: |
|
|
cd python/dist/voice-to-notes-sidecar && zip -r ../../../sidecar-linux-x86_64-cuda.zip .
|
|
|
|
- name: Build sidecar (CPU)
|
|
working-directory: python
|
|
run: |
|
|
rm -rf dist/voice-to-notes-sidecar
|
|
uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
|
|
|
- name: Package sidecar (CPU)
|
|
run: |
|
|
cd python/dist/voice-to-notes-sidecar && zip -r ../../../sidecar-linux-x86_64-cpu.zip .
|
|
|
|
- name: Upload to sidecar release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
sudo apt-get install -y jq
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ needs.bump-sidecar-version.outputs.tag }}"
|
|
|
|
# Find the sidecar release by tag (retry up to 30 times with 10s delay)
|
|
echo "Waiting for sidecar release ${TAG} to be available..."
|
|
for i in $(seq 1 30); do
|
|
RELEASE_JSON=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/tags/${TAG}")
|
|
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id // empty')
|
|
|
|
if [ -n "${RELEASE_ID}" ] && [ "${RELEASE_ID}" != "null" ]; then
|
|
echo "Found sidecar release: ${TAG} (ID: ${RELEASE_ID})"
|
|
break
|
|
fi
|
|
|
|
echo "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
sleep 10
|
|
done
|
|
|
|
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
|
|
echo "ERROR: Failed to find sidecar release for tag ${TAG} after 30 attempts."
|
|
exit 1
|
|
fi
|
|
|
|
for file in sidecar-*.zip; do
|
|
filename=$(basename "$file")
|
|
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
|
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
|
|
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
|
if [ -n "${ASSET_ID}" ]; then
|
|
curl -s -X DELETE -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
|
fi
|
|
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
-T "$file" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
|
|
echo "Upload response: HTTP ${HTTP_CODE}"
|
|
done
|
|
|
|
build-sidecar-windows:
|
|
name: Build Sidecar (Windows)
|
|
needs: bump-sidecar-version
|
|
if: needs.bump-sidecar-version.outputs.has_changes == 'true'
|
|
runs-on: windows-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.bump-sidecar-version.outputs.tag }}
|
|
|
|
- name: Install uv
|
|
shell: powershell
|
|
run: |
|
|
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
|
Write-Host "uv already installed: $(uv --version)"
|
|
} else {
|
|
irm https://astral.sh/uv/install.ps1 | iex
|
|
echo "$env:USERPROFILE\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
}
|
|
|
|
- name: Install ffmpeg
|
|
shell: powershell
|
|
run: choco install ffmpeg -y
|
|
|
|
- name: Set up Python
|
|
shell: powershell
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install 7-Zip
|
|
shell: powershell
|
|
run: |
|
|
if (-not (Get-Command 7z -ErrorAction SilentlyContinue)) {
|
|
choco install 7zip -y
|
|
}
|
|
|
|
- name: Build sidecar (CUDA)
|
|
shell: powershell
|
|
working-directory: python
|
|
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --with-cuda
|
|
|
|
- name: Package sidecar (CUDA)
|
|
shell: powershell
|
|
run: |
|
|
7z a -tzip -mx=5 sidecar-windows-x86_64-cuda.zip .\python\dist\voice-to-notes-sidecar\*
|
|
|
|
- name: Build sidecar (CPU)
|
|
shell: powershell
|
|
working-directory: python
|
|
run: |
|
|
Remove-Item -Recurse -Force dist\voice-to-notes-sidecar
|
|
uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
|
|
|
- name: Package sidecar (CPU)
|
|
shell: powershell
|
|
run: |
|
|
7z a -tzip -mx=5 sidecar-windows-x86_64-cpu.zip .\python\dist\voice-to-notes-sidecar\*
|
|
|
|
- name: Upload to sidecar release
|
|
shell: powershell
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
$REPO_API = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
$Headers = @{ "Authorization" = "token $env:BUILD_TOKEN" }
|
|
$TAG = "${{ needs.bump-sidecar-version.outputs.tag }}"
|
|
|
|
# Find the sidecar release by tag (retry up to 30 times with 10s delay)
|
|
Write-Host "Waiting for sidecar release ${TAG} to be available..."
|
|
$RELEASE_ID = $null
|
|
|
|
for ($i = 1; $i -le 30; $i++) {
|
|
try {
|
|
$release = Invoke-RestMethod -Uri "${REPO_API}/releases/tags/${TAG}" -Headers $Headers -ErrorAction Stop
|
|
$RELEASE_ID = $release.id
|
|
|
|
if ($RELEASE_ID) {
|
|
Write-Host "Found sidecar release: ${TAG} (ID: ${RELEASE_ID})"
|
|
break
|
|
}
|
|
} catch {
|
|
# Release not ready yet
|
|
}
|
|
|
|
Write-Host "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
Start-Sleep -Seconds 10
|
|
}
|
|
|
|
if (-not $RELEASE_ID) {
|
|
Write-Host "ERROR: Failed to find sidecar release for tag ${TAG} after 30 attempts."
|
|
exit 1
|
|
}
|
|
|
|
Get-ChildItem -Path . -Filter "sidecar-*.zip" | ForEach-Object {
|
|
$filename = $_.Name
|
|
$encodedName = [System.Uri]::EscapeDataString($filename)
|
|
$size = [math]::Round($_.Length / 1MB, 1)
|
|
Write-Host "Uploading ${filename} (${size} MB)..."
|
|
|
|
try {
|
|
$assets = Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets" -Headers $Headers
|
|
$existing = $assets | Where-Object { $_.name -eq $filename }
|
|
if ($existing) {
|
|
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets/$($existing.id)" -Method Delete -Headers $Headers
|
|
}
|
|
} catch {}
|
|
|
|
$uploadUrl = "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}"
|
|
$result = curl.exe --fail --silent --show-error `
|
|
-X POST `
|
|
-H "Authorization: token $env:BUILD_TOKEN" `
|
|
-H "Content-Type: application/octet-stream" `
|
|
-T "$($_.FullName)" `
|
|
"$uploadUrl" 2>&1
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Upload successful: ${filename}"
|
|
} else {
|
|
Write-Host "WARNING: Upload failed for ${filename}: ${result}"
|
|
}
|
|
}
|
|
|
|
build-sidecar-macos:
|
|
name: Build Sidecar (macOS)
|
|
needs: bump-sidecar-version
|
|
if: needs.bump-sidecar-version.outputs.has_changes == 'true'
|
|
runs-on: macos-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ needs.bump-sidecar-version.outputs.tag }}
|
|
|
|
- name: Install uv
|
|
run: |
|
|
if command -v uv &> /dev/null; then
|
|
echo "uv already installed: $(uv --version)"
|
|
else
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
fi
|
|
|
|
- name: Install ffmpeg
|
|
run: brew install ffmpeg
|
|
|
|
- name: Set up Python
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Build sidecar (CPU)
|
|
working-directory: python
|
|
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
|
|
|
- name: Package sidecar (CPU)
|
|
run: |
|
|
cd python/dist/voice-to-notes-sidecar && zip -r ../../../sidecar-macos-aarch64-cpu.zip .
|
|
|
|
- name: Upload to sidecar release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
which jq || brew install jq
|
|
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ needs.bump-sidecar-version.outputs.tag }}"
|
|
|
|
# Find the sidecar release by tag (retry up to 30 times with 10s delay)
|
|
echo "Waiting for sidecar release ${TAG} to be available..."
|
|
for i in $(seq 1 30); do
|
|
RELEASE_JSON=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/tags/${TAG}")
|
|
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id // empty')
|
|
|
|
if [ -n "${RELEASE_ID}" ] && [ "${RELEASE_ID}" != "null" ]; then
|
|
echo "Found sidecar release: ${TAG} (ID: ${RELEASE_ID})"
|
|
break
|
|
fi
|
|
|
|
echo "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
sleep 10
|
|
done
|
|
|
|
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
|
|
echo "ERROR: Failed to find sidecar release for tag ${TAG} after 30 attempts."
|
|
exit 1
|
|
fi
|
|
|
|
for file in sidecar-*.zip; do
|
|
filename=$(basename "$file")
|
|
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
|
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
|
|
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
|
if [ -n "${ASSET_ID}" ]; then
|
|
curl -s -X DELETE -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
|
fi
|
|
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
-T "$file" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
|
|
echo "Upload response: HTTP ${HTTP_CODE}"
|
|
done
|