Skip to content

Commit bcd776c

Browse files
authored
Add workflow for static code analysis using clang-tidy (#482)
1 parent 09fa3be commit bcd776c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Static code analysis (clang-tidy)
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
clang-tidy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install dependencies
16+
run: |
17+
sudo apt update
18+
sudo apt install -y clang-15 clang-tidy-15 cmake ninja-build libc++-15-dev libc++abi-15-dev
19+
20+
- name: Set clang-tidy version
21+
run: echo "CLANG_TIDY=clang-tidy-15" >> $GITHUB_ENV
22+
23+
- name: Prepare Vulkan SDK
24+
run: |
25+
curl -LS -o vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/1.4.309.0/linux/vulkansdk-linux-x86_64-1.4.309.0.tar.xz
26+
mkdir -p vulkan_sdk
27+
tar xf vulkansdk.tar.xz -C vulkan_sdk
28+
export VULKAN_SDK=$GITHUB_WORKSPACE/vulkan_sdk/1.4.309.0/x86_64
29+
echo "VULKAN_SDK=$VULKAN_SDK" >> $GITHUB_ENV
30+
echo "PATH=$VULKAN_SDK/bin:$PATH" >> $GITHUB_ENV
31+
echo "LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
32+
echo "VK_ICD_FILENAMES=$VULKAN_SDK/etc/vulkan/icd.d" >> $GITHUB_ENV
33+
echo "VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/layer.d" >> $GITHUB_ENV
34+
35+
- name: Configure with CMake
36+
run: |
37+
cmake -S . -B build \
38+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
39+
-DCMAKE_CXX_COMPILER=clang++-15 \
40+
-DCMAKE_C_COMPILER=clang-15 \
41+
-DVMA_BUILD_SAMPLES=YES
42+
43+
- name: Run Clang-Tidy
44+
run: |
45+
find . -name '*.cpp' | xargs clang-tidy-15 -checks='*, -modernize-use-trailing-return-type, -cppcoreguidelines-macro-usage, -modernize-use-auto, -modernize-use-using' -header-filter='.*vk_mem_alloc\.h' -p build || true

0 commit comments

Comments
 (0)