266 add name component #979
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🔍 Static Analysis | |
on: | |
pull_request: | |
branches: [ main ] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install xorg-dev libglu1-mesa-dev clang clang-tidy | |
- name: Workaround for https://github.com/actions/runner-images/issues/8659 | |
run: | | |
echo "TEMPORARY WORKAROUND FOR GITHUB RUNNER BUG #8659\n\nRemoving GCC 13 as it breaks Clang14" | |
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list | |
sudo apt-get update | |
sudo apt-get install -y --allow-downgrades libc6=2.35-0ubuntu3.6 libc6-dev=2.35-0ubuntu3.6 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04 | |
- name: Make all changed headers reachable | |
run: | | |
echo '// NOLINTBEGIN(misc-include-cleaner)' > core/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'core/include/\K.*.hpp' | awk '{ $0= "#include <" $0 ">"; print }' >> core/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'core/src/\K.*.hpp' | awk '{ $0= "#include \"" $0 "\""; print }' >> core/src/extra.cpp | |
echo '// NOLINTEND(misc-include-cleaner)' >> core/src/extra.cpp | |
sed -i '/set(CUBOS_CORE_SOURCE/a "src/extra.cpp"' core/CMakeLists.txt | |
git add core/src/extra.cpp | |
echo '// NOLINTBEGIN(misc-include-cleaner)' > engine/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'engine/include/\K.*.hpp' | awk '{ $0= "#include <" $0 ">"; print }' >> engine/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'engine/src/\K.*.hpp' | awk '{ $0= "#include \"" $0 "\""; print }' >> engine/src/extra.cpp | |
echo '// NOLINTEND(misc-include-cleaner)' >> engine/src/extra.cpp | |
sed -i '/set(CUBOS_ENGINE_SOURCE/a "src/extra.cpp"' engine/CMakeLists.txt | |
git add engine/src/extra.cpp | |
echo '// NOLINTBEGIN(misc-include-cleaner)' > tools/tesseratos/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'tools/tesseratos/include/\K.*.hpp' | awk '{ $0= "#include <" $0 ">"; print }' >> tools/tesseratos/src/extra.cpp | |
git diff -U0 --name-only HEAD^ | grep -oP 'tools/tesseratos/src/\K.*.hpp' | awk '{ $0= "#include \"" $0 "\""; print }' >> tools/tesseratos/src/extra.cpp | |
echo '// NOLINTEND(misc-include-cleaner)' >> tools/tesseratos/src/extra.cpp | |
sed -i '/set(TESSERATOS_SOURCE/a "src/extra.cpp"' tools/tesseratos/CMakeLists.txt | |
git add tools/tesseratos/src/extra.cpp | |
- name: Prepare compile_commands.json | |
run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DBUILD_TESSERATOS_SAMPLES=ON -DUSE_CLANG_TIDY=ON | |
shell: bash | |
env: | |
CC: clang-14 | |
CXX: clang++-14 | |
- name: Build glad | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target glad | |
- name: Analyze | |
run: | | |
run-clang-tidy -j$(nproc) -p=build \ | |
-header-filter="(core|engine|tools/tesseratos)/(src|include)/.*" \ | |
files "($(git diff -U0 --name-only HEAD^ | grep -vP '.*/lib/.*' | paste -s -d\|))" \ | |
-export-fixes clang-tidy-fixes.yaml || true | |
- name: Run clang-tidy-pr-comments action | |
uses: platisd/clang-tidy-pr-comments@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
clang_tidy_fixes: clang-tidy-fixes.yaml | |
request_changes: true | |
suggestions_per_comment: 10 |