ci: 重写 CI/Release 为 GitHub 兼容版本并加文档构建
ci.yml 改用标准 actions (checkout/setup-uv/setup-python), 新增 pyrefly 类型检查、coverage 阈值检查 (>=95%)、Sphinx 文档构建三个 job, 多版本矩阵测试 (py38/py311/py313)。release.yml 改用标准 actions, 发布到 PyPI + GitHub Release (替代原 Gitea Release)。
This commit is contained in:
+77
-17
@@ -2,33 +2,93 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Lint, Typecheck & Test
|
||||
lint:
|
||||
name: Lint & Typecheck
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: pyflowx-ci:latest
|
||||
env:
|
||||
UV_LINK_MODE: copy
|
||||
# ---- 国内源 ----
|
||||
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
PIP_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn
|
||||
UV_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
UV_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn
|
||||
steps:
|
||||
- uses: http://gitea:3000/zhou/checkout.git@main
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Sync dependencies
|
||||
run: uv sync --frozen
|
||||
run: uv sync --extra dev
|
||||
|
||||
- name: Ruff check
|
||||
run: ruff check src tests
|
||||
run: uv run ruff check src tests
|
||||
|
||||
- name: Tox test (py38, py313)
|
||||
run: uvx tox run -e py38,py313
|
||||
- name: Ruff format check
|
||||
run: uv run ruff format --check src tests
|
||||
|
||||
- name: Pyrefly typecheck
|
||||
run: uv run pyrefly check src/pyflowx
|
||||
|
||||
test:
|
||||
name: Test (Python ${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.8", "3.11", "3.13"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Sync dependencies
|
||||
run: uv sync --extra dev
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: uv run pytest -m "not slow" --cov=pyflowx --cov-report=xml --cov-report=term-missing --cov-fail-under=95
|
||||
|
||||
- name: Upload coverage
|
||||
if: matrix.python-version == '3.11'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage.xml
|
||||
|
||||
docs:
|
||||
name: Docs Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Sync dependencies
|
||||
run: uv sync --extra docs
|
||||
|
||||
- name: Build Sphinx docs
|
||||
run: uv run sphinx-build -b html docs/ docs/_build/ --keep-going
|
||||
env:
|
||||
LC_ALL: C.UTF-8
|
||||
LANG: C.UTF-8
|
||||
|
||||
- name: Upload docs artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs-html
|
||||
path: docs/_build/
|
||||
|
||||
Reference in New Issue
Block a user