xref: /cloud-hypervisor/.github/workflows/formatting.yaml (revision eeae63b4595fbf0cc69f62b6e9d9a79c543c4ac7)
1name: Cloud Hypervisor Code Formatting
2on: [pull_request, merge_group]
3concurrency:
4  group: ${{ github.workflow }}-${{ github.ref }}
5  cancel-in-progress: true
6
7jobs:
8  build:
9    name: Code Formatting
10    runs-on: ubuntu-latest
11    strategy:
12      matrix:
13        rust:
14          - nightly
15        target:
16          - x86_64-unknown-linux-gnu
17          - aarch64-unknown-linux-musl
18    env:
19      RUSTFLAGS: -D warnings
20    steps:
21      - name: Code checkout
22        uses: actions/checkout@v4
23      - name: Install Rust toolchain (${{ matrix.rust }})
24        uses: dtolnay/rust-toolchain@stable
25        with:
26            toolchain: ${{ matrix.rust }}
27            target: ${{ matrix.target }}
28            components: rustfmt
29      - name: Formatting (rustfmt)
30        run: cargo fmt --all -- --check
31      - name: Formatting (fuzz) (rustfmt)
32        run: cargo fmt --all --manifest-path fuzz/Cargo.toml -- --check
33