Skip to content

github workflow自动检查代码是否格式化 #12

github workflow自动检查代码是否格式化

github workflow自动检查代码是否格式化 #12

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

Check failure on line 8 in .github/workflows/rustfmt.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/rustfmt.yml

Invalid workflow file

error parsing called workflow ".github/workflows/rustfmt.yml" -> "./.github/workflows/cache-toolchain.yml" : failed to fetch workflow: workflow was not found.
fmt:
name: check
runs-on: ubuntu-latest
needs: [ensure-toolchain]
steps:
- uses: actions/checkout@v3
- name: Cache build tools
id: cache-build-tools
uses: actions/cache@v3
env:
cache-name: cache-build-tools
dadk_version: 0.1.2
with:
path: |
~/.cargo
~/.rustup
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
# 准备 bindings.rs
# 由于 bindings.rs 是在 build.rs 中生成的,而这里为了方便,直接 touch 一个空文件
- name: prepare bindings
run: |
printf "\n" >> kernel/src/include/bindings/bindings.rs
printf "\n" >> user/libs/libc/src/include/internal/bindings/bindings.rs
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check