Skip to content

Commit 951ed0a

Browse files
committed
Add CodeChecker static analyzer in CI
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
1 parent b9285b5 commit 951ed0a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/codechecker.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CodeChecker Analysis
2+
3+
on:
4+
push:
5+
# branches: [main]
6+
pull_request:
7+
# branches: [main]
8+
9+
env:
10+
LLVM_VERSION: 22
11+
12+
jobs:
13+
analyze:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y build-essential python3-pip wget lsb-release software-properties-common gnupg
22+
wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
23+
# Temporary fix to install clang-22
24+
sed -i 's/LLVM_VERSION_PATTERNS\[22\]=\"\"/LLVM_VERSION_PATTERNS[22]=\"-22\"/' llvm.sh
25+
sudo bash /tmp/llvm.sh ${{ env.LLVM_VERSION }}
26+
pip3 install codechecker
27+
28+
- name: Build with compile commands
29+
run: |
30+
mkdir build && cd build
31+
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
32+
33+
- name: Run CodeChecker analyze
34+
run: |
35+
CodeChecker analyze build/compile_commands.json \
36+
--analyzers clangsa \
37+
--output ./reports
38+
39+
- name: Parse results
40+
run: CodeChecker parse ./reports
41+
42+
- name: Generate HTML report
43+
if: always()
44+
run: |
45+
CodeChecker parse ./reports \
46+
--export html \
47+
--output ./reports-html
48+
49+
- name: Upload report
50+
if: always()
51+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
52+
with:
53+
name: codechecker-report
54+
path: ./reports-html

0 commit comments

Comments
 (0)