forked from LoneGazebo/Community-Patch-DLL
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 4.23 KB
/
cppcheck.yml
File metadata and controls
119 lines (100 loc) · 4.23 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: cppcheck
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
analysis:
runs-on: ubuntu-22.04
env:
TIMEOUT_EXIT_CODE: 124 # exit code for timeout command
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Debug TIMEOUT_EXIT_CODE
run: |
echo "Timeout exit code: $TIMEOUT_EXIT_CODE"
- name: Make build-dir # Cppcheck work folder
run: mkdir build-dir
# - name: Install latest cppcheck for distro # cppcheck 2.7 is the latest for ubuntu-22.04 https://packages.ubuntu.com/search?keywords=cppcheck
# run: |
# sudo apt-get update
# sudo apt-get --yes install cppcheck
# cppcheck --version
- name: Build cppcheck 2.14.2 # https://stackoverflow.com/a/72307265
run: |
cd /tmp
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.14.1
sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
cd /tmp
sudo rm -rf /tmp/cppcheck
sudo ldconfig
cppcheck --version
- uses: actions/cache@v4
id: cache-build-dir # Check if the cache hit-or-not
with:
path: ./build-dir/ # Path of folder to cache, Cppcheck work folder
key: build-dir-${{ hashFiles('**/*.*') }}
restore-keys: |
build-dir-
- name: Determine number of CPU threads
id: cpu-info
run: echo "cpu_count=$(nproc)" >> $GITHUB_OUTPUT
- name: Run cppcheck analysis
id: cppcheck
run: |
timeout --signal=SIGTERM 350m cppcheck -j ${{ steps.cpu-info.outputs.cpu_count }} --project=VoxPopuli_vs2013.sln --check-level=exhaustive --max-ctu-depth=9999 --cppcheck-build-dir=build-dir --enable=all --std=c++03 --verbose --xml 2> cppcheck.xml || exit_code=$?
echo "exit_code=$exit_code" >> $GITHUB_ENV
if [ $exit_code -eq $TIMEOUT_EXIT_CODE ]; then
echo "cppcheck timed out but continuing"
fi
- name: Debug exit code
run: |
echo "Exit code: $exit_code"
# - name: Upload cppcheck xml on success # TODO enable when retry_analysis can detect exit code
# if: ${{ env.exit_code != env.TIMEOUT_EXIT_CODE }}
# uses: actions/upload-artifact@v4
# with:
# name: cppcheck-xml
# path: ./cppcheck.xml
retry_analysis:
runs-on: ubuntu-22.04
needs: analysis
# if: needs.analysis.outputs.exit_code == 124 # FIXME condition, doesn't detect prior exit code
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Make build-dir # Cppcheck work folder
run: mkdir build-dir
- name: Build cppcheck 2.14.2 # https://stackoverflow.com/a/72307265
run: |
cd /tmp
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.14.1
sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
cd /tmp
sudo rm -rf /tmp/cppcheck
sudo ldconfig
cppcheck --version
- uses: actions/cache@v4
id: cache-build-dir # Check if the cache hit-or-not
with:
path: ./build-dir/ # Path of folder to cache, Cppcheck work folder
key: build-dir-${{ hashFiles('**/*.*') }}
restore-keys: |
build-dir-
- name: Determine number of CPU threads
id: cpu-info
run: echo "cpu_count=$(nproc)" >> $GITHUB_OUTPUT
- name: Run cppcheck analysis
id: cppcheck
run: |
timeout --signal=SIGTERM 350m cppcheck -j ${{ steps.cpu-info.outputs.cpu_count }} --project=VoxPopuli_vs2013.sln --check-level=exhaustive --max-ctu-depth=9999 --cppcheck-build-dir=build-dir --enable=all --std=c++03 --verbose --xml 2> cppcheck.xml || echo "cppcheck timed out but continuing"
- name: Upload cppcheck xml
uses: actions/upload-artifact@v4
with:
name: cppcheck-xml
path: ./cppcheck.xml # Place cppcheck.xml in local source directory and open in cppcheck-gui