CI: Implement clangd-tidy as GitHub Action

This commit is contained in:
Thaddeus Crews committed 2026-03-20 09:16:38 -05:00
1 parent c71c2bfc5e
commit 0e8bd28a10
20 files changed
+79 -27

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
name: clangd-tidy
description: Setup and run clangd-tidy on relevant files
inputs:
changed-files:
description: A pre-filtered list of changed files.
required: true
type: string
runs:
using: composite
steps:
- name: Setup clangd-tidy
shell: sh
run: |
echo "::group::Prerequisite checks"
if [ ! -f "compile_commands.json" ]; then
echo "::error::clangd-tidy checker requires a compilation database to function"
exit 1
fi
echo "::endgroup::"
echo "::group::Installing clangd-tidy"
# Don't know which python we're using, so just access the global scope.
python -m pip install clangd clangd-tidy clang-tidy==22.1.0
echo "::endgroup::"
echo "::group::Running clangd-tidy"
clangd-tidy ${{ inputs.changed-files }}
echo "::endgroup::"
+14 -1
View File
@@ -7,10 +7,23 @@ everything:
# files changing would result in SCons rebuilding the engine, or are otherwise pertinent to the
# buildsystem itself.
sources:
- .github/{actions,workflows}/*.yml
- .github/{actions/*,workflows}/*.yml
- "**/{SConstruct,SCsub,*.py}"
- "**/*.{h,hpp,hh,hxx,c,cpp,cc,cxx,m,mm,inc,glsl}"
- modules/mono/**/*.{cs,csproj,sln,props,targets}
- platform/android/java/{gradle*,**/*.{jar,java,kt,gradle}}
- platform/web/{package{,-lock}.json,js/**/*.js}
- tests/**
# Determines which files are appropriate for running clangd-tidy checks on. This is a subset out
# of necessity, as we're only evaluating a Linux runner.
clangd:
- "**/*.{h,hpp,hxx,hh,c,cpp,cxx,cc}"
- "!**/thirdparty/**"
- "!**/*-so_wrap.{h,c}"
- "!drivers/{apple*,core*,d3d12,metal,wasapi,windows,winmidi,xaudio2}/**"
- "!editor/shader/shader_baker/shader_baker_export_plugin_platform_{d3d12,metal}.{h,cpp}"
- "!modules/camera/camera_{android,macos,win}.{h,cpp}"
- "!modules/openxr/extensions/platform/openxr_{android,metal}_extension.{h,cpp}"
- "!platform/{android,ios,macos,visionos,web,windows}/**"
- "platform/{android,ios,macos,visionos,web,windows}/{api,export}/*.{h,hpp,hxx,hh,c,cpp,cxx,cc}"
+6 -6
View File
@@ -3,7 +3,7 @@ on:
workflow_call:
inputs:
changed-files:
description: A list of changed files.
description: A list of changed files, pre-filtered for parsing by clangd-tidy.
required: true
type: string
workflow_dispatch:
@@ -44,7 +44,7 @@ jobs:
artifact: true
# Validate godot-cpp compatibility on one arbitrary editor build.
godot-cpp: true
clang-tidy: true
clangd-tidy: true
- name: Editor with doubles and GCC sanitizers (target=editor, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=mold)
cache-name: linux-editor-double-sanitizers
@@ -186,11 +186,11 @@ jobs:
platform: linuxbsd
target: ${{ matrix.target }}
- name: Style checks via pre-commit
if: matrix.clang-tidy
uses: pre-commit/action@v3.0.1
- name: Style checks via clangd-tidy
if: matrix.clangd-tidy
uses: ./.github/actions/clangd-tidy
with:
extra_args: --files ${{ inputs.changed-files }} --hook-stage manual clang-tidy
changed-files: ${{ inputs.changed-files }}
- name: Compilation (godot-cpp)
uses: ./.github/actions/godot-cpp-build
+2 -2
View File
@@ -3,7 +3,7 @@ on:
workflow_call:
outputs:
changed-files:
description: A list of changed files.
description: A list of changed files, pre-filtered for parsing by clangd-tidy.
value: ${{ jobs.static-checks.outputs.changed-files }}
sources-changed:
description: Determines if any source files were changed.
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
changed-files: '"${{ steps.changed-files.outputs.everything_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.
changed-files: '"${{ steps.changed-files.outputs.clangd_all_changed_files }}"' # Wrap with quotes to bookend internal quote separators.
sources-changed: ${{ steps.changed-files.outputs.sources_any_changed }}
steps:
- name: Checkout
-1
View File
@@ -32,7 +32,6 @@
#include "core/input/input_enums.h"
#include "core/object/method_bind_common.h" // IWYU pragma: keep. For `VARIANT_BITFIELD_CAST(MethodFlags)`.
#include "core/object/object.h"
#include "core/os/keyboard.h"
#include "core/variant/type_info.h"
#include "core/variant/variant.h"
+2 -1
View File
@@ -30,7 +30,8 @@
#include "doc_data.h"
#include "core/object/object.h"
#include "core/object/method_info.h"
#include "core/object/property_info.h"
String DocData::get_default_value_string(const Variant &p_value) {
const Variant::Type type = p_value.get_type();
+1 -1
View File
@@ -32,7 +32,7 @@
#include "core/variant/array.h"
#include "core/variant/dictionary.h"
#include "core/variant/typed_array.h"
#include "core/variant/typed_array.h" // IWYU pragma: keep. `convert_property_list` return type.
MethodInfo::operator Dictionary() const {
Dictionary d;
+4 -1
View File
@@ -30,10 +30,13 @@
#include "memory.h"
#include "core/math/math_funcs_binary.h"
#include "core/profiling/profiling.h"
#include "core/templates/safe_refcount.h"
#ifdef DEV_ENABLED
#include "core/math/math_funcs_binary.h"
#endif
#include <cstdlib>
void *operator new(size_t p_size, const char *p_description) {
-1
View File
@@ -30,7 +30,6 @@
#pragma once
#include "core/object/object.h"
#include "core/templates/simple_type.h"
#include "core/typedefs.h"
#include "core/variant/method_ptrcall.h"
-1
View File
@@ -33,7 +33,6 @@
#include "gdscript_cache.h"
#include "gdscript_parser.h"
#include "core/object/object.h"
#include "core/object/ref_counted.h"
class GDScriptAnalyzer {
+1
View File
@@ -30,6 +30,7 @@
#include "gdscript_warning.h"
#include "core/object/property_info.h"
#include "core/variant/variant.h"
#ifdef DEBUG_ENABLED
+3 -2
View File
@@ -32,10 +32,11 @@
#ifdef DEBUG_ENABLED
#include "core/object/object.h"
#include "core/string/ustring.h"
#include "core/templates/vector.h"
class String;
struct PropertyInfo;
class GDScriptWarning {
public:
enum WarnLevel {
+4 -1
View File
@@ -35,8 +35,11 @@
#include "shapes/jolt_custom_ray_shape.h"
#include "shapes/jolt_custom_user_data_shape.h"
#include "core/string/print_string.h"
#include "core/os/memory.h"
#ifdef JPH_ENABLE_ASSERTS
#include "core/variant/variant.h"
#endif
#include <Jolt/Jolt.h>
+3
View File
@@ -34,7 +34,10 @@
#include "core/object/class_db.h"
#include "editor/export/editor_export.h"
#ifdef MACOS_ENABLED
#include "editor/settings/editor_settings.h"
#endif
void register_ios_exporter_types() {
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformIOS);
+2
View File
@@ -33,6 +33,8 @@
#include "export_plugin.h"
#include "core/object/class_db.h"
#include "editor/export/editor_export.h"
#include "editor/settings/editor_settings.h"
void register_macos_exporter_types() {
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformMacOS);
+4 -1
View File
@@ -33,7 +33,8 @@
#include "logo_svg.gen.h"
#include "run_icon_svg.gen.h"
#include "core/io/image_loader.h"
#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
#include "core/io/plist.h"
#include "core/io/zip_io.h"
#include "core/object/class_db.h"
@@ -43,10 +44,12 @@
#include "editor/editor_node.h"
#include "editor/editor_string_names.h"
#include "editor/export/codesign.h"
#include "editor/export/editor_export.h"
#include "editor/export/lipo.h"
#include "editor/export/macho.h"
#include "editor/file_system/editor_paths.h"
#include "editor/import/resource_importer_texture_settings.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "scene/resources/image_texture.h"
+1 -6
View File
@@ -30,15 +30,10 @@
#pragma once
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
#include "core/os/process_id.h"
#include "editor/export/editor_export.h"
#include "editor/settings/editor_settings.h"
#include "editor/export/editor_export_platform.h"
#include "scene/resources/image_texture.h"
#include <sys/stat.h>
@@ -30,7 +30,6 @@
#include "shader_preprocessor.h"
#include "core/math/expression.h"
#include "core/os/os.h"
#include "servers/rendering/shader_expression.h"
+2
View File
@@ -30,7 +30,9 @@
#include "shader_types.h"
#ifdef DEV_ENABLED
#include "scene/resources/shader.h"
#endif
const HashMap<StringName, ShaderLanguage::FunctionInfo> &ShaderTypes::get_functions(RSE::ShaderMode p_mode) const {
return shader_modes[p_mode].functions;
@@ -30,7 +30,6 @@
#pragma once
#include "core/object/object.h"
#include "servers/rendering/rendering_server_enums.h"
#include "servers/rendering/rendering_server_types.h"
#include "servers/rendering/storage/utilities.h"