xref: /DragonBoot/.github/workflows/rustfmt.yml (revision abdb84b821932b89f5491f7fcc08c47807f19cc4)
1*abdb84b8SLoGinname: Rust format check
2*abdb84b8SLoGin
3*abdb84b8SLoGinon: [push, pull_request]
4*abdb84b8SLoGin
5*abdb84b8SLoGinjobs:
6*abdb84b8SLoGin    # ensure the toolchain is cached
7*abdb84b8SLoGin    ensure-toolchain:
8*abdb84b8SLoGin        uses: ./.github/workflows/cache-toolchain.yml
9*abdb84b8SLoGin
10*abdb84b8SLoGin    fmt:
11*abdb84b8SLoGin        name: check
12*abdb84b8SLoGin        runs-on: ubuntu-latest
13*abdb84b8SLoGin        needs: [ensure-toolchain]
14*abdb84b8SLoGin        steps:
15*abdb84b8SLoGin            - uses: actions/checkout@v3
16*abdb84b8SLoGin            - name: Cache build tools
17*abdb84b8SLoGin              id: dragon-boot-cache-build-tools
18*abdb84b8SLoGin              uses: actions/cache@v3
19*abdb84b8SLoGin              env:
20*abdb84b8SLoGin                  cache-name: dragon-boot-cache-build-tools
21*abdb84b8SLoGin              with:
22*abdb84b8SLoGin                path: |
23*abdb84b8SLoGin                  ~/.cargo
24*abdb84b8SLoGin                  ~/.rustup
25*abdb84b8SLoGin                  ~/.bashrc
26*abdb84b8SLoGin                key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
27*abdb84b8SLoGin
28*abdb84b8SLoGin            - name: Check format
29*abdb84b8SLoGin              run: |
30*abdb84b8SLoGin                    FMT_CHECK=1 make fmt
31