Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:

permissions:
contents: read

jobs:
frontend:
name: Frontend
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: web/package-lock.json

- name: Install frontend dependencies
working-directory: web
run: npm ci

- name: Lint frontend
working-directory: web
run: npm run lint

- name: Test frontend
working-directory: web
run: npm run test

- name: Build frontend
working-directory: web
run: npm run build

backend:
name: Backend Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements.txt
requirements-dev.txt

- name: Install backend dependencies
run: python -m pip install -r requirements-dev.txt

- name: Ruff lint
run: ruff check api src tests main.py

- name: Ruff format check
run: ruff format --check api src tests main.py

- name: Test backend with coverage
run: python -m pytest --cov=api --cov=src --cov-report=term-missing
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ENV/
*.egg-info/
.installed.cfg
*.egg
.coverage*
htmlcov/

# Node.js (前端依赖由 web/.gitignore 管理,这里作为备份)
node_modules/
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@ output/ppt_20241201_123456/
└── images/ # Slide images
```

## 🧪 Development Checks

Recommended local runtime:
- Python 3.11 or 3.12
- Node.js 20

Backend checks:

```bash
python -m pip install -r requirements-dev.txt
ruff check api src tests main.py
ruff format --check api src tests main.py
python -m pytest --cov=api --cov=src --cov-report=term-missing
```

Frontend checks:

```bash
cd web
npm ci
npm run lint
npm run test
npm run build
```

GitHub Actions runs the same default checks on `main` and `dev` pull requests and pushes. Real model API calls are intentionally not part of the default CI because they require private keys and can be flaky.

## 📋 TODO

- [ ] Upgrade generated PPT images into structured, editable PPT content
Expand Down
27 changes: 27 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@ output/ppt_20241201_123456/
└── images/ # 幻灯片图片
```

## 🧪 开发检查

推荐本地运行环境:
- Python 3.11 或 3.12
- Node.js 20

后端检查:

```bash
python -m pip install -r requirements-dev.txt
ruff check api src tests main.py
ruff format --check api src tests main.py
python -m pytest --cov=api --cov=src --cov-report=term-missing
```

前端检查:

```bash
cd web
npm ci
npm run lint
npm run test
npm run build
```

GitHub Actions 会在 `main` 和 `dev` 的 Pull Request 与 push 上运行这些默认检查。真实模型 API 调用需要私有 Key,且容易受外部服务波动影响,因此不放入默认 CI。

## 📋 TODO

- [ ] 将生成的 PPT 图片增强为结构化、可编辑的 PPT 内容
Expand Down
3 changes: 2 additions & 1 deletion api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
app = FastAPI(
title="AI PPT Generator API",
description="API for AI-powered PPT generation with WebUI",
version="1.0.0"
version="1.0.0",
)

# 配置 CORS 中间件
Expand Down Expand Up @@ -50,4 +50,5 @@ async def health_check():

if __name__ == "__main__":
import uvicorn

uvicorn.run(app, host="0.0.0.0", port=8000)
Loading
Loading