Merge branch 'wip/clang-format-ci' into 'main'

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

See merge request libinput/libei!390
This commit is contained in:
Peter Hutterer 2026-05-13 10:56:53 +10:00
commit 72236a8032
4 changed files with 45 additions and 9 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

View file

@ -82,7 +82,9 @@ start_demo_client(int fd)
_cleanup_free_ char *fdstr = xaprintf("%d", fd);
execl(MESON_BUILDDIR "/ei-demo-client",
"ei-demo-client",
"--socketfd", fdstr, NULL);
"--socketfd",
fdstr,
NULL);
fprintf(stderr, "Failed to fork: %m\n");
exit(1);
}
@ -116,9 +118,9 @@ main(int argc, char **argv)
OPT_CLIENT,
};
static struct option long_opts[] = {
{"client", required_argument, 0, OPT_CLIENT},
{"help", no_argument, 0, 'h'},
{.name = NULL},
{ "client", required_argument, 0, OPT_CLIENT },
{ "help", no_argument, 0, 'h' },
{ .name = NULL },
};
int optind = 0;
@ -126,7 +128,7 @@ main(int argc, char **argv)
if (c == -1)
break;
switch(c) {
switch (c) {
case 'h':
usage(stdout, argv[0]);
return EXIT_SUCCESS;