Skip to content

Scale and harden continuous audio acquisition pipeline #85

Scale and harden continuous audio acquisition pipeline

Scale and harden continuous audio acquisition pipeline #85

Workflow file for this run

name: Docker
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
UV_TORCH_BACKEND: cu129
permissions:
contents: read
packages: write
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@v8.2.0
with:
version: "0.9.2"
- name: Validate metadata
run: |
python - <<'PY'
import tomllib
for path in ("pyproject.toml", "pylock.toml"):
with open(path, "rb") as f:
tomllib.load(f)
print(f"{path}: ok")
PY
- name: Check lockfile
run: |
uv pip compile pyproject.toml --group dev --extra api --upgrade \
--python-version 3.14 \
--python-platform x86_64-manylinux_2_28 \
--torch-backend "${UV_TORCH_BACKEND}" \
--format pylock.toml \
--output-file /tmp/pylock.toml \
--quiet
diff -u <(tail -n +3 pylock.toml) <(tail -n +3 /tmp/pylock.toml)
- name: Check locked install plan
run: |
python -m venv /tmp/sam-audio-venv
uv pip sync pylock.toml --group dev \
--extra api \
--torch-backend "${UV_TORCH_BACKEND}" \
--strict \
--dry-run \
--python /tmp/sam-audio-venv/bin/python \
--python-platform x86_64-manylinux_2_28
- name: Check formatting
run: |
uvx ruff format --check .
- name: Lint
run: |
uvx ruff check .
image:
runs-on: ubuntu-latest
needs: checks
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and publish image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
UV_TORCH_BACKEND=${{ env.UV_TORCH_BACKEND }}
cache-from: type=gha
cache-to: type=gha,mode=max