Integrate (a nerfed version of) clang-tidy into CI.

For now, it's integrated into core, main and scene only.
Fix a few superficial clang-tidy failures.
This commit is contained in:
Lukas Tenbrink
2025-11-14 21:57:17 +01:00
parent 897172fa25
commit 6e345f80ec
9 changed files with 89 additions and 63 deletions
+23 -1
View File
@@ -30,7 +30,7 @@ jobs:
- name: Editor w/ Mono (target=editor)
cache-name: linux-editor-mono
target: editor
scons-flags: module_mono_enabled=yes
scons-flags: module_mono_enabled=yes compiledb=yes
bin: ./bin/godot.linuxbsd.editor.x86_64.mono
build-mono: true
doc-test: true
@@ -40,6 +40,7 @@ jobs:
artifact: true
# Validate godot-cpp compatibility on one arbitrary editor build.
godot-cpp: true
clang-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
@@ -114,6 +115,21 @@ jobs:
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 2 # 2 needed for Get changed files; no trivial way to conditionally use 1
# Keep in sync with static_checks.yml
- name: Get changed files
if: matrix.clang-tidy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
fi
files=$(echo "$files" | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
echo "CHANGED_FILES=$files" >> $GITHUB_ENV
- name: Setup dependencies
run: |
@@ -181,6 +197,12 @@ jobs:
platform: linuxbsd
target: ${{ matrix.target }}
- name: Style checks via pre-commit
if: matrix.clang-tidy
uses: pre-commit/action@v3.0.1
with:
extra_args: --files ${{ env.CHANGED_FILES }} --hook-stage manual clang-tidy
- name: Compilation (godot-cpp)
uses: ./.github/actions/godot-cpp-build
if: matrix.godot-cpp
+1
View File
@@ -19,6 +19,7 @@ jobs:
run: |
bash ./misc/scripts/gitignore_check.sh
# Keep in sync with linux_builds.yml
- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}