添加ci工作流
This commit is contained in:
57
.gitea/workflows/ci.yaml
Normal file
57
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: Rust CI Pipeline
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-and-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# 1. 检出代码 - 使用 Gitea 本地的 actions 镜像
|
||||||
|
- name: 🔍 Check out repository code
|
||||||
|
uses: https://devstar.cn/actions/checkout@v4
|
||||||
|
|
||||||
|
# 2. 安装 Rust 工具链
|
||||||
|
- name: 🦀 Set up Rust
|
||||||
|
run: |
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# 3. 显示环境信息
|
||||||
|
- name: ℹ️ Environment Info
|
||||||
|
run: |
|
||||||
|
rustc --version
|
||||||
|
cargo --version
|
||||||
|
echo "Building repository: ${{ gitea.repository }}"
|
||||||
|
|
||||||
|
# 4. 构建项目(调试模式)
|
||||||
|
- name: 🔧 Build (Debug)
|
||||||
|
run: cargo build --verbose
|
||||||
|
|
||||||
|
# 5. 构建项目(发布模式)
|
||||||
|
- name: 🚀 Build (Release)
|
||||||
|
run: cargo build --release --verbose
|
||||||
|
|
||||||
|
# 6. 运行测试
|
||||||
|
- name: ✅ Run Tests
|
||||||
|
run: cargo test --verbose
|
||||||
|
|
||||||
|
# 7. 检查代码格式
|
||||||
|
- name: 📏 Check Format
|
||||||
|
run: cargo fmt -- --check
|
||||||
|
|
||||||
|
# 8. 运行 Clippy 静态分析
|
||||||
|
- name: 🔍 Clippy Check
|
||||||
|
run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
# 9. 生成文档
|
||||||
|
- name: 📚 Build Documentation
|
||||||
|
run: cargo doc --no-deps
|
||||||
|
|
||||||
|
# 10. 清理构建缓存(可选)
|
||||||
|
- name: 🧹 Cleanup
|
||||||
|
run: cargo clean
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# For more details, see https://containers.dev/guide/dependabot
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "devcontainers"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
Reference in New Issue
Block a user