Skip to content

Commit 7394028

Browse files
committed
feat: 添加 GitHub 工作流配置和模板,启用 CI/CD 流程
1 parent c090c5f commit 7394028

File tree

12 files changed

+907
-0
lines changed

12 files changed

+907
-0
lines changed

.github/CHECKLIST.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# GitHub 工作流启用检查清单
2+
3+
## ✅ 已完成的配置
4+
5+
### 核心工作流
6+
7+
- [x] **CI 工作流** (`.github/workflows/ci.yml`)
8+
9+
- 多版本 Python 测试 (3.10-3.13)
10+
- 单元测试执行
11+
- Black/isort 代码质量检查
12+
- 包构建验证
13+
14+
- [x] **发布工作流** (`.github/workflows/publish.yml`)
15+
16+
- 自动发布到 PyPI
17+
- 基于 GitHub Release 触发
18+
- 支持手动触发
19+
20+
- [x] **Dependabot** (`.github/dependabot.yml`)
21+
- 自动检查 GitHub Actions 更新
22+
- 自动检查 Python 依赖更新
23+
24+
### 协作模板
25+
26+
- [x] **Pull Request 模板** (`.github/pull_request_template.md`)
27+
- [x] **Bug 报告模板** (`.github/ISSUE_TEMPLATE/bug_report.md`)
28+
- [x] **功能请求模板** (`.github/ISSUE_TEMPLATE/feature_request.md`)
29+
30+
### 文档
31+
32+
- [x] **贡献指南** (`CONTRIBUTING.md`)
33+
- [x] **工作流文档** (`.github/WORKFLOWS.md`)
34+
- [x] **设置总结** (`.github/SETUP_SUMMARY.md`)
35+
- [x] **README 徽章** (已添加 4 个状态徽章)
36+
- [x] **Markdown Lint 配置** (`.markdownlint.json`)
37+
38+
## 🔧 需要手动配置的项目
39+
40+
### 1. PyPI Token 配置 (发布到 PyPI 需要)
41+
42+
**选项 A: API Token (简单)**
43+
44+
1. 访问 https://pypi.org/manage/account/token/
45+
2. 创建新的 API token (选择 "Entire account" 或特定项目)
46+
3. 复制 token
47+
4. 在 GitHub 仓库:
48+
- Settings → Secrets and variables → Actions
49+
- 点击 "New repository secret"
50+
- Name: `PYPI_API_TOKEN`
51+
- Value: 粘贴你的 token
52+
- 点击 "Add secret"
53+
54+
**选项 B: Trusted Publishing (推荐,更安全)**
55+
56+
1. 在 PyPI 上进入项目设置
57+
2. 找到 "Publishing" 部分
58+
3. 添加 GitHub Actions 为 Trusted Publisher:
59+
- Owner: `talkincode`
60+
- Repository: `hyperliquid-mcp-python`
61+
- Workflow: `publish.yml`
62+
- Environment: 留空
63+
4. 修改 `.github/workflows/publish.yml`:
64+
```yaml
65+
- name: Publish to PyPI
66+
uses: pypa/gh-action-pypi-publish@release/v1
67+
# 不需要 password,使用 OIDC
68+
```
69+
70+
### 2. 测试工作流
71+
72+
**首次运行 CI:**
73+
74+
```bash
75+
# 提交所有变更
76+
git add .
77+
git commit -m "feat: enable GitHub workflows with CI/CD"
78+
git push origin main
79+
80+
# 查看工作流运行状态
81+
open https://github.com/talkincode/hyperliquid-mcp-python/actions
82+
```
83+
84+
**预期结果:**
85+
86+
- CI 工作流应该自动触发
87+
- 所有测试应该通过 ✅
88+
- 代码质量检查应该通过 ✅
89+
- 包构建应该成功 ✅
90+
91+
### 3. 测试发布流程 (可选)
92+
93+
**创建测试 Release:**
94+
95+
```bash
96+
# 1. 更新版本号 (如果需要)
97+
# 编辑 pyproject.toml: version = "0.1.5"
98+
99+
# 2. 提交变更
100+
git add pyproject.toml
101+
git commit -m "chore: bump version to 0.1.5"
102+
103+
# 3. 创建并推送标签
104+
git tag v0.1.5
105+
git push origin v0.1.5
106+
107+
# 4. 在 GitHub 创建 Release
108+
# 访问: https://github.com/talkincode/hyperliquid-mcp-python/releases/new
109+
# - Tag: v0.1.5
110+
# - Release title: v0.1.5
111+
# - Description: 简要说明本次发布的内容
112+
# - 点击 "Publish release"
113+
```
114+
115+
**预期结果:**
116+
117+
- 发布工作流应该自动触发
118+
- 包应该构建成功
119+
- 包应该发布到 PyPI ✅
120+
121+
## 📊 验证步骤
122+
123+
### 1. 检查 CI 状态
124+
125+
```bash
126+
# 在终端中查看最近的工作流运行
127+
gh run list --limit 5
128+
129+
# 或访问网页
130+
open https://github.com/talkincode/hyperliquid-mcp-python/actions
131+
```
132+
133+
### 2. 验证徽章显示
134+
135+
- 查看 README.md
136+
- CI 徽章应显示为绿色 (passing)
137+
- PyPI 版本徽章应显示最新版本
138+
139+
### 3. 测试 Dependabot
140+
141+
- 等待 Dependabot 创建第一个更新 PR (通常在启用后 1-7 天内)
142+
- 检查 PR 的格式和标签是否正确
143+
144+
## 🚨 常见问题
145+
146+
### CI 失败?
147+
148+
1. 检查测试是否在本地通过: `uv run pytest`
149+
2. 检查代码格式: `uv run black --check .`
150+
3. 检查导入排序: `uv run isort --check-only .`
151+
152+
### 发布失败?
153+
154+
1. 确认已配置 `PYPI_API_TOKEN`
155+
2. 确认 token 有效且有发布权限
156+
3. 检查版本号是否已存在于 PyPI
157+
158+
### Dependabot 没有创建 PR?
159+
160+
1. 检查 `.github/dependabot.yml` 配置
161+
2. 可能需要等待一周 (schedule: weekly)
162+
3. 在仓库的 Insights → Dependency graph → Dependabot 查看状态
163+
164+
## 🎯 后续优化建议
165+
166+
1. **代码覆盖率**: 添加 Codecov 集成
167+
2. **性能测试**: 添加基准测试工作流
168+
3. **安全扫描**: 启用 CodeQL
169+
4. **预提交钩子**: 配置 pre-commit
170+
5. **文档部署**: 自动部署文档到 GitHub Pages
171+
172+
## 📞 获取帮助
173+
174+
如遇问题:
175+
176+
1. 查看 `.github/WORKFLOWS.md` 详细文档
177+
2. 查看 GitHub Actions 日志
178+
3. 参考 [GitHub Actions 文档](https://docs.github.com/actions)
179+
4. 在项目中创建 Issue
180+
181+
---
182+
183+
**快速开始**: 只需配置 PyPI Token 并 push 代码,其他都已自动配置好! 🚀
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Bug 报告
3+
about: 报告一个问题以帮助我们改进
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## 问题描述
10+
11+
<!-- 清晰简洁地描述这个 bug -->
12+
13+
## 复现步骤
14+
15+
1.
16+
2.
17+
3.
18+
19+
## 期望行为
20+
21+
<!-- 描述你期望发生什么 -->
22+
23+
## 实际行为
24+
25+
<!-- 描述实际发生了什么 -->
26+
27+
## 环境信息
28+
29+
- OS: [例如 macOS 14.0]
30+
- Python 版本: [例如 3.12]
31+
- hyperliquid-mcp 版本: [例如 0.1.4]
32+
- 使用主网还是测试网: [主网/测试网]
33+
34+
## 日志/错误信息
35+
36+
```
37+
粘贴相关日志或错误信息
38+
```
39+
40+
## 额外信息
41+
42+
<!-- 添加任何其他有用的信息 -->
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: 功能请求
3+
about: 建议一个新功能
4+
title: "[FEATURE] "
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
## 功能描述
10+
11+
<!-- 清晰简洁地描述你想要的功能 -->
12+
13+
## 动机
14+
15+
<!-- 为什么需要这个功能?它解决什么问题? -->
16+
17+
## 建议的实现方案
18+
19+
<!-- 如果有的话,描述你认为应该如何实现这个功能 -->
20+
21+
## 替代方案
22+
23+
<!-- 描述你考虑过的其他替代方案 -->
24+
25+
## 额外信息
26+
27+
<!-- 添加任何其他有用的信息或截图 -->

0 commit comments

Comments
 (0)