-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (125 loc) · 4.21 KB
/
Copy pathstatic-analysis.yml
File metadata and controls
142 lines (125 loc) · 4.21 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Static Analysis Workflow for PACS System
# Runs clang-tidy and cppcheck for code quality analysis
#
# Based on messaging_system static analysis patterns
name: Static Analysis
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
# Ensure only one workflow runs per branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clang-tidy:
name: Clang-Tidy Analysis
runs-on: ubuntu-24.04
timeout-minutes: 60
continue-on-error: true # Allow baseline collection without failing CI
steps:
- name: Checkout pacs_system
uses: actions/checkout@v4
with:
path: pacs_system
- name: Checkout kcenon dependencies (pinned versions)
uses: ./pacs_system/.github/actions/checkout-kcenon-deps
with:
patch-werror: 'true'
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential ninja-build clang clang-tidy lld
sudo apt install -y libsqlite3-dev libssl-dev libfmt-dev
sudo apt install -y libgtest-dev libgmock-dev
sudo apt install -y libjpeg-turbo8-dev
- name: Configure CMake
working-directory: pacs_system
run: |
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \
-DPACS_WARNINGS_AS_ERRORS=OFF \
-DPACS_BUILD_TESTS=ON \
-DPACS_BUILD_EXAMPLES=OFF \
-DPACS_BUILD_STORAGE=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run clang-tidy
working-directory: pacs_system
run: |
cd build
# Run clang-tidy on pacs_system sources only
run-clang-tidy -p . \
-header-filter='.*pacs.*' \
../src/ ../include/ \
|| echo "clang-tidy found issues (baseline collection)"
- name: Upload clang-tidy results
if: always()
uses: actions/upload-artifact@v7
with:
name: clang-tidy-results
path: |
pacs_system/build/compile_commands.json
pacs_system/build/**/*.log
retention-days: 7
if-no-files-found: ignore
cppcheck:
name: Cppcheck Analysis
runs-on: ubuntu-24.04
timeout-minutes: 60
continue-on-error: true # Allow baseline collection without failing CI
steps:
- name: Checkout pacs_system
uses: actions/checkout@v4
with:
path: pacs_system
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y cppcheck
- name: Run Cppcheck
working-directory: pacs_system
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@v7
with:
name: cppcheck-results
path: pacs_system/cppcheck-results.xml
retention-days: 7
if-no-files-found: ignore
analysis-summary:
name: Static Analysis Summary
needs: [clang-tidy, cppcheck]
runs-on: ubuntu-24.04
if: always()
steps:
- name: Generate summary
run: |
echo "# Static Analysis Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Analysis Tools" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Tool | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Clang-Tidy | ${{ needs.clang-tidy.result == 'success' && '✅ Passed' || '⚠️ Issues Found' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Cppcheck | ${{ needs.cppcheck.result == 'success' && '✅ Passed' || '⚠️ Issues Found' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📊 Detailed results available in the **Artifacts** section" >> $GITHUB_STEP_SUMMARY