维护者策略(2026-10-25):测试套件与项目文档(数据 SOP / 决策记录 / 迭代计划)仅保留在本地工作树——取消 git 跟踪并写入 .gitignore, .comfyignore 同步排除 docs/(tests/ 原已排除),Registry 发布包 不再包含内部文档,扫描面进一步收敛。 配套调整: - ci.yml:test job 检出无 tests/ 时跳过而非失败(分支保护引用的 ci 聚合 job 不受影响;测试若重新纳入跟踪则自动恢复执行) - README:数据 SOP 链接、测试规模口径、参与开发段改写,清除指向 未跟踪文件的死链并说明测试本地独享 - BENCHMARKS:迭代计划引用改本地口径,文首注明测试文件位置
94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
name: CI
|
|
|
|
# PR 与推送到长期分支时跑测试与静态检查。
|
|
# 额外提供一个聚合 job `ci`:分支保护只引用它一个名字,
|
|
# 以后增删矩阵项都不用改分支保护配置。
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Test (py${{ matrix.python-version }} / ${{ matrix.os }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.8", "3.11", "3.12"]
|
|
os: [ubuntu-latest]
|
|
include:
|
|
# 路径防护有 Windows 特有分支(扩展前缀 / ADS / UNC),必须覆盖
|
|
- os: windows-latest
|
|
python-version: "3.11"
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dev dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
- name: Run tests
|
|
# tests/ 自 2026-10-25 起按维护者策略仅保留在本地工作树(不进远端仓库),
|
|
# CI 检出中不存在该目录时跳过而非失败;若将来测试重新纳入跟踪则自动恢复执行。
|
|
shell: bash
|
|
run: |
|
|
if [ -d tests ]; then
|
|
pytest -q
|
|
else
|
|
echo "tests/ is local-only (not tracked in this checkout); skipping."
|
|
fi
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- name: Install ruff
|
|
run: pip install ruff
|
|
- name: Ruff check
|
|
run: ruff check .
|
|
- name: Ruff format check
|
|
run: ruff format --check .
|
|
|
|
mypy:
|
|
name: Mypy
|
|
runs-on: ubuntu-latest
|
|
# 第一期非阻断:只报告不作为合并门禁;本地连续 2 周全绿后可转阻断(删去 continue-on-error 并纳入 ci 聚合)
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- name: Install dev dependencies
|
|
run: pip install -e ".[dev]"
|
|
- name: Run mypy
|
|
run: python -m mypy ra_core RollingArtist.py RollingCharacter.py
|
|
|
|
ci:
|
|
name: ci
|
|
if: always()
|
|
needs: [test, lint]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Aggregate result
|
|
run: |
|
|
echo "test=${{ needs.test.result }} lint=${{ needs.lint.result }}"
|
|
test "${{ needs.test.result }}" = "success"
|
|
test "${{ needs.lint.result }}" = "success"
|