Skip to content

添加github workflow,检查代码是否已经格式化 #5

添加github workflow,检查代码是否已经格式化

添加github workflow,检查代码是否已经格式化 #5

Workflow file for this run

name: Rust format check
on: [push, pull_request]
jobs:
# ensure the toolchain is cached
ensure-toolchain:
uses: ./.github/workflows/cache-toolchain.yml
fmt:
name: Rustfmt
runs-on: ubuntu-latest
needs: [ensure-toolchain]
steps:
- uses: actions/checkout@v3
# 准备 bindings.rs
# 由于 bindings.rs 是在 build.rs 中生成的,而这里为了方便,直接 touch 一个空文件
- name: prepare bindings
run: |
touch kernel/src/include/bindings/bindings.rs
touch user/libs/libc/src/include/internal/bindings/bindings.rs
rustup component add rustfmt
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check