✨ feat: WP-08 媒体基础与 CI(上传/文件/任务/声契 + 三任务流水线)
- 迁移 15:upload(三态)、file_asset(sha256/存储键/pending-ready-quarantined)、media_job(四类五态+进度+取消)、voice_consent(用途/期限/撤回) - 上传三步流(契约第 9 节开发档):POST uploads(MIME 白名单+大小约束)→ PUT data(真实写 storage/ 落盘、sha256 校验)→ completions 转 ready——未完成文件不可被业务引用 - 文件内容取回(开发档本地;正式部署换短期签名 URL,存储键不变) - 媒体任务:ASR 输入必须 ready 音频;后台执行经注入 Provider(测试 mock 确定性转写);无 Provider 显式失败(fail-closed);取消幂等 - 声契:TTS/克隆需有效声契(未撤回未过期);撤回后新任务 403(ADR 媒体域“撤回停止新生成”) - CI(WP-14 起步):三任务流水线——backend(pgvector 服务容器 + ruff/mypy/pytest)、engine(CMake 警告即错误 + ctest)、openapi(Redocly lint) - 测试 91 项全绿(+5)
This commit is contained in:
1 parent
9ef2568c3b
commit
701c20c783
7 files changed
+400
No files matched your search
@@ -0,0 +1,71 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: hunjing
|
||||
POSTGRES_PASSWORD: hunjing_dev_password
|
||||
POSTGRES_DB: hunjing
|
||||
ports: ["5432:5432"]
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U hunjing"
|
||||
--health-interval 5s --health-timeout 3s --health-retries 12
|
||||
env:
|
||||
DATABASE_URL: postgresql+asyncpg://hunjing:hunjing_dev_password@127.0.0.1:5432/hunjing
|
||||
TEST_DATABASE_URL: postgresql+asyncpg://hunjing:hunjing_dev_password@127.0.0.1:5432/hunjing_test
|
||||
HUNJING_WEBHOOK_SECRET: whsec_ci
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: 安装依赖
|
||||
working-directory: backend
|
||||
run: uv sync
|
||||
- name: 创建测试库
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y postgresql-client
|
||||
PGPASSWORD=hunjing_dev_password psql -h 127.0.0.1 -U hunjing -d hunjing \
|
||||
-c "CREATE DATABASE hunjing_test"
|
||||
- name: Lint 与类型检查
|
||||
working-directory: backend
|
||||
run: |
|
||||
uv run ruff check .
|
||||
uv run mypy app
|
||||
- name: 测试
|
||||
working-directory: backend
|
||||
run: uv run pytest -q
|
||||
|
||||
engine:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: 安装 CMake
|
||||
run: pipx install cmake
|
||||
- name: 构建(警告即错误)
|
||||
run: |
|
||||
cmake -S engine -B engine/build -DCMAKE_BUILD_TYPE=Debug
|
||||
cmake --build engine/build
|
||||
- name: 测试
|
||||
run: ctest --test-dir engine/build --output-on-failure
|
||||
|
||||
openapi:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
- name: 契约校验
|
||||
run: |
|
||||
npx --yes @redocly/cli@latest lint openapi/openapi.yaml \
|
||||
--config openapi/redocly.yaml
|
||||
Reference in new issue
Block a user