-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (71 loc) · 2.3 KB
/
clang_tidy.yaml
File metadata and controls
83 lines (71 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Clang Tidy Linting
on:
push:
workflow_dispatch:
permissions:
contents: read
packages: read
jobs:
clang-tidy-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
clang \
clang-tidy \
gcc \
g++ \
git \
curl \
zip \
unzip \
pkg-config \
ninja-build \
cmake
- name: Setup vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git /tmp/vcpkg
/tmp/vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=/tmp/vcpkg" >> $GITHUB_ENV
echo "/tmp/vcpkg" >> $GITHUB_PATH
- name: Cache VCPKG
uses: actions/cache@v4
with:
path: |
/tmp/vcpkg/downloads
/tmp/vcpkg/installed
~/.cache/vcpkg
key: ${{ runner.os }}-vcpkg-clang_debug-${{ hashFiles('vcpkg.json') }}
restore-keys: ${{ runner.os }}-vcpkg-
- name: Cache build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-cmake-clang_debug-${{ hashFiles('CMakeLists.txt', '**/*.cmake') }}
restore-keys: ${{ runner.os }}-cmake-
- name: Configure (clang_debug)
run: cmake --preset clang_debug
- name: Run clang-tidy
shell: bash
run: |
set +e
cmake --build --preset clang_debug --target clang-tidy 2>&1 | tee clang_tidy_output.txt
CLANG_TIDY_EXIT_CODE=${PIPESTATUS[0]} # Capture CMake exit code, not tee
set -e
if [ $CLANG_TIDY_EXIT_CODE -eq 0 ]; then
echo "<details><summary>🟢 Clang Tidy Results (click to expand)</summary>" >> $GITHUB_STEP_SUMMARY
else
echo "## 🔴 Clang Tidy Results" >> $GITHUB_STEP_SUMMARY
fi
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat clang_tidy_output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if [ $CLANG_TIDY_EXIT_CODE -eq 0 ]; then
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
exit $CLANG_TIDY_EXIT_CODE