ci: 新增 GitHub Actions 工作流,发布改用 PyPI Trusted Publishing

- .github/workflows/ci.yml:push/PR 触发,Python 3.11 + 3.13 矩阵跑 pytest,
  另做一次构建与 twine check 校验
- .github/workflows/release.yml:推送 v* 标签触发,测试 → 构建 → 发布到 PyPI
  - 含 git tag 与 pyproject 版本一致性校验,防止标签与版本号错位
  - publish 作业使用 environment: pypi + id-token: write,走 OIDC 免密钥发布
- uv.lock:同步 pytdxdata 版本 0.3.2 → 0.4.0(此前 lockfile 落后于 pyproject.toml)
This commit is contained in:
openbot-coder committed 2026-09-15 12:00:02 +08:00
1 parent 9183c3294f
commit 92a03951c7
3 files changed
+241 -76

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
name: CI
# 每次 push / PR 都跑,用于在打发布标签之前提前暴露问题
# (本机 Windows 上无法创建 asyncio 事件循环,所以 Linux 侧的首轮验证只能靠这里)
on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --locked
- name: Run tests
run: uv run pytest -q
build:
name: Build check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10
with:
python-version: "3.13"
- name: Build sdist and wheel
run: uv build
- name: Check distribution metadata
run: uvx twine check dist/*