From 6897205f6b93cd1a8ca6de6a8a4a4df5ed9c4f38 Mon Sep 17 00:00:00 2001 From: snowy-yang <102860110+snowy-yang@users.noreply.github.com> Date: Thu, 24 Sep 2026 20:56:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20GitHub=20Actions=E2=80=94=E2=80=94?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E4=B8=8E=E6=96=87=E6=A1=A3=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E8=90=BD=E5=9C=B0=20GitHub=20=E4=B8=BB=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitea runner 六轮实跑无法稳定(checkout 间歇失败、镜像工具链不明、 secrets 未生效),转 GitHub 为主仓库:.github/workflows 与 .gitea/ 并存,检测流水在 GitHub 上补齐 pytest。部署复用 scripts/deploy_docs.sh (wrangler Direct Upload,secrets 在 GitHub 仓库配置)。 --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++ .github/workflows/deploy-docs.yml | 29 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..758ffb5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: 代码检测 + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + lint: + name: ruff + pyright + pytest + runs-on: ubuntu-latest + steps: + - name: 检出代码 + uses: actions/checkout@v4 + + - name: 安装 uv 与 Python 3.13 + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.13" + enable-cache: true + + - name: 同步依赖(含 dev 组) + run: uv sync + + - name: ruff 静态检查 + run: uv run ruff check src tests examples + + - name: pyright 类型检查 + run: uv run pyright + + - name: pytest 单元测试 + run: uv run pytest diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..244de50 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,29 @@ +name: 部署文档(Cloudflare Pages) + +on: + push: + branches: [main] + paths: + - "index.html" + - "_sidebar.md" + - "README.md" + - "docs/**" + - "examples/**" + - "CHANGELOG.md" + - "scripts/deploy_docs.sh" + - ".github/workflows/deploy-docs.yml" + workflow_dispatch: + +jobs: + deploy-docs: + name: Cloudflare Pages + runs-on: ubuntu-latest + steps: + - name: 检出代码 + uses: actions/checkout@v4 + + - name: 组装并部署(wrangler Direct Upload) + run: bash scripts/deploy_docs.sh + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}