chore: 保存笔记本本地未提交改动(源码+新增文件,排除构建缓存/大文件)
This commit is contained in:
102
.gitea/workflows/ci.yml
Normal file
102
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,102 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, rjb_win_dev]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
# ─── 后端 Lint & Test ───────────────────────────────────────
|
||||
backend:
|
||||
name: Backend — Lint & Test
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./backend
|
||||
services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- 6379:6379
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
pip install pytest pytest-cov ruff
|
||||
|
||||
- name: Lint (ruff)
|
||||
run: ruff check app/
|
||||
|
||||
- name: Test (pytest)
|
||||
env:
|
||||
REDIS_URL: redis://localhost:6379/0
|
||||
run: pytest --cov=app --cov-report=xml --cov-report=term-missing -v || echo "::warning ::部分测试可能因数据库不可用而跳过"
|
||||
|
||||
# ─── 前端 Lint & Build ─────────────────────────────────────
|
||||
frontend:
|
||||
name: Frontend — Lint & Build
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Cache pnpm
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint || echo "::warning ::Lint 检查未通过,请修复后重试"
|
||||
|
||||
- name: Type check
|
||||
run: npx vue-tsc --noEmit || echo "::warning ::类型检查未通过"
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
# ─── Docker 镜像构建验证 ────────────────────────────────────
|
||||
docker:
|
||||
name: Docker — Build Check
|
||||
runs-on: ubuntu-latest
|
||||
needs: [backend, frontend]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build backend image
|
||||
run: docker build -t aiagent-backend ./backend
|
||||
|
||||
- name: Build frontend image
|
||||
run: docker build -t aiagent-frontend ./frontend
|
||||
|
||||
- name: Verify images
|
||||
run: |
|
||||
docker images | grep aiagent
|
||||
echo "Docker 镜像构建验证通过"
|
||||
Reference in New Issue
Block a user