本项目配置了完整的 GitHub Actions CI/CD 流程,支持自动编译和发布。
触发条件:
- Push 到
main分支 - 创建或更新 Pull Request
功能:
- 代码格式检查 (rustfmt)
- Clippy 代码质量检查
- 前端构建验证
- 单元测试运行
触发条件:
- 推送 tag(例如:
0.1.0,v1.0.0) - 发布 Release(当 Release 状态变为 published 时)
- 手动触发 (workflow_dispatch)
支持平台:
- macOS Apple Silicon (aarch64)
- macOS Intel (x86_64)
- Windows (x86_64)
产物类型:
- macOS:
.dmg安装包和.app.zip压缩包 - Windows:
.msi安装包和.exe安装程序
产物命名格式:
rustfs-launcher-{platform}-{arch}-{version}.{ext}(例如:rustfs-launcher-macos-aarch64-v0.1.0.dmg)rustfs-launcher-{platform}-{arch}-latest.{ext}(最新版本链接)
产物上传位置:
- GitHub Release Assets
- 阿里云 OSS:
oss://rustfs-artifacts/artifacts/rustfs-launcher/release/
-
更新版本号
编辑以下文件中的版本号:
src-tauri/Cargo.toml src-tauri/tauri.conf.json -
提交更改
git add . git commit -m "chore: bump version to v0.1.0" git push origin main
-
发布方式(选择其一)
方式一:推送 tag(自动创建 Release)
git tag v0.1.0 git push origin v0.1.0
方式二:通过 GitHub Web 界面创建 Release
- 访问仓库的 "Releases" 页面
- 点击 "Draft a new release"
- 创建新的 tag(如
v0.1.0)或选择已有 tag - 填写 Release 标题和描述
- 点击 "Publish release"
方式三:通过 GitHub CLI
gh release create v0.1.0 --title "v0.1.0" --notes "Release notes"
-
等待编译完成
当 tag 推送或 Release 发布(published)后,GitHub Actions 会自动触发编译。 访问 GitHub Actions 页面查看编译进度:
https://github.com/YOUR_USERNAME/YOUR_REPO/actions -
发布完成
编译成功后会自动:
- 将构建产物上传到 Release Assets
- 将构建产物上传到阿里云 OSS (
oss://rustfs-artifacts/artifacts/rustfs-launcher/release/)
- 访问 GitHub Actions 页面
- 选择 "Build and Release" 工作流
- 点击 "Run workflow" 按钮
- 选择分支并运行
编译完成后,会生成以下文件:
rustfs-launcher-macos-aarch64/
├── rustfs-launcher-macos-aarch64-v0.1.0.dmg
├── rustfs-launcher-macos-aarch64-v0.1.0.app.zip
├── rustfs-launcher-macos-aarch64-latest.dmg
└── rustfs-launcher-macos-aarch64-latest.app.zip
rustfs-launcher-macos-x86_64/
├── rustfs-launcher-macos-x86_64-v0.1.0.dmg
├── rustfs-launcher-macos-x86_64-v0.1.0.app.zip
├── rustfs-launcher-macos-x86_64-latest.dmg
└── rustfs-launcher-macos-x86_64-latest.app.zip
rustfs-launcher-windows-x86_64/
├── rustfs-launcher-windows-x86_64-v0.1.0.msi
├── rustfs-launcher-windows-x86_64-v0.1.0-setup.exe
├── rustfs-launcher-windows-x86_64-latest.msi
└── rustfs-launcher-windows-x86_64-latest-setup.exe
- 检查 GitHub Actions 日志,查看具体错误信息
- 确保所有依赖都已正确配置
- 验证 RustFS 二进制文件下载链接是否有效
编辑 .github/workflows/build.yml 文件中的 matrix 配置:
strategy:
matrix:
include:
- platform: 'ubuntu-latest' # 添加 Linux 支持
target: 'x86_64-unknown-linux-gnu'
# ...在 GitHub Repository Settings 中添加以下 Secrets:
macOS:
APPLE_CERTIFICATEAPPLE_CERTIFICATE_PASSWORDAPPLE_SIGNING_IDENTITYAPPLE_IDAPPLE_PASSWORD
Windows:
WINDOWS_CERTIFICATEWINDOWS_CERTIFICATE_PASSWORD
然后在 workflow 中添加签名步骤。
- RustFS 二进制文件 (从 https://dl.rustfs.com 下载)
dtolnay/rust-toolchain- Rust 工具链Swatinem/rust-cache- Rust 缓存加速actions/setup-node- Node.js 环境actions/upload-artifact- 构建产物上传softprops/action-gh-release- 自动创建 Release
- 缓存优化: 已配置 Rust 和 Node.js 缓存,加速编译
- 并行构建: 三个平台同时编译,节省时间
- 失败容错: 单个平台失败不影响其他平台编译
- 自动化发布: Tag 推送后自动发布,无需手动操作
推荐: 在提交代码前运行所有检查
make pre-commit这个命令会自动运行所有 CI 检查项:
- ✅ 代码格式检查 (
cargo fmt) - ✅ Clippy 静态分析 (
cargo clippy) - ✅ 前端构建 (
trunk build) - ✅ 单元测试 (
cargo test)
单独运行检查:
make check-fmt # 仅检查格式
make check-clippy # 仅运行 Clippy
make check-frontend # 仅构建前端
make check-test # 仅运行测试
make fix-fmt # 自动修复格式详细使用说明请参考: 本地测试指南
项目提供了 Makefile 来简化本地测试 GitHub Actions 工作流的流程。
安装 act 工具:
make install-act常用命令:
# 查看所有可用命令
make help
# 本地运行 CI 工作流 (快速测试)
make test-ci
# 运行完整的 CI 检查
make test-ci-full
# 列出所有工作流任务
make list-jobs
# 仅测试代码格式化
make test-fmt
# 仅测试 clippy 检查
make test-clippy
# 清理 act 缓存
make clean注意事项:
- 首次运行会下载 Docker 镜像,可能需要几分钟
- 需要确保 Docker Desktop 已安装并运行
- 本地测试使用 Linux 容器,行为可能与实际 CI 环境略有差异
- build 工作流包含平台特定步骤,本地测试可能无法完全模拟
如果需要更细粒度的控制:
# 查看 CI 工作流的所有任务
act -W .github/workflows/ci.yml -l
# 运行特定任务
act push -W .github/workflows/ci.yml -j check
# 查看将要执行的命令 (dry run)
act push -W .github/workflows/ci.yml -n
# 使用详细输出
act push -W .github/workflows/ci.yml --verbose- 定期检查 GitHub Actions 的使用配额
- 保持依赖版本更新
- 监控 RustFS 二进制文件下载地址的可用性
- 及时处理编译失败的通知
- 推送前使用
make test-ci本地验证工作流