feat: add multi-platform CI/CD support for GitHub, Gitea, and GitLab
Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 11m9s
CI/CD Pipeline / Security Scan (push) Has been skipped
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notify Results (push) Successful in 31s
Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 11m9s
CI/CD Pipeline / Security Scan (push) Has been skipped
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notify Results (push) Successful in 31s
This commit is contained in:
59
README.md
59
README.md
@@ -9,6 +9,9 @@
|
||||
- ✅ 请求验证和错误处理
|
||||
- ✅ JWT 身份认证
|
||||
- ✅ 结构化日志记录
|
||||
- ✅ CI/CD 流水线(GitHub Actions、Gitea Actions、GitLab CI)
|
||||
- ✅ Docker 容器化部署
|
||||
- ✅ 安全扫描和代码质量检查
|
||||
- 🔄 SQLite 数据库集成(计划中)
|
||||
- 🔄 API 文档和测试(计划中)
|
||||
|
||||
@@ -45,6 +48,22 @@ cargo run
|
||||
|
||||
服务器将在 `http://127.0.0.1:3000` 启动。
|
||||
|
||||
### 4. Docker 部署(可选)
|
||||
|
||||
```bash
|
||||
# 构建镜像
|
||||
docker build -t rust-user-api .
|
||||
|
||||
# 运行容器
|
||||
docker run -p 3000:3000 rust-user-api
|
||||
```
|
||||
|
||||
或使用 Docker Compose:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## API 端点
|
||||
|
||||
### 基础端点
|
||||
@@ -116,6 +135,46 @@ cargo clippy
|
||||
cargo fmt
|
||||
```
|
||||
|
||||
## CI/CD 部署
|
||||
|
||||
本项目支持在多个平台上进行自动化部署:
|
||||
|
||||
### 支持的平台
|
||||
- ✅ **GitHub Actions** - 完整支持
|
||||
- ✅ **Gitea Actions** - 兼容支持
|
||||
- ✅ **GitLab CI/CD** - 原生支持
|
||||
|
||||
### 配置文件
|
||||
- `.github/workflows/deploy.yml` - GitHub/Gitea Actions 配置
|
||||
- `.gitlab-ci.yml` - GitLab CI/CD 配置
|
||||
|
||||
### 部署流程
|
||||
1. **测试阶段** - 代码格式检查、Clippy 检查、单元测试
|
||||
2. **安全扫描** - 依赖漏洞扫描
|
||||
3. **构建阶段** - Docker 镜像构建和推送
|
||||
4. **部署阶段** - 自动部署到测试/生产环境
|
||||
|
||||
### 快速配置
|
||||
详细的配置说明请参考:[CI/CD 配置指南](docs/ci-cd-setup.md)
|
||||
|
||||
## Docker 支持
|
||||
|
||||
### 本地构建
|
||||
```bash
|
||||
docker build -t rust-user-api .
|
||||
docker run -p 3000:3000 rust-user-api
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 生产部署
|
||||
```bash
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
```
|
||||
|
||||
## 学习路径
|
||||
|
||||
这个项目按照以下阶段设计,适合渐进式学习:
|
||||
|
Reference in New Issue
Block a user