refactor: 迁移 cli/_ops/ 到 ops/, 按类别保持 dev/files/media/system 分类
CI / Lint, Typecheck & Test (push) Has been cancelled

将 src/pyflowx/cli/_ops/ 整体迁移至 src/pyflowx/ops/, 与 cli/ 平级
(工具函数非 CLI 专属, 可被 YAML 任务编排通用引用). 分类保持不变:
dev (git/pip/bump/autofmt), files (date/level/back/zip),
media (pdf/screenshot), system (ls/pack/ssh).

同步更新 15 个引用文件 (yaml_loader + 14 个测试) 的 import 路径,
README 模块结构表与 test_registry docstring.
This commit is contained in:
2026-07-05 17:30:35 +08:00
parent 701c455c42
commit d93da0d8b4
24 changed files with 87 additions and 129 deletions
+17 -77
View File
@@ -2,93 +2,33 @@ name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
branches: [ main, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Typecheck
ci:
name: Lint, Typecheck & Test
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: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- uses: http://gitea:3000/zhou/checkout.git@main
- name: Sync dependencies
run: uv sync --extra dev
run: uv sync --frozen
- name: Ruff check
run: uv run ruff check src tests
run: ruff check src tests
- 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/
- name: Tox test (py38, py313)
run: uvx tox run -e py38,py313
+40 -20
View File
@@ -2,37 +2,57 @@ name: Release
on:
push:
tags: ["v*.*.*"]
tags: ['v*.*.*']
permissions:
contents: write
jobs:
release:
name: Build & Publish
name: Build, Publish & Release
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: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- uses: http://gitea:3000/zhou/checkout.git@v4
- name: Build distributions
run: uv build
- name: Publish to pypi
run: uv publish --token '${{ secrets.PYPI_TOKEN }}'
- name: Create Gitea Release & Upload Assets
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
REPO: ${{ github.repository }}
GITEA_URL: http://172.17.0.1:3000
run: |
set -e
# 1. 创建 Release
RELEASE_ID=$(curl -sS -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"Release $TAG_NAME\",\"body\":\"Automated release from CI\",\"draft\":false,\"prerelease\":false}" \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
- name: Publish to PyPI
run: uv publish --token "${{ secrets.PYPI_TOKEN }}"
echo "Created release id=$RELEASE_ID"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
body: |
Automated release from CI.
# 2. 上传 dist/ 下所有文件作为附件
for f in dist/*; do
echo "Uploading $f ..."
curl -sS -X POST "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename $f)" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$f"
done
See [changelog](https://pyflowx.readthedocs.io/zh/latest/changelog.html) for details.
files: dist/*
draft: false
prerelease: false