Support Multisegments for TTS input #3740
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
workflow_dispatch: | |
jobs: | |
tests: | |
# Don't run tests for PRs on forks | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
# disabled Intel Macs due to pytorch 2.3+ not supporting it | |
# macos-14-large, | |
macos-14, | |
windows-2019, | |
ubuntu-20.04, | |
namespace-profile-default-arm64, | |
] | |
python_version: ["3.9", "3.12"] | |
test_group: ["base"] | |
include: | |
# Include llm, stt, and tts tests only on Ubuntu 20.04 with Python 3.9 | |
- os: ubuntu-20.04 | |
python_version: "3.12" | |
test_group: llm | |
- os: ubuntu-20.04 | |
python_version: "3.12" | |
test_group: stt | |
- os: ubuntu-20.04 | |
python_version: "3.12" | |
test_group: tts | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.test_group }} β ${{ matrix.os }}) (py${{ matrix.python_version }}) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
- name: Cache packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
/var/cache/apt/archives | |
~/Library/Caches/Homebrew | |
C:\ProgramData\chocolatey\lib\ffmpeg | |
key: ${{ runner.os }}-cache | |
restore-keys: | | |
${{ runner.os }}-cache | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
cache: "pip" | |
- name: Install ffmpeg (Linux) | |
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'namespace-profile-default-arm64' }} | |
run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
# Azure plugin fails with OpenSSL3, and Ubuntu 22.04 does not include libssl1.1 in its repos | |
- name: Install libssl 1.1 (Linux 22.04) | |
if: ${{ matrix.os == 'namespace-profile-default-arm64' }} | |
run: | | |
wget https://old-releases.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1_arm64.deb | |
wget https://old-releases.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1_arm64.deb | |
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1_arm64.deb | |
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1_arm64.deb | |
- name: Install ffmpeg (macOS) | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: brew install ffmpeg | |
- name: Install ffmpeg (Windows) | |
if: ${{ matrix.os == 'windows-2019' }} | |
run: choco install ffmpeg | |
- name: Install packages | |
shell: bash | |
run: | | |
pip install pytest pytest-asyncio pytest-timeout './livekit-agents[codecs]' psutil | |
pip install -r ./tests/test-requirements.txt | |
./livekit-plugins/install_local.sh | |
- name: Run tests | |
shell: bash | |
env: | |
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }} | |
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }} | |
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }} | |
DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ELEVEN_API_KEY: ${{ secrets.ELEVEN_API_KEY }} | |
CARTESIA_API_KEY: ${{ secrets.CARTESIA_API_KEY }} | |
AZURE_SPEECH_KEY: ${{ secrets.AZURE_SPEECH_KEY }} | |
AZURE_SPEECH_REGION: ${{ secrets.AZURE_SPEECH_REGION }} # nit: doesn't have to be secret | |
GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_CREDENTIALS_JSON }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
ASSEMBLYAI_API_KEY: ${{ secrets.ASSEMBLYAI_API_KEY }} | |
FAL_KEY: ${{ secrets.FAL_KEY }} | |
GOOGLE_APPLICATION_CREDENTIALS: google.json | |
PYTEST_ADDOPTS: "--color=yes" | |
working-directory: tests | |
run: | | |
echo "$GOOGLE_CREDENTIALS_JSON" > google.json | |
case "${{ matrix.test_group }}" in | |
base) | |
test_files="test_aio.py test_tokenizer.py test_vad.py test_ipc.py test_tts_fallback.py test_stt_fallback.py test_message_change.py test_build_func_desc.py test_create_func.py" | |
;; | |
llm) | |
test_files="test_llm.py" | |
;; | |
stt) | |
test_files="test_stt.py" | |
;; | |
tts) | |
test_files="test_tts.py" | |
;; | |
*) | |
echo "Unknown test group: ${{ matrix.test_group }}" | |
exit 1 | |
;; | |
esac | |
pytest $test_files |