Let's add a basic clang-tidy check to the linter workflow. This
gives us the following:
- A check so that we don't introduce any new cyclic header dependencies
- A check to make sure all of our header files are standalone, as clang-tidy
will fail to parse header files that don't include all their dependencies.
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+---
+Checks: '
+ -*,
+ misc-header-include-cycle
+'
+WarningsAsErrors: '*'
+HeaderFileExtensions:
+ - h
+ImplementationFileExtensions:
+ - c
+...
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+man/*
+# These contain external headers that we don't want to check.
+src/basic/include/*
+# clang-tidy can't parse BPF source files.
+src/core/bpf/*
+src/network/bpf/*
+src/nsresourced/bpf/*
+# The glib headers contain cyclic dependencies and clang-tidy
+# can't distinguish between our code and glib headers so we
+# exclude this test.
+src/libsystemd/sd-bus/test-bus-marshal.c
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
mkosi sandbox -- ruff format --check --quiet --diff src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
fi
+
+ - name: Configure meson
+ run: mkosi sandbox -- env CC=clang CXX=clang++ meson setup build
+
+ # Make sure all generated source files are actually generated by doing a full build.
+ - name: Build systemd
+ run: mkosi sandbox -- ninja -C build
+
+ - name: Run clang-tidy
+ run: mkosi sandbox -- ninja -C build clang-tidy