-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.45 KB
/
ci-cppcheck.yml
File metadata and controls
87 lines (76 loc) · 2.45 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
name: cppcheck
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
#Allows you to start workflow manually from the actions tab in the interface github.com
workflow_dispatch:
jobs:
cppcheck:
runs-on: ubuntu-latest
steps:
- name: configure system
run: |
sudo apt-get update
sudo apt-get install -y make ninja-build
- uses: actions/checkout@v4
with:
submodules: recursive
- name: cache cppcheck
id: cache-cppcheck
uses: actions/cache@v4
with:
path: _cppcheck
key: ${{ runner.os }}-cppcheck-2.19.0
restore-keys: ${{ runner.os }}-cppcheck-2.19.0
- if: ${{ steps.cache-cppcheck.outputs.cache-hit != 'true' }}
name: download and build cppcheck
run: |
mkdir -p _cppcheck
wget -O _cppcheck/cppcheck.tar.gz https://github.com/danmar/cppcheck/archive/refs/tags/2.19.0.tar.gz
cd _cppcheck
tar -xzf cppcheck.tar.gz
cd cppcheck-2.19.0
make -j
pwd
ls ./cppcheck
./cppcheck --version
cd ../..
_cppcheck/cppcheck-2.19.0/cppcheck --version
# we need configure cmake to get the compile_commands.json file
- name: cmake configure
run: >
cmake -B build
-G Ninja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_BUILD_TYPE=Release
-C ".github/workflows/linux_initial_cache.txt"
-S projects/cmake
- name: cache cppcheck_build_dir
id: cache-cppcheck_build_dir
uses: actions/cache@v4
with:
path: _cppcheck_build_dir
key: ${{ runner.os }}-cppcheck_build_dir
restore-keys: ${{ runner.os }}-cppcheck_build_dir
# _cppcheck_build_dir is required to increase cppcheck check speed
- if: ${{ steps.cache-cppcheck_build_dir.outputs.cache-hit != 'true' }}
name: cppcheck_build_dir
run: mkdir -p _cppcheck_build_dir
- name: cppcheck
run: >
./_cppcheck/cppcheck-2.19.0/cppcheck --project=build/compile_commands.json
-D__GNUC__=4
--safety
--error-exitcode=-1
-i "third_party/*"
--enable=warning,performance,portability,missingInclude
--suppressions-list=./cppcheck_suppressions.txt
--inline-suppr
--quiet
-j $(nproc)
--cppcheck-build-dir=./_cppcheck_build_dir
--checkers-report=./checkers.txt
- name: print checkers report
run: cat checkers.txt