Skip to content

Commit 141f091

Browse files
d-e-s-oinsearchoflosttime
authored andcommitted
Make cargo fmt check a separate job in CI
Similar to what we did earlier with cargo-doc, this change makes the cargo fmt invocation a separate step. In so doing the check is likely to run much earlier in the run, resulting in a quicker experience when code is not properly formatted. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent da45f42 commit 141f091

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/rust.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,21 @@ jobs:
5757
run: cargo test --verbose --workspace --exclude runqslower -- --skip test_object --skip test_tc
5858
- name: Run BTF tests
5959
run: cd libbpf-rs && cargo test --verbose -- test_object test_tc
60-
- if: ${{ matrix.rust != 'nightly' }}
61-
name: Run rustfmt
62-
run: cargo fmt --package libbpf-cargo libbpf-rs -- --check
6360
- if: ${{ matrix.rust != 'nightly' }}
6461
name: Run clippy
6562
run: cargo clippy --tests -- -D warnings
63+
rustfmt:
64+
name: Check code formatting
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v3
68+
- uses: actions-rs/toolchain@v1
69+
with:
70+
profile: minimal
71+
toolchain: stable
72+
components: rustfmt
73+
override: true
74+
- run: cargo fmt --package libbpf-cargo libbpf-rs -- --check
6675
cargo-doc:
6776
name: Check documentation
6877
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)