Skip to content

添加CI状态检查脚本 #3

添加CI状态检查脚本

添加CI状态检查脚本 #3

Workflow file for this run

name: Code Quality
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 mypy isort
- name: Check code formatting with black
run: |
black --check --diff . || echo "代码格式检查失败,但不阻止CI"
- name: Check import sorting with isort
run: |
isort --check-only --diff . || echo "导入排序检查失败,但不阻止CI"
- name: Lint with flake8
run: |
flake8 . --count --max-complexity=15 --max-line-length=127 --statistics --exit-zero
- name: Type checking with mypy
run: |
mypy . --ignore-missing-imports || echo "类型检查失败,但不阻止CI"
- name: Security check with bandit
run: |
pip install bandit
bandit -r . -f html -o bandit-report.html || true
- name: Upload security report
if: always()
uses: actions/upload-artifact@v4
with:
name: security-report
path: bandit-report.html
retention-days: 30