ci: 新增 PR 轻量检查工作流, AGENTS.md 补充 CI/CD 自动部署说明

This commit is contained in:
yeuimu
2026-09-11 01:40:23 +00:00
parent 3336e3a20c
commit 387044a26c
2 changed files with 20 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
name: CI
on:
pull_request:
branches: [develop, main]
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装 uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: 安装依赖
run: ~/.local/bin/uv sync --frozen
- name: 语法与导入检查
run: ~/.local/bin/uv run python -m compileall -q flows api
+2
View File
@@ -30,6 +30,8 @@ ETL 工作流项目,使用 [Prefect](https://docs.prefect.org.cn/v3/get-started)
- worker 是 **Docker 容器**(`prefect-worker` 服务,基于 `Dockerfile`),镜像只装依赖(git + uv 按锁文件装),**不烤业务代码**;每个 flow run 执行前,pull 步骤从 Gitea **clone 最新代码**(token 存 `gitea-token` Secret Block,运行时解析)。
- **改 flow 代码 → `git push` → 下次 run 自动用新代码**(worker 不重启、不 redeploy);改 deployment 配置(cron/参数)才需重跑 `uv run prefect deploy --all`(读取 `prefect.yaml`)。
- **日常开发流程**:clone Gitea 仓库 → 改代码 → `git push` → 自动生效。
- **CI/CD 自动部署**:develop 合并到 main(push)→ Gitea webhook → 本机 9000 的 `inkreach-prefect-webhook` 服务(systemd,deploy 账号)→ 自动 `git pull + uv sync + prefect deploy --all` → 企微群通知。CI 检查:`.gitea/workflows/ci.yml`,PR 到 develop/main 时跑轻量语法检查(runner 标签 ubuntu-latest,本机 gitea-act-runner)。
- 部署脚本与密钥在 `/opt/inkreach-prefect-deploy/`(deploy.sh / rollback.sh / status.sh / webhook.secret / wecom_webhook.txt,均 deploy 账号所有);代码检出在 `/opt/inkreach-prefect`(deploy 账号所有,deploy.sh 自动 reset 到 origin/main)。
## 密钥管理(标准做法)