-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (136 loc) · 6.58 KB
/
codeChecks.yml
File metadata and controls
150 lines (136 loc) · 6.58 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
143
144
145
146
147
148
149
150
name: "Code Checks"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
check-code:
name: Checking code before build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout FVA repository
uses: actions/checkout@v2 #v2 to checkout submodules as well
with:
submodules: 'true'
- name: Cpp Code check
uses: deep5050/cppcheck-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
check_library: enable
max_ctu_depth: 5
- name: Upload Cpp Code check report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./cppcheck_report.txt
name: cppcheck_report.zip
- name: clang-tidy check
run: |
echo "==================Installing clang-tidy====================================="
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt install clang-tidy-17
rm ./llvm.sh
echo "==================Creating compile_commands.json====================================="
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
echo "==================Running clang-tidy====================================="
clang-tidy ./src/*.cpp -checks='*' > ./clang-tidy-report.txt
clang-tidy ./src/*.h -checks='*' >> ./clang-tidy-report.txt
clang-tidy ./tests/*.cpp -checks='*' >> ./clang-tidy-report.txt
#clang-tidy ./tests/*.h -checks='*' >> ./clang-tidy-report.txt
- name: Upload clang-tidy report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./clang-tidy-report.txt
name: clang-tidy-report.zip
- name: Format check
run: |
echo "==================Installing clang-format====================================="
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt install clang-format-17
rm ./llvm.sh
echo "==================Running clang-format====================================="
for i in $(find . -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\)' -not -path "./build/*" -not -path "./CMakeFiles/*" -not -path "./_deps/*"); do if ! clang-format-17 -style=file --dry-run --Werror "$i"; then exit 1; fi done
- name: Check for suspect words
# This step checks for suspect words in the codebase
run: |
python3 ./tools/check_suspect_words.py "./src" --marker-file ./tools/check_suspect_words.txt > ./suspect-words-report.txt
#python3 ./tools/check_suspect_words.py "./tools" --marker-file ./tools/check_suspect_words.txt >> ./suspect-words-report.txt
python3 ./tools/check_suspect_words.py "./tests" --marker-file ./tools/check_suspect_words.txt >> ./suspect-words-report.txt
- name: Upload suspect words report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./suspect-words-report.txt
name: suspect-words-report.zip
- name: Check for boilerplate code
# This step checks for boilerplate code in the codebase
run: |
python3 ./tools/check_boilerplate.py --src "./src" --boilerplate ./tools/check_boilerplate.txt > ./boilerplate-report.txt
#python3 ./tools/check_boilerplate.py --src "./tools" --boilerplate ./tools/check_boilerplate.txt >> ./boilerplate-report.txt
python3 ./tools/check_boilerplate.py --src "./tests" --boilerplate ./tools/check_boilerplate.txt >> ./boilerplate-report.txt
- name: Upload boilerplate report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./boilerplate-report.txt
name: boilerplate-report.zip
- name: Check for large files
# This step checks for large files in the codebase
run: |
python3 ./tools/check_file_size.py "./src" 500 "//" .cpp .h > ./file-size-report.txt
#python3 ./tools/check_file_size.py "./tools" 500 "#" .py >> ./file-size-report.txt
python3 ./tools/check_file_size.py "./tests" 500 "//" .cpp .h >> ./file-size-report.txt
- name: Upload file size report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./file-size-report.txt
name: file-size-report.zip
- name: CMake Format check
run: |
echo "==================Installing cmake-format====================================="
pip install cmake-format
echo "==================Running cmake-format====================================="
FILES=$(find . -name "CMakeLists.txt" | grep -vE "(^./CMakeFiles/.|^./_deps/)")
cmake-format --check $FILES >> ./cmake-format-report.txt
echo "==================Uploading cmake-format report====================================="
cat ./cmake-format-report.txt
- name: Upload cmake-format report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./cmake-format-report.txt
name: cmake-format-report.zip
- name: CMake Linter check
run: |
echo "==================Installing cmake-lint-format====================================="
pip install cmakelint
echo "==================Running cmakelint====================================="
FILES=$(find . -name "CMakeLists.txt" | grep -vE "(^./CMakeFiles/.|^./_deps/)")
: > ./cmakelint-format-report.txt
for file in $FILES; do
{
echo "===== $file ====="
cmakelint "$file"
echo
} >> ./cmakelint-format-report.txt 2>&1 || true
done
- name: Upload cmakelint-format report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./cmakelint-format-report.txt
name: cmakelint-format-report.zip
- name: MarkDown Lint check
continue-on-error: true
run: |
echo "==================Installing markdownlint-cli====================================="
npm install -g markdownlint-cli
echo "==================Running markdownlint====================================="
markdownlint "**/*.md" > ./markdownlint-report.txt 2>&1
- name: Upload markdownlint report to git hub storage to use later
uses: actions/upload-artifact@v4
with:
path: ./markdownlint-report.txt
name: markdownlint-report.zip