Spaces:
Configuration error
Configuration error
Commit Β·
6a4b2fc
1
Parent(s): 77c9bce
ci: add GitHub Actions workflow for python quality, tests, notebook freeze, and frontend build
Browse files- .github/workflows/ci.yml +124 -0
- README.md +3 -3
.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
pull_request:
|
| 7 |
+
branches: [main]
|
| 8 |
+
|
| 9 |
+
concurrency:
|
| 10 |
+
group: ${{ github.workflow }}-${{ github.ref }}
|
| 11 |
+
cancel-in-progress: true
|
| 12 |
+
|
| 13 |
+
permissions:
|
| 14 |
+
contents: read
|
| 15 |
+
|
| 16 |
+
env:
|
| 17 |
+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
| 18 |
+
PYTHONDONTWRITEBYTECODE: "1"
|
| 19 |
+
|
| 20 |
+
jobs:
|
| 21 |
+
python-quality:
|
| 22 |
+
name: Python quality (ruff + mypy)
|
| 23 |
+
runs-on: ubuntu-latest
|
| 24 |
+
timeout-minutes: 10
|
| 25 |
+
steps:
|
| 26 |
+
- uses: actions/checkout@v4
|
| 27 |
+
|
| 28 |
+
- name: Set up Python 3.11
|
| 29 |
+
uses: actions/setup-python@v5
|
| 30 |
+
with:
|
| 31 |
+
python-version: "3.11"
|
| 32 |
+
cache: pip
|
| 33 |
+
cache-dependency-path: |
|
| 34 |
+
requirements.txt
|
| 35 |
+
requirements-dev.txt
|
| 36 |
+
requirements-eval.txt
|
| 37 |
+
pyproject.toml
|
| 38 |
+
|
| 39 |
+
- name: Install dependencies
|
| 40 |
+
run: |
|
| 41 |
+
python -m pip install --upgrade pip
|
| 42 |
+
pip install -r requirements-dev.txt -r requirements-eval.txt
|
| 43 |
+
pip install -e .
|
| 44 |
+
|
| 45 |
+
- name: Ruff lint
|
| 46 |
+
run: ruff check src/captioning backend scripts tests
|
| 47 |
+
|
| 48 |
+
- name: Ruff format check
|
| 49 |
+
run: ruff format --check src/captioning backend scripts tests
|
| 50 |
+
|
| 51 |
+
- name: Mypy
|
| 52 |
+
run: mypy src/captioning backend/app scripts
|
| 53 |
+
|
| 54 |
+
python-tests:
|
| 55 |
+
name: pytest (Python ${{ matrix.python-version }})
|
| 56 |
+
runs-on: ubuntu-latest
|
| 57 |
+
timeout-minutes: 15
|
| 58 |
+
strategy:
|
| 59 |
+
fail-fast: false
|
| 60 |
+
matrix:
|
| 61 |
+
python-version: ["3.10", "3.11", "3.12"]
|
| 62 |
+
steps:
|
| 63 |
+
- uses: actions/checkout@v4
|
| 64 |
+
|
| 65 |
+
- name: Set up Python ${{ matrix.python-version }}
|
| 66 |
+
uses: actions/setup-python@v5
|
| 67 |
+
with:
|
| 68 |
+
python-version: ${{ matrix.python-version }}
|
| 69 |
+
cache: pip
|
| 70 |
+
cache-dependency-path: |
|
| 71 |
+
requirements.txt
|
| 72 |
+
requirements-dev.txt
|
| 73 |
+
requirements-eval.txt
|
| 74 |
+
pyproject.toml
|
| 75 |
+
|
| 76 |
+
- name: Install dependencies
|
| 77 |
+
run: |
|
| 78 |
+
python -m pip install --upgrade pip
|
| 79 |
+
pip install -r requirements-dev.txt -r requirements-eval.txt
|
| 80 |
+
pip install -e .
|
| 81 |
+
|
| 82 |
+
- name: Run pytest
|
| 83 |
+
run: pytest tests backend/app/tests -v --maxfail=5
|
| 84 |
+
|
| 85 |
+
notebook-freeze:
|
| 86 |
+
name: Notebook SHA-256 freeze
|
| 87 |
+
runs-on: ubuntu-latest
|
| 88 |
+
timeout-minutes: 5
|
| 89 |
+
steps:
|
| 90 |
+
- uses: actions/checkout@v4
|
| 91 |
+
|
| 92 |
+
- name: Set up Python 3.11
|
| 93 |
+
uses: actions/setup-python@v5
|
| 94 |
+
with:
|
| 95 |
+
python-version: "3.11"
|
| 96 |
+
|
| 97 |
+
- name: Verify IEEE notebook is byte-stable
|
| 98 |
+
run: make freeze-paper-notebook
|
| 99 |
+
|
| 100 |
+
frontend:
|
| 101 |
+
name: Frontend (lint + build)
|
| 102 |
+
runs-on: ubuntu-latest
|
| 103 |
+
timeout-minutes: 10
|
| 104 |
+
defaults:
|
| 105 |
+
run:
|
| 106 |
+
working-directory: frontend
|
| 107 |
+
steps:
|
| 108 |
+
- uses: actions/checkout@v4
|
| 109 |
+
|
| 110 |
+
- name: Set up Node 20
|
| 111 |
+
uses: actions/setup-node@v4
|
| 112 |
+
with:
|
| 113 |
+
node-version: "20"
|
| 114 |
+
cache: npm
|
| 115 |
+
cache-dependency-path: frontend/package-lock.json
|
| 116 |
+
|
| 117 |
+
- name: Install dependencies
|
| 118 |
+
run: npm ci
|
| 119 |
+
|
| 120 |
+
- name: Lint
|
| 121 |
+
run: npm run lint
|
| 122 |
+
|
| 123 |
+
- name: Build
|
| 124 |
+
run: npm run build
|
README.md
CHANGED
|
@@ -550,9 +550,9 @@ The backend test suite ([`backend/app/tests/`](backend/app/tests/)) introduced i
|
|
| 550 |
- [ ] **WS-E** β Frontend deploy to Vercel (static SPA, `VITE_API_BASE` baked at build time, SPA rewrites)
|
| 551 |
- [ ] **WS-F** β Production CORS: add the deployed Vercel origin to `serve.cors_allowed_origins`
|
| 552 |
- [ ] **WS-G** β GitHub Actions CI/CD:
|
| 553 |
-
- `ci.yml` β Python quality
|
| 554 |
-
- `deploy-backend.yml` β gated on `needs: ci`, pushes to the HF Space
|
| 555 |
-
- `deploy-frontend.yml` *(optional)* β Vercel-native GitHub integration is the recommended path
|
| 556 |
- [ ] **WS-H** β README "Live Demo" section (badges swapped to live HF Space + Vercel URLs) + `docs/PHASE_2C_DEPLOYMENT_RUNBOOK.md` + `docs/CI.md`
|
| 557 |
|
| 558 |
### Phase 3 β Multimodal baselines β³ (planned)
|
|
|
|
| 550 |
- [ ] **WS-E** β Frontend deploy to Vercel (static SPA, `VITE_API_BASE` baked at build time, SPA rewrites)
|
| 551 |
- [ ] **WS-F** β Production CORS: add the deployed Vercel origin to `serve.cors_allowed_origins`
|
| 552 |
- [ ] **WS-G** β GitHub Actions CI/CD:
|
| 553 |
+
- [x] `ci.yml` β Python quality (ruff lint + format check, mypy), pytest matrix on 3.10/3.11/3.12, notebook SHA-256 freeze check, frontend lint + build, concurrency cancel-in-progress, pip + npm caching
|
| 554 |
+
- [ ] `deploy-backend.yml` β gated on `needs: ci`, pushes to the HF Space
|
| 555 |
+
- [ ] `deploy-frontend.yml` *(optional)* β Vercel-native GitHub integration is the recommended path
|
| 556 |
- [ ] **WS-H** β README "Live Demo" section (badges swapped to live HF Space + Vercel URLs) + `docs/PHASE_2C_DEPLOYMENT_RUNBOOK.md` + `docs/CI.md`
|
| 557 |
|
| 558 |
### Phase 3 β Multimodal baselines β³ (planned)
|