-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (106 loc) · 3.32 KB
/
static-analysis.yml
File metadata and controls
119 lines (106 loc) · 3.32 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Static Analysis
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
clang-tidy:
name: Clang-Tidy Analysis
runs-on: ubuntu-24.04
timeout-minutes: 30
continue-on-error: true # Phase 0: Baseline collection
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: true
clean: true
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout dependencies
run: |
cd ..
git clone --depth 1 https://github.com/kcenon/common_system.git
git clone --depth 1 https://github.com/kcenon/thread_system.git
git clone --depth 1 https://github.com/kcenon/logger_system.git
git clone --depth 1 https://github.com/kcenon/container_system.git
git clone --depth 1 https://github.com/kcenon/network_system.git
git clone --depth 1 https://github.com/kcenon/monitoring_system.git
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential ninja-build clang clang-tidy lld
sudo apt install -y libgtest-dev libgmock-dev libyaml-cpp-dev
- name: Configure CMake
run: |
mkdir -p build
cd build
# Use GCC for compilation to ensure std::format support
# clang-tidy will still analyze the code using compile_commands.json
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DMESSAGING_BUILD_TESTS=ON \
-DMESSAGING_BUILD_EXAMPLES=OFF \
-DMESSAGING_USE_LOCAL_SYSTEMS=ON \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run clang-tidy
run: |
cd build
# Phase 0: Just collect baseline, don't fail
run-clang-tidy -p . || echo "clang-tidy found issues (baseline collection)"
- name: Upload clang-tidy results
if: always()
uses: actions/upload-artifact@v4
with:
name: clang-tidy-results
path: |
build/compile_commands.json
build/**/*.log
retention-days: 7
if-no-files-found: ignore
cppcheck:
name: Cppcheck Analysis
runs-on: ubuntu-24.04
timeout-minutes: 30
continue-on-error: true # Phase 0: Baseline collection
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: true
clean: true
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cppcheck
- name: Run Cppcheck
run: |
cppcheck \
--enable=all \
--inconclusive \
--std=c++20 \
--suppress=missingInclude \
--suppress=unmatchedSuppression \
--inline-suppr \
--xml \
--xml-version=2 \
-I include \
src/ \
2> cppcheck-results.xml || echo "Cppcheck found issues (baseline collection)"
- name: Upload Cppcheck results
if: always()
uses: actions/upload-artifact@v4
with:
name: cppcheck-results
path: cppcheck-results.xml
retention-days: 7
if-no-files-found: ignore