@@ -182,6 +182,80 @@ jobs:
182182 file api_es_male.wav
183183 ls -lh api_es_male.wav
184184
185+ - name : " Server: POST /v1/audio/speech (mp3)"
186+ run : |
187+ curl -sf -X POST http://127.0.0.1:8090/v1/audio/speech \
188+ -H "Content-Type: application/json" \
189+ -d '{"input":"Hello.","voice":"alloy","response_format":"mp3"}' \
190+ -o api_alloy.mp3
191+ file api_alloy.mp3
192+ ls -lh api_alloy.mp3
193+
194+ - name : " Server: POST /v1/audio/speech (flac)"
195+ run : |
196+ curl -sf -X POST http://127.0.0.1:8090/v1/audio/speech \
197+ -H "Content-Type: application/json" \
198+ -d '{"input":"Hello.","voice":"alloy","response_format":"flac"}' \
199+ -o api_alloy.flac
200+ file api_alloy.flac
201+ ls -lh api_alloy.flac
202+
203+ - name : " Server: POST /v1/audio/speech (ogg/opus)"
204+ run : |
205+ curl -sf -X POST http://127.0.0.1:8090/v1/audio/speech \
206+ -H "Content-Type: application/json" \
207+ -d '{"input":"Hello.","voice":"alloy","response_format":"ogg"}' \
208+ -o api_alloy.ogg
209+ file api_alloy.ogg
210+ ls -lh api_alloy.ogg
211+
212+ - name : " Server: POST /v1/audio/speech (pcm)"
213+ run : |
214+ curl -sf -X POST http://127.0.0.1:8090/v1/audio/speech \
215+ -H "Content-Type: application/json" \
216+ -d '{"input":"Hello.","voice":"alloy","response_format":"pcm"}' \
217+ -o api_alloy.pcm
218+ test -s api_alloy.pcm
219+ ls -lh api_alloy.pcm
220+
221+ - name : " Server: Validation errors"
222+ run : |
223+ # Empty input -> 400
224+ STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X POST http://127.0.0.1:8090/v1/audio/speech \
225+ -H "Content-Type: application/json" \
226+ -d '{"input":"","voice":"alloy"}')
227+ echo "Empty input: $STATUS"
228+ [ "$STATUS" = "400" ] || (echo "Expected 400, got $STATUS"; exit 1)
229+
230+ # Invalid format -> 400
231+ STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X POST http://127.0.0.1:8090/v1/audio/speech \
232+ -H "Content-Type: application/json" \
233+ -d '{"input":"Hello.","voice":"alloy","response_format":"aac"}')
234+ echo "Invalid format: $STATUS"
235+ [ "$STATUS" = "400" ] || (echo "Expected 400, got $STATUS"; exit 1)
236+
237+ # Speed out of range -> 400
238+ STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X POST http://127.0.0.1:8090/v1/audio/speech \
239+ -H "Content-Type: application/json" \
240+ -d '{"input":"Hello.","voice":"alloy","speed":10.0}')
241+ echo "Invalid speed: $STATUS"
242+ [ "$STATUS" = "400" ] || (echo "Expected 400, got $STATUS"; exit 1)
243+
244+ - name : " Server: Streaming SSE"
245+ if : matrix.backend != 'mlx'
246+ run : |
247+ curl -sN -X POST http://127.0.0.1:8090/v1/audio/speech \
248+ -H "Content-Type: application/json" \
249+ -d '{"input":"Hello.","voice":"alloy","stream":true}' \
250+ --max-time 300 \
251+ -o sse_output.txt || true
252+ echo "--- SSE output (first 500 chars) ---"
253+ head -c 500 sse_output.txt
254+ echo ""
255+ grep -q "speech.audio.delta" sse_output.txt || (echo "Missing speech.audio.delta"; exit 1)
256+ grep -q "speech.audio.done" sse_output.txt || (echo "Missing speech.audio.done"; exit 1)
257+ echo "Streaming test passed"
258+
185259 - name : " Server: Stop"
186260 if : always()
187261 run : kill ${{ env.SERVER_PID }} 2>/dev/null || true
@@ -195,7 +269,12 @@ jobs:
195269 uses : actions/upload-artifact@v4
196270 with :
197271 name : audio-${{ matrix.os }}-${{ matrix.backend }}
198- path : " *.wav"
272+ path : |
273+ *.wav
274+ *.mp3
275+ *.flac
276+ *.ogg
277+ *.pcm
199278
200279 - name : Upload binaries
201280 uses : actions/upload-artifact@v4
0 commit comments