-
Notifications
You must be signed in to change notification settings - Fork 144
92 lines (78 loc) · 2.95 KB
/
static_analysis.yml
File metadata and controls
92 lines (78 loc) · 2.95 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
84
85
86
87
88
89
90
91
92
# ─────────────────────────────────────────────────────────────────────────────
# CXXGraph – Static Analysis
#
# Runs clang-tidy against the full source tree using the compile_commands.json
# generated by CMake. Failures are reported as annotations on the diff.
# ─────────────────────────────────────────────────────────────────────────────
name: Static Analysis
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CPM_SOURCE_CACHE: ~/.cache/cpm
jobs:
clang-tidy:
name: "clang-tidy · Clang 18 · C++17"
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Clang 18 + clang-tidy
run: |
sudo apt-get update -q
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 18 all
sudo apt-get install -y --no-install-recommends \
clang-18 clang++-18 clang-tidy-18
sudo update-alternatives --install \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Cache CPM packages
uses: actions/cache@v5
with:
path: ~/.cache/cpm
key: cpm-ubuntu-tidy-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: cpm-ubuntu-tidy-
# Generate compile_commands.json (required by clang-tidy)
- name: Configure CMake
env:
CC: clang-18
CXX: clang++-18
run: |
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_CXX_EXTENSIONS=OFF \
-DTEST=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
# Fetch all headers / generated files needed for analysis
- name: Build (generate all headers)
run: cmake --build build --parallel
- name: Run clang-tidy
run: |
# Analyse only project headers – exclude vendored / generated paths
find include/CXXGraph -name '*.hpp' -o -name '*.h' | \
xargs clang-tidy-18 \
-p build \
--warnings-as-errors='*' \
--extra-arg="-std=c++17" \
2>&1 | tee clang-tidy-report.txt
- name: Upload clang-tidy report
if: always()
uses: actions/upload-artifact@v7
with:
name: clang-tidy-report
path: clang-tidy-report.txt
retention-days: 14