Files
asd-backend/.gitea/workflows/build.yaml
milky 3606b71466 disable
ban action
2025-09-08 09:43:52 +08:00

30 lines
970 B
YAML
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.
name: Run with Rust Docker
# 触发条件:代码推送到 main 分支时执行
on:
push:
branches: [ "main" ]
jobs:
run-with-docker:
runs-on: asd-rust
steps:
# 步骤1拉取仓库代码到工作目录
- name: Checkout repository
uses: actions/checkout@v4
# 步骤2使用 Rust 官方 Docker 镜像执行命令
- name: Run cargo commands in Rust container
# 使用最新稳定版 Rust 镜像
image: rust:latest
# 挂载当前仓库目录到容器内的 /app 目录
volumes:
- ${{ github.workspace }}:/app
# 工作目录切换到容器内的 /app即仓库代码目录
working-directory: /app
# 执行的命令:构建并运行项目
run: |
rustc --version && cargo --version # 检查 Rust 环境
cargo build # 构建项目
cargo run # 运行项目