Skip to content

Prevent hard clipping across audio output backends #20

Prevent hard clipping across audio output backends

Prevent hard clipping across audio output backends #20

name: TFLite cross-platform
# The optimized/tflite release must run identically on macOS, Linux, and
# Windows. This checks, on every OS ai-edge-litert ships wheels for:
# byte-compilation of the scripts, LiteRT importability, the weights
# link-or-copy fallback (no symlink privilege needed on Windows), console
# encoding under the runner's native code page, and --play dispatch.
# NO model downloads happen in CI.
on:
push:
paths:
- "optimized/tflite/**"
- ".github/workflows/tflite-cross-platform.yml"
pull_request:
paths:
- "optimized/tflite/**"
- ".github/workflows/tflite-cross-platform.yml"
jobs:
test:
strategy:
fail-fast: false
# Exactly the set ai-edge-litert has wheels for: manylinux x86_64 +
# aarch64, macosx_12_0_arm64, win_amd64. No macOS-Intel (macos-13) and
# no Windows-ARM runners — those combos have no wheel.
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install runtime requirements
run: python -m pip install -r optimized/tflite/requirements.txt
- name: Byte-compile all scripts
run: |
python -m py_compile \
optimized/tflite/scripts/sa3_tflite.py \
optimized/tflite/scripts/weights.py \
optimized/tflite/scripts/install.py \
optimized/tflite/scripts/examples.py \
optimized/tflite/scripts/test_windows_compat.py \
optimized/tflite/models/defs/tflite_pipeline.py \
optimized/tflite/models/defs/wav_io.py
- name: LiteRT interpreter imports
run: python -c "from ai_edge_litert.interpreter import Interpreter"
- name: Standalone subtree import smoke
run: |
bundle_dir="$(mktemp -d)/sa3_tflite"
cp -R optimized/tflite "$bundle_dir"
cp stable_audio_3/audio_output.py "$bundle_dir/models/defs/audio_output.py"
cd "$bundle_dir"
python scripts/sa3_tflite.py --help > /dev/null
- name: Windows-compat test suite
run: python optimized/tflite/scripts/test_windows_compat.py
- name: bootstrap.ps1 parses (PowerShell syntax check)
shell: pwsh
run: |
$errs = $null
[void][System.Management.Automation.Language.Parser]::ParseFile(
"optimized/tflite/bootstrap.ps1", [ref]$null, [ref]$errs)
if ($errs) { $errs | ForEach-Object { Write-Error $_.Message }; exit 1 }
[void][System.Management.Automation.Language.Parser]::ParseFile(
"optimized/tflite/sa3.ps1", [ref]$null, [ref]$errs)
if ($errs) { $errs | ForEach-Object { Write-Error $_.Message }; exit 1 }
- name: bootstrap.sh parses (bash syntax check)
if: runner.os != 'Windows'
run: bash -n optimized/tflite/bootstrap.sh
# Real install flow under the OS's bash (Git Bash on Windows — the
# environment a Windows user following the Unix instructions lands in;
# this exact path shipped broken once: .venv/Scripts vs .venv/bin).
- name: install.sh end-to-end + sa3 wrapper (bash on every OS)
run: |
cd optimized/tflite
./install.sh -y < /dev/null
./sa3 --help