|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master, main, "experimental/*"] |
| 6 | + pull_request: |
| 7 | + branches: [master, main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: actions/setup-python@v5 |
| 15 | + with: |
| 16 | + python-version: "3.12" |
| 17 | + - name: Install linters |
| 18 | + run: pip install ruff |
| 19 | + - name: Lint Python |
| 20 | + run: | |
| 21 | + ruff check main_stt.py cold_worker.py --select E,F,W --ignore E501 |
| 22 | +
|
| 23 | + structure: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: "3.12" |
| 30 | + - name: Validate requirements file |
| 31 | + run: | |
| 32 | + test -f requirements.txt || { echo "MISSING: requirements.txt"; exit 1; } |
| 33 | + python -c " |
| 34 | + with open('requirements.txt') as fh: |
| 35 | + for line in fh: |
| 36 | + line = line.strip() |
| 37 | + if line and not line.startswith('#') and not line.startswith('-r'): |
| 38 | + print(f' {line}') |
| 39 | + " |
| 40 | + echo "requirements.txt OK." |
| 41 | + - name: Validate server module syntax |
| 42 | + run: | |
| 43 | + python -m py_compile main_stt.py |
| 44 | + python -m py_compile cold_worker.py |
| 45 | + echo "main_stt.py + cold_worker.py parse cleanly." |
| 46 | + - name: Validate endpoint declarations |
| 47 | + run: | |
| 48 | + python -c " |
| 49 | + src = open('main_stt.py').read() |
| 50 | + required_routes = [ |
| 51 | + '/v1/audio/transcriptions', |
| 52 | + '/v1/audio/translations', |
| 53 | + '/v1/models', |
| 54 | + '/health', |
| 55 | + ] |
| 56 | + for r in required_routes: |
| 57 | + assert r in src, f'Route missing from main_stt.py: {r}' |
| 58 | + print(f'Route OK: {r}') |
| 59 | + " |
| 60 | +
|
| 61 | + # GPU smoke test — only runs on self-hosted runners with NVIDIA GPU. |
| 62 | + # Skip on GitHub-hosted runners (no GPU available). |
| 63 | + smoke-whisper: |
| 64 | + runs-on: [self-hosted, gpu] |
| 65 | + if: false # Enable when a self-hosted GPU runner is configured |
| 66 | + needs: [lint, structure] |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + - name: Setup venv + install |
| 70 | + run: | |
| 71 | + python3.12 -m venv venv |
| 72 | + source venv/bin/activate |
| 73 | + pip install --upgrade pip |
| 74 | + pip install -r requirements.txt |
| 75 | + - name: Start server |
| 76 | + run: | |
| 77 | + source venv/bin/activate |
| 78 | + WHISPER_MODEL=tiny \ |
| 79 | + uvicorn main_stt:app --host 127.0.0.1 --port 5001 & |
| 80 | + for i in $(seq 1 60); do |
| 81 | + sleep 2 |
| 82 | + curl -sf http://127.0.0.1:5001/health && break |
| 83 | + done |
| 84 | + - name: Health check |
| 85 | + run: | |
| 86 | + HEALTH=$(curl -s http://127.0.0.1:5001/health) |
| 87 | + echo "$HEALTH" | python3 -c " |
| 88 | + import json, sys |
| 89 | + d = json.load(sys.stdin) |
| 90 | + assert d['status'] == 'ok', f'Health not ok: {d}' |
| 91 | + assert d['hot_worker_loaded'], 'Hot worker not loaded' |
| 92 | + print('Health check passed.') |
| 93 | + " |
0 commit comments