mengstack-website/guide/cicd.md
2026-10-02 23:55:36 +08:00

54 lines
1009 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CI/CD 流水线
MengStack 使用 Gitea Actions 实现持续集成和部署。
## 流水线概览
```
代码推送 → 代码检查 → 构建 → 测试 → Docker 镜像 → 部署
```
## Gitea Actions 配置
仓库地址:`https://mengstackgit.softunis.com/mengstack`
### 流水线阶段
| 阶段 | 说明 |
|------|------|
| Lint | 代码风格检查 |
| Build | 编译 Go 二进制 |
| Test | 运行单元测试和集成测试 |
| Docker | 构建 Docker 镜像 |
| Deploy | 部署到目标服务器 |
## 本地验证
在推送代码前,本地运行检查:
```bash
# 代码检查
make lint
# 运行测试
make test
# 构建
make build
```
## 部署策略
当前采用单服务器部署:
1. 代码推送到 Gitea 仓库
2. CI 流水线自动触发
3. 通过 SSH 部署到目标服务器
4. Docker Compose 重启服务
## 后续规划
- **多环境支持**:dev / staging / production 环境隔离
- **蓝绿部署**:零停机更新
- **自动回滚**:部署失败自动回退