ci: Enforce clang-format for asahi

Some drivers use clang-format exclusively. We would like to lint for correct
formatting in CI to catch style issues before they land, because mixing
clang-format and not clang-format within a codebase is a recipe for conflicts.

We don't expect this lint to ever fail in "normal" usage, since we expect
developers on these drivers to setup automatic formatting in their editor.
However, it can be useful as a failsafe or for drive-by contributors who don't
know the style guide.

Enable the linting for Asahi. We'll enable for Panfrost shortly, but Panfrost
isn't clang-format clean quite yet.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20553>
This commit is contained in:
Alyssa Rosenzweig
2023-03-09 20:36:12 -05:00
committed by Marge Bot
parent 5c1b360eaa
commit f534c36ca5
2 changed files with 20 additions and 0 deletions

View File

@@ -921,3 +921,10 @@
- changes:
- src/**/*.rs
when: on_success
.lint-clang-format-rules:
rules:
- !reference [.core-rules, rules]
- changes:
- src/**/asahi/**/*
when: on_success

View File

@@ -30,6 +30,19 @@ rustfmt:
- shopt -s globstar
- rustfmt --check --verbose src/**/*.rs
clang-format:
# Cancel job if a newer commit is pushed to the same branch
interruptible: true
stage: lint
extends:
- .use-debian/x86_build
- .lint-clang-format-rules
variables:
GIT_STRATEGY: fetch
script:
- shopt -s globstar
- clang-format-13 --Werror --dry-run src/**/asahi/**/*.{h,c,cpp}
.test-gl:
extends:
- .test