Skip to content

Commit c5b14d0

Browse files
committed
add file
Signed-off-by: kminoda <koji.minoda@tier4.jp>
1 parent 132a17c commit c5b14d0

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: cppcheck-monitor
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: 0 0 * * *
7+
workflow_dispatch:
8+
9+
jobs:
10+
cppcheck-monitor:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y build-essential cmake git libpcre3-dev
21+
22+
# cppcheck from apt does not yet support --check-level args, and thus install from source
23+
- name: Install Cppcheck from source
24+
run: |
25+
mkdir /tmp/cppcheck
26+
git clone https://github.com/danmar/cppcheck.git /tmp/cppcheck
27+
cd /tmp/cppcheck
28+
git checkout 2.14.1
29+
mkdir build
30+
cd build
31+
cmake ..
32+
make -j $(nproc)
33+
sudo make install
34+
35+
- name: Run Cppcheck on all files
36+
continue-on-error: true
37+
run: |
38+
cppcheck --enable=all --inconclusive --check-level=exhaustive --error-exitcode=1 --xml . 2> cppcheck-report.xml
39+
shell: bash
40+
41+
- name: Count errors by error ID and severity
42+
run: |
43+
#!/bin/bash
44+
temp_file=$(mktemp)
45+
grep -oP '(?<=id=")[^"]+" severity="[^"]+' cppcheck-report.xml | sed 's/" severity="/,/g' > "$temp_file"
46+
echo "Error counts by error ID and severity:"
47+
sort "$temp_file" | uniq -c
48+
rm "$temp_file"
49+
shell: bash
50+
51+
- name: Upload Cppcheck report
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: cppcheck-report
55+
path: cppcheck-report.xml

0 commit comments

Comments
 (0)