Files
hankin 5b41f28943
CRM/ERP CI / Backend Tests (Python) (push) Successful in 1m57s
CRM/ERP CI / Frontend Build (Vue3 + Vite) (push) Successful in 48s
CRM/ERP CI / Docker Compose Build (push) Successful in 6s
ci: align gitea workflow and frontend build
2026-05-11 21:47:54 +08:00

105 lines
3.1 KiB
YAML

name: CRM/ERP CI
on:
push:
branches:
- main
- ui-change
- 'feature/**'
- 'fix/**'
pull_request:
branches:
- main
- ui-change
workflow_dispatch:
jobs:
# ─────────────────────────────────────────────
# 后端 Python 测试
# ─────────────────────────────────────────────
backend-test:
name: Backend Tests (Python)
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn pytest pytest-asyncio httpx aiosqlite
- name: Run Python syntax check
run: |
source .venv/bin/activate
python -m py_compile app/main.py
find app -name '*.py' -exec python -m py_compile {} +
echo "✅ Python 语法检查通过"
- name: Run pytest
run: |
source .venv/bin/activate
pytest tests/ -v --tb=short
# ─────────────────────────────────────────────
# 前端 Vue 构建检查
# ─────────────────────────────────────────────
frontend-build:
name: Frontend Build (Vue3 + Vite)
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Configure npm mirror
run: npm config set registry https://registry.npmmirror.com
- name: Install dependencies
run: |
npm ci
- name: Build
run: npm run build
# ─────────────────────────────────────────────
# Docker Compose 构建检查
# ─────────────────────────────────────────────
docker-build:
name: Docker Compose Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create minimal .env for build
run: |
cp server/.env.example server/.env
- name: Docker Compose Build
run: docker compose build
- name: Cleanup
if: always()
run: docker compose down -v 2>/dev/null || true