From 61600a6577123b2e2e0e4369859e2bac68044a27 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 12 May 2026 08:00:49 +1000 Subject: [PATCH] CI: run clang-format to make sure the coding style is correct Part-of: --- .gitlab-ci.yml | 21 ++++++++++++++++++--- .gitlab-ci/ci.template | 18 ++++++++++++++++++ .gitlab-ci/config.yml | 3 ++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c0934af..f6c1802 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ variables: # See the documentation here: # # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html # ############################################################################### - FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config systemd-devel libxkbcommon-devel libxml2 doxygen python3-pytest python3-dbusmock python3-jinja2 python3-pip python3-pyyaml golang libabigail ' + FEDORA_PACKAGES: 'git diffutils gcc gcc-c++ pkgconf-pkg-config systemd-devel libxkbcommon-devel libxml2 doxygen python3-pytest python3-dbusmock python3-jinja2 python3-pip python3-pyyaml golang libabigail clang-tools-extra ' FEDORA_PIP_PACKAGES: 'meson ninja structlog strenum ' DEBIAN_PACKAGES: 'git gcc g++ pkg-config libsystemd-dev libxkbcommon-dev libxml2 doxygen python3-pytest python3-dbusmock python3-jinja2 python3-pip python3-yaml ' DEBIAN_PIP_PACKAGES: 'meson ninja structlog strenum ' @@ -50,8 +50,8 @@ variables: # changing these will force rebuilding the associated image # Note: these tags have no meaning and are not tied to a particular # libinput version - FEDORA_TAG: '2025-05-19.1' - DEBIAN_TAG: '2025-05-19.1' + FEDORA_TAG: '2026-05-13.0' + DEBIAN_TAG: '2026-05-13.0' FDO_UPSTREAM_REPO: libinput/libei @@ -200,6 +200,21 @@ debian:bullseye@container-prep: junit: $MESON_BUILDDIR/meson-logs/.junit.xml dependencies: [] +# Format C source files with clang-format +# +clang-format@fedora:43: + extends: + - .fdo.distribution-image@fedora + - .policy + stage: build + variables: + FDO_DISTRIBUTION_VERSION: '43' + FDO_DISTRIBUTION_TAG: $FEDORA_TAG + needs: + - "fedora:43@container-prep" + script: + - clang-format --dry-run --Werror src/*.[ch] test/*.[ch] tools/*.[ch] + # # Fedora # diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 00097c6..4a790e5 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -198,6 +198,24 @@ python-ruff: junit: $MESON_BUILDDIR/meson-logs/.junit.xml dependencies: [] +# Format C source files with clang-format +# +{% for distro in distributions if distro.use_for_custom_build_tests %} +{% set version = "{}".format(distro.versions|last()) %} +clang-format@{{distro.name}}:{{version}}: + extends: + - .fdo.distribution-image@{{distro.name}} + - .policy + stage: build + variables: + FDO_DISTRIBUTION_VERSION: '{{version}}' + FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG + needs: + - "{{distro.name}}:{{version}}@container-prep" + script: + - clang-format --dry-run --Werror src/*.[ch] test/*.[ch] tools/*.[ch] +{% endfor %} + # # Fedora # diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 469649e..4a17c8c 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -3,7 +3,7 @@ # # We're happy to rebuild all containers when one changes. -.default_tag: &default_tag '2025-05-19.1' +.default_tag: &default_tag '2026-05-13.0' last_abi_break: abe85e051e7029bfd2e7913ab980a9e0042b6d0d minimum_meson_version: 0.57.0 @@ -31,6 +31,7 @@ distributions: - python3-pyyaml - golang # for documentation only - libabigail # for abidiff only + - clang-tools-extra # for clang-format pips: - meson - ninja