CI: run clang-format to make sure the coding style is correct

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/390>
This commit is contained in:
Peter Hutterer 2026-05-12 08:00:49 +10:00
parent fefbdd7b01
commit 61600a6577
3 changed files with 38 additions and 4 deletions

View file

@ -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
#

View file

@ -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
#

View file

@ -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