diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1824191e..27439ba4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -83,7 +83,7 @@ variables: # See the documentation here: # # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html # ############################################################################### - FEDORA_PACKAGES: 'git-core gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel gtk4-devel glib2-devel mtdev-devel diffutils wayland-protocols-devel black clang-analyzer jq rpmdevtools valgrind systemd-udev qemu-img qemu-system-x86-core qemu-system-aarch64-core jq python3-click python3-rich' + FEDORA_PACKAGES: 'git-core gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel gtk4-devel glib2-devel mtdev-devel diffutils wayland-protocols-devel black clang clang-tools-extra jq rpmdevtools valgrind systemd-udev qemu-img qemu-system-x86-core qemu-system-aarch64-core jq python3-click python3-rich' DEBIAN_PACKAGES: 'git gcc g++ pkg-config meson check libudev-dev libevdev-dev doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev curl' UBUNTU_PACKAGES: 'git gcc g++ pkg-config meson check libudev-dev libevdev-dev doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev' ARCH_PACKAGES: 'git gcc pkgconfig meson check libsystemd libevdev python-pytest-xdist libwacom gtk4 mtdev diffutils' @@ -95,12 +95,12 @@ 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: '2024-04-03.1' - DEBIAN_TAG: '2024-04-03.1' - UBUNTU_TAG: '2024-04-03.1' - ARCH_TAG: '2024-04-03.1' - ALPINE_TAG: '2024-04-03.1' - FREEBSD_TAG: '2024-04-03.1' + FEDORA_TAG: '2025-04-04.0' + DEBIAN_TAG: '2025-04-04.0' + UBUNTU_TAG: '2025-04-04.0' + ARCH_TAG: '2025-04-04.0' + ALPINE_TAG: '2025-04-04.0' + FREEBSD_TAG: '2025-04-04.0' FDO_UPSTREAM_REPO: libinput/libinput @@ -903,18 +903,16 @@ default-build-release@fedora:41: MESON_ARGS: "-Dbuildtype=release" CFLAGS: "-Werror" -scan-build@fedora:41: +clang-tidy@fedora:41: extends: - .fedora-build@template variables: NINJA_ARGS: '' MESON_TEST_ARGS: '' + CC: 'clang' script: - .gitlab-ci/meson-build.sh - - export SCANBUILD="$PWD/.gitlab-ci/scanbuild-wrapper.sh" - - ninja -C "$MESON_BUILDDIR" scan-build - after_script: - - .gitlab-ci/scanbuild-plist-to-junit.py "$MESON_BUILDDIR"/meson-logs/scanbuild/ > "$MESON_BUILDDIR"/junit-scan-build.xml + - ninja -C "$MESON_BUILDDIR" clang-tidy # Below jobs are build option combinations. We only # run them on one image, they shouldn't fail on one distro diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index cfc0ce46..5cb2fc25 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -464,18 +464,16 @@ default-build-release@{{distro.name}}:{{version}}: MESON_ARGS: "-Dbuildtype=release" CFLAGS: "-Werror" -scan-build@{{distro.name}}:{{version}}: +clang-tidy@{{distro.name}}:{{version}}: extends: - .{{distro.name}}-build@template variables: NINJA_ARGS: '' MESON_TEST_ARGS: '' + CC: 'clang' script: - .gitlab-ci/meson-build.sh - - export SCANBUILD="$PWD/.gitlab-ci/scanbuild-wrapper.sh" - - ninja -C "$MESON_BUILDDIR" scan-build - after_script: - - .gitlab-ci/scanbuild-plist-to-junit.py "$MESON_BUILDDIR"/meson-logs/scanbuild/ > "$MESON_BUILDDIR"/junit-scan-build.xml + - ninja -C "$MESON_BUILDDIR" clang-tidy # Below jobs are build option combinations. We only # run them on one image, they shouldn't fail on one distro diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 179bb8b6..f8fb7988 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 '2024-04-03.1' +.default_tag: &default_tag '2025-04-04.0' distributions: - name: fedora @@ -36,7 +36,8 @@ distributions: - diffutils - wayland-protocols-devel - black # for the Python black job, optional - - clang-analyzer # for the scan-build job, optional + - clang # for the clang-tidy build, optional + - clang-tools-extra # for clang-tidy, optional - jq # for the test suite check job, optional - rpmdevtools # for the rpm build job, optional - valgrind # for the valgrind run, optional diff --git a/.gitlab-ci/scanbuild-plist-to-junit.py b/.gitlab-ci/scanbuild-plist-to-junit.py deleted file mode 100755 index 987148a2..00000000 --- a/.gitlab-ci/scanbuild-plist-to-junit.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python3 -# -# SPDX-License-Identifier: MIT -# -# Usage: -# $ scanbuild-plist-to-junit.py /path/to/meson-logs/scanbuild/ > junit-report.xml -# -# Converts the plist output from scan-build into a JUnit-compatible XML. -# -# For use with meson, use a wrapper script with this content: -# scan-build -v --status-bugs -plist-html "$@" -# then build with -# SCANBUILD="/abs/path/to/wrapper.sh" ninja -C builddir scan-build -# -# For file context, $PWD has to be the root source directory. -# -# Note that the XML format is tailored towards being useful in the gitlab -# CI, the JUnit format supports more features. -# -# This file is formatted with Python Black - -import argparse -import plistlib -import re -import sys -from pathlib import Path - -errors = [] - - -class Error(object): - pass - - -parser = argparse.ArgumentParser( - description="This tool convers scan-build's plist format to JUnit XML" -) -parser.add_argument( - "directory", help="Path to a scan-build output directory", type=Path -) -args = parser.parse_args() - -if not args.directory.exists(): - print(f"Invalid directory: {args.directory}", file=sys.stderr) - sys.exit(1) - -# Meson places scan-build runs into a timestamped directory. To make it -# easier to invoke this script, we just glob everything on the assumption -# that there's only one scanbuild/$timestamp/ directory anyway. -for file in Path(args.directory).glob("**/*.plist"): - with open(file, "rb") as fd: - plist = plistlib.load(fd, fmt=plistlib.FMT_XML) - try: - sources = plist["files"] - for elem in plist["diagnostics"]: - e = Error() - e.type = elem["type"] # Human-readable error type - e.description = elem["description"] # Longer description - e.func = elem["issue_context"] # function name - e.lineno = elem["location"]["line"] - filename = sources[elem["location"]["file"]] - # Remove the ../../../ prefix from the file - e.file = re.sub(r"^(\.\./)*", "", filename) - errors.append(e) - except KeyError: - print( - "Failed to access plist content, incompatible format?", file=sys.stderr - ) - sys.exit(1) - - -# Add a few lines of context for each error that we can print in the xml -# output. Note that e.lineno is 1-indexed. -# -# If one of the files fail, we stop doing this, we're probably in the wrong -# directory. -try: - current_file = None - lines = [] - for e in sorted(errors, key=lambda x: x.file): - if current_file != e.file: - current_file = e.file - lines = open(current_file).readlines() - - # e.lineno is 1-indexed, lineno is our 0-indexed line number - lineno = e.lineno - 1 - start = max(0, lineno - 4) - end = min(len(lines), lineno + 5) # end is exclusive - e.context = [ - f"{'>' if line == e.lineno else ' '} {line}: {content}" - for line, content in zip(range(start + 1, end), lines[start:end]) - ] -except FileNotFoundError: - pass - -print('') -print("") -if errors: - suites = sorted(set([s.type for s in errors])) - # Use a counter to ensure test names are unique, otherwise the CI - # display ignores duplicates. - counter = 0 - for suite in suites: - errs = [e for e in errors if e.type == suite] - # Note: the grouping by suites doesn't actually do anything in gitlab. Oh well - print(f'') - for error in errs: - print( - f"""\ - - - - -""" - ) - counter += 1 - print("") -else: - # In case of success, add one test case so that registers in the UI - # properly - print('') - print('') - print("") -print("") diff --git a/.gitlab-ci/scanbuild-wrapper.sh b/.gitlab-ci/scanbuild-wrapper.sh old mode 100755 new mode 100644