summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@collabora.com>2023-03-09 20:36:12 -0500
committerMarge Bot <emma+marge@anholt.net>2023-03-17 19:59:21 +0000
commitf534c36ca5e1fb4aeef7be84a91a738d771b0bd4 (patch)
tree9f49120dd98eb9cd71de244ee81af0451b1e2b2d /.gitlab-ci
parent5c1b360eaad9c2cf238e84ae11c4014a7736e045 (diff)
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>
Diffstat (limited to '.gitlab-ci')
-rw-r--r--.gitlab-ci/test-source-dep.yml7
-rw-r--r--.gitlab-ci/test/gitlab-ci.yml13
2 files changed, 20 insertions, 0 deletions
diff --git a/.gitlab-ci/test-source-dep.yml b/.gitlab-ci/test-source-dep.yml
index 1a17b0f9de7..0dbed2d7e86 100644
--- a/.gitlab-ci/test-source-dep.yml
+++ b/.gitlab-ci/test-source-dep.yml
@@ -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
diff --git a/.gitlab-ci/test/gitlab-ci.yml b/.gitlab-ci/test/gitlab-ci.yml
index 093cc3b92d8..5dd27805d29 100644
--- a/.gitlab-ci/test/gitlab-ci.yml
+++ b/.gitlab-ci/test/gitlab-ci.yml
@@ -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