Skip to content

Commit 9c3058f

Browse files
committed
ci: extend tests to check format of C files
Now that we've settled on a coding style, extend the tests to use clang-format to ensure PRs adhere to it. Signed-off-by: Sergio Lopez <[email protected]>
1 parent b4c8fbc commit 9c3058f

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.github/workflows/code_quality-aarch64-darwin.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ jobs:
2020
uses: Homebrew/actions/setup-homebrew@master
2121

2222
- name: Install dependencies
23-
run: brew tap slp/krunkit && brew install virglrenderer
23+
run: brew tap slp/krunkit && brew install virglrenderer clang-format
24+
25+
- name: Formatting (clang-format)
26+
run: find init -iname '*.h' -o -iname '*.c' | xargs clang-format -n -Werror
2427

2528
- name: Formatting (rustfmt)
2629
run: cargo fmt -- --check

.github/workflows/code_quality-aarch64.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [pull_request, create]
44
jobs:
55
build:
66
if: github.event_name == 'pull_request'
7-
name: Code Quality (fmt, clippy)
7+
name: Code Quality (fmt, clippy, clang-format)
88
runs-on: ubuntu-24.04-arm
99
steps:
1010
- name: Code checkout
@@ -16,7 +16,10 @@ jobs:
1616
components: rustfmt, clippy
1717

1818
- name: Install packages
19-
run: sudo apt-get update && sudo apt-get install -y libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev
19+
run: sudo apt-get update && sudo apt-get install -y libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev clang-format
20+
21+
- name: Formatting (clang-format)
22+
run: find init -iname '*.h' -o -iname '*.c' | xargs clang-format -n -Werror
2023

2124
- name: Create a fake init
2225
run: touch init/init
@@ -26,6 +29,6 @@ jobs:
2629

2730
- name: Clippy (default features)
2831
run: cargo clippy -- -D warnings
29-
32+
3033
- name: Clippy (net+blk+gpu+snd features)
3134
run: cargo clippy --features net,blk,gpu,snd -- -D warnings

.github/workflows/code_quality-x86_64.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [pull_request, create]
44
jobs:
55
build:
66
if: github.event_name == 'pull_request'
7-
name: Code Quality (fmt, clippy)
7+
name: Code Quality (fmt, clippy, clang-format)
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Code checkout
@@ -16,7 +16,10 @@ jobs:
1616
components: rustfmt, clippy
1717

1818
- name: Install packages
19-
run: sudo apt-get update && sudo apt-get install -y libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev
19+
run: sudo apt-get update && sudo apt-get install -y libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev clang-format
20+
21+
- name: Formatting (clang-format)
22+
run: find init -iname '*.h' -o -iname '*.c' | xargs clang-format -n -Werror
2023

2124
- name: Create a fake init
2225
run: touch init/init
@@ -29,7 +32,7 @@ jobs:
2932

3033
- name: Clippy (amd-sev feature)
3134
run: cargo clippy --features amd-sev -- -D warnings
32-
35+
3336
- name: Clippy (net+blk+gpu+snd features)
3437
run: cargo clippy --features net,blk,gpu,snd -- -D warnings
3538

0 commit comments

Comments
 (0)