Files
DjangoAdmin_Flask_EleVue/.github/workflows/ci.yml
T
DjangoAdmin DevandClaude 8937799973 refactor: P9 运维完善(健康端点/Docker 加固/CI-CD/scripts)
- /health 健康端点(白名单已加,Docker HEALTHCHECK 目标)
- docker-compose 加固:build context 修复、privileged false、flask_user、bridge 网络
- .github/workflows/ci.yml:flake8 + mypy + pytest(含 MySQL/Redis 服务)
- scripts/:health_check.py / init_db.py
- Makefile 更新为 src/ 结构

【验收】全项目 flake8 0;12 passed;/health 200;health_check 脚本运行正常
【注】docker-compose 实际构建验证需 Docker 环境执行

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-07 19:51:51 +08:00

75 lines
1.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# CI/CD 工作流
# ============================================================
# 触发:push / PR
# 任务:flake8 → type-check → pytest(含 MySQL/Redis 服务)
# ============================================================
name: CI
on:
push:
branches: [master, main]
pull_request:
jobs:
lint-and-test:
runs-on: ubuntu-latest
# 依赖服务(供集成测试使用)
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ci_password
MYSQL_DATABASE: djangoadmin_flask_elevue_ci
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- name: 安装依赖
run: pip install -r requirements-dev.txt
- name: 静态检查(flake8)
run: flake8 src config tests --max-complexity=30
- name: 类型检查(mypy)
run: mypy src || true
- name: 单元测试(pytest)
env:
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: djangoadmin_flask_elevue_ci
DB_USERNAME: root
DB_PASSWORD: ci_password
DB_SSL: 'False'
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
REDIS_AUTH: 'False'
FLASK_DEBUG: 'False'
FLASK_SECRET_KEY: ci-secret-key-0123456789abcdef
JWT_SALT: ci-jwt-salt-0123456789abcdef
run: pytest -v