M1 最小闭环:CLI + FastAPI 网关 + SQL 闸 + 100% 覆盖率验收链

- CLI:init/serve/update/query/export/status(typer + rich),单写者锁三元判活
- 存储:DuckDB schema migrations(14 表 + 8 联邦视图,语句元组逐条执行)
- ETL:A股证券/日历/日K,整区替换幂等;日历全年补全(calendar 语义唯一)
- 网关:POST /v1/query(线程池 + interrupt 超时 504)、/v1/export、meta/stats/state、healthz/ready
- 安全:SQL 闸 sqlglot fail-closed(文件/网络表函数默认拒)、非 loopback 空 token 拒启、导出路径双判
- 验收:254 测试全绿、1265 语句 100% 覆盖、[CI] 真起服验收链、smoke_m1.py 交付自检
- 文档:设计文档 v0.7(圆桌 45 条采纳 + 3 条实施校准),README 重写
- 发布:release.yml Trusted Publishing(OIDC 免密钥),action refs 已核验
This commit is contained in:
openbot committed 2026-09-24 09:06:47 +08:00
commit d37c697bbe
59 files changed
+7586

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
# 推 tag (v*) → 测试 → 构建 → Trusted Publishing (OIDC) 免密钥发布 PyPI。
# 依赖:GitHub 侧 Environment `pypi` + PyPI 侧 pending publisher(owner/openbot-coder、
# 仓库 pyquantdata、workflow release.yml、environment pypi)。
# refs 均经 raw.githubusercontent.com 核验存在(2026-09-24)。
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.1.0
with:
python-version: "3.13"
- run: uv sync --locked
- run: uv run pytest -q
build:
name: Build distributions
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.1.0
with:
python-version: "3.13"
# 防「tag 叫 v0.1.0、pyproject 里还是 0.0.9」的错发
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
set -euo pipefail
tag_version="${GITHUB_REF_NAME#v}"
pkg_version="$(uv version --short)"
if [ "${tag_version}" != "${pkg_version}" ]; then
echo "::error::tag v${tag_version} 与 pyproject 版本 ${pkg_version} 不一致"
exit 1
fi
- run: uv build
- run: uvx twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
if-no-files-found: error
publish:
name: Publish to PyPI
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyquantdata
permissions:
id-token: write # Trusted Publishing 必需(OIDC 换 15 分钟短期令牌),无需任何密钥
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1