-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (46 loc) · 1.77 KB
/
format.yml
File metadata and controls
56 lines (46 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Format Check
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup LLVM
uses: ZhongRuoyu/setup-llvm@v0
with:
llvm-version: 22
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.95.0
components: rustfmt, clippy
- name: Setup nightly Rust for rule-preprocessor clippy
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt, clippy, rustc-dev
- name: Check C++ formatting
run: find cpp2rust tests -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format --dry-run --Werror
- name: Check Rust formatting
run: |
cargo fmt --manifest-path rules/Cargo.toml -- --check
cargo fmt --manifest-path rule-preprocessor/Cargo.toml -- --check
cargo fmt --manifest-path libcc2rs/Cargo.toml -- --check
cargo fmt --manifest-path libcc2rs-macros/Cargo.toml -- --check
find tests -name '*.rs' -print0 | xargs -0 rustfmt --check
- name: Check Rust lints
run: |
cargo clippy --manifest-path rules/Cargo.toml --all-targets --all-features -- -Dwarnings
cargo +nightly clippy --manifest-path rule-preprocessor/Cargo.toml --all-targets --all-features -- -Dwarnings
cargo clippy --manifest-path libcc2rs/Cargo.toml --all-targets --all-features -- -Dwarnings
cargo clippy --manifest-path libcc2rs-macros/Cargo.toml --all-targets --all-features -- -Dwarnings