-
Notifications
You must be signed in to change notification settings - Fork 27
226 lines (198 loc) · 6.6 KB
/
Copy pathpython-tests.yml
File metadata and controls
226 lines (198 loc) · 6.6 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Python Tests
on:
pull_request:
paths:
- "*.py"
- "setup-requirements.txt"
- ".coveragerc"
- "tests/unit/**"
- "extras/chronicle-setup/**"
- "extras/chronicle-client/**"
- "backends/advanced/src/**"
- "backends/advanced/tests/**"
- "backends/advanced/pyproject.toml"
- "backends/advanced/uv.lock"
- "extras/asr-services/common/**"
- "extras/asr-services/providers/**"
- "extras/asr-services/tests/**"
- "extras/asr-services/pyproject.toml"
- "extras/asr-services/uv.lock"
- ".github/workflows/python-tests.yml"
push:
branches: [dev, main]
workflow_dispatch:
permissions:
contents: read
jobs:
root-unit:
name: Root tooling unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
env:
# services.py and status.py live at the repo root, so tests/unit needs the
# workspace itself importable, not just the backend package.
PYTHONPATH: ${{ github.workspace }}/backends/advanced/src:${{ github.workspace }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Run unit tests with coverage
# fastapi/uvicorn are the node agent's own runtime deps: tests/unit imports
# edge/service_manager.py, which serves the WebUI's service controls. They are
# not in setup-requirements.txt, which covers the wizard rather than the agent.
run: >-
uv run
--with-requirements setup-requirements.txt
--with pytest
--with pytest-cov
--with fastapi
--with uvicorn
pytest tests/unit
--cov
--cov-config=.coveragerc
--cov-report=term-missing
--cov-report=xml
--cov-report=html
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: root-unit-coverage
path: coverage-reports/
if-no-files-found: warn
retention-days: 14
client-packages:
name: Shared client/setup package tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
# Both packages locate the checkout by searching for marker files, so their
# tests must run against a real one — hence no working-directory override.
- name: chronicle-setup
run: >-
uv run --no-project
--with ./extras/chronicle-setup
--with pytest
pytest extras/chronicle-setup/tests -q
- name: chronicle-client
run: >-
uv run --no-project
--with ./extras/chronicle-client
--with pytest
pytest extras/chronicle-client/tests -q
advanced-backend-unit:
name: Advanced backend unit tests
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: backends/advanced
services:
# Some backend tests hit real local services (vault locks are Redis-backed
# and fail closed; the audio-chunk and silence-trim tests assert on real
# Mongo documents). Match the defaults the code assumes:
# redis://localhost:6379, mongodb://localhost:27018. Without them those
# modules skip themselves rather than failing — see tests/conftest.py.
redis:
image: redis:7-alpine
ports:
- 6379:6379
mongo:
image: mongo:8
ports:
- 27018:27017
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install system dependencies
# libopus0: native library behind opuslib (services/device_audio.py),
# imported transitively during test collection.
# ffmpeg: the audio-persistence tests shell out to the binary to convert
# and reconstruct WAV/Opus chunks.
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libopus0 ffmpeg
- name: Install test dependencies
run: uv sync --locked --group test
- name: Run unit tests with coverage
# chronicle_setup comes in on the command line rather than as a path dep:
# tests/test_memory_setup_wizard.py loads backends/advanced/init.py, which
# imports it, but ../../extras is outside the Docker build context, so
# declaring it in pyproject.toml would break the image build. Same reasoning
# as the chronicle-wearable-sdk git source there.
run: >-
uv run --group test
--with ../../extras/chronicle-setup
pytest
--cov=advanced_omi_backend
--cov-report=term-missing
--cov-report=xml
--cov-report=html
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: advanced-backend-unit-coverage
path: backends/advanced/coverage-reports/
if-no-files-found: warn
retention-days: 14
asr-unit:
name: ASR unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: extras/asr-services
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install test dependencies
run: uv sync --locked --group test
- name: Run unit tests with coverage
run: >-
uv run --group test pytest
--ignore=tests/test_parakeet_service.py
--cov=common
--cov=providers
--cov-report=term-missing
--cov-report=xml
--cov-report=html
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: asr-unit-coverage
path: extras/asr-services/coverage-reports/
if-no-files-found: warn
retention-days: 14