c9a99f4fb3
代码修复: - web/agent/agent.py: datetime.utcnow() → datetime.now(timezone.utc) - requirements.txt: 移除 paramiko==3.5.0 (已无活跃引用) - 删除 server/infrastructure/ssh/pool.py (DEPRECATED, 无引用) 连接池三层对齐 (config.py/.env.example/session.py): - DB_POOL_SIZE 100→160, DB_MAX_OVERFLOW 100→120 - 基于 MySQL max_connections=400, install.php 公式 文档修复 (21项): - P0: 硬编码域名/IP替换为配置变量占位符 - P1: 10个过时设计文档加归档标注 (引用旧文件结构) - P2: step-3-webssh报告 paramiko引用修正 - 6份审查报告连接池参数勘误 100/100→160/120 - ECC安全报告 EC5 datetime.utcnow 标记已修复 - docs/README.md 文档索引重写 - docs/memory/mem_nexus_overview.md 移除硬编码凭证 - docs/project/tech-stack-inventory.md paramiko标记已移除 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
2.0 KiB
YAML
72 lines
2.0 KiB
YAML
name: Nexus CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.12"
|
|
|
|
jobs:
|
|
# ── CI: Test ──
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python ${{ env.PYTHON_VERSION }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install pytest pytest-asyncio aiosqlite coverage ruff mypy
|
|
|
|
- name: Lint (ruff)
|
|
run: ruff check server/ tests/
|
|
|
|
- name: Type check (mypy)
|
|
run: mypy server/ --ignore-missing-imports
|
|
continue-on-error: true # Type errors don't block deployment yet
|
|
|
|
- name: Run tests with coverage
|
|
run: |
|
|
coverage run -m pytest tests/ -v --tb=short
|
|
coverage report --fail-under=50
|
|
coverage xml
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: coverage.xml
|
|
|
|
# ── CD: Deploy ──
|
|
deploy:
|
|
needs: test # Only deploy if tests pass
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main' # Only deploy from main branch
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Deploy to production server
|
|
uses: appleboy/ssh-action@v1
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USER }}
|
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
script: |
|
|
cd ${{ secrets.DEPLOY_PATH || '/opt/nexus' }}
|
|
git pull origin main
|
|
pip install -r requirements.txt
|
|
# Restart Python backend (Supervisor/systemd)
|
|
supervisorctl restart nexus
|
|
# PHP changes are picked up automatically (no restart needed)
|
|
echo "Nexus deployed successfully at $(date)" |