-
Notifications
You must be signed in to change notification settings - Fork 439
140 lines (128 loc) Β· 5.13 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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: [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.9"
test_group: llm
- os: ubuntu-20.04
python_version: "3.9"
test_group: stt
- os: ubuntu-20.04
python_version: "3.9"
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: "3.9"
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: |
pip3 install pytest pytest-asyncio pytest-timeout './livekit-agents[codecs]' psutil
pip3 install -r ./tests/test-requirements.txt
pip3 install ./livekit-agents \
./livekit-plugins/livekit-plugins-openai \
./livekit-plugins/livekit-plugins-deepgram \
./livekit-plugins/livekit-plugins-google \
./livekit-plugins/livekit-plugins-nltk \
./livekit-plugins/livekit-plugins-silero \
./livekit-plugins/livekit-plugins-elevenlabs \
./livekit-plugins/livekit-plugins-cartesia \
./livekit-plugins/livekit-plugins-azure \
./livekit-plugins/livekit-plugins-anthropic \
./livekit-plugins/livekit-plugins-assemblyai \
./livekit-plugins/livekit-plugins-fal
- 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"
;;
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