-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (84 loc) · 3 KB
/
Copy pathcode-quality.yml
File metadata and controls
95 lines (84 loc) · 3 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
name: Code Quality (Release build)
on:
push:
branches:
- main
- master
- develop
- 'release/**'
pull_request:
branches:
- main
- master
- develop
- 'release/**'
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
code_quality:
name: Code quality (Release)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build cppcheck clang-tidy clang-format
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Conan
run: |
python -m pip install --upgrade pip
pip install conan
- name: Detect Conan profile
run: conan profile detect --force
- name: Configure & Build (Release)
run: |
mkdir -p build
cd build
# Install dependencies (conan) and generate compile commands
conan install .. --output-folder=. --build=missing -s build_type=Release -o build_tests=False
# Find the Conan-generated toolchain file
TOOLCHAIN_FILE=$(find $(pwd) -name "conan_toolchain.cmake" -type f | head -1)
if [ -z "$TOOLCHAIN_FILE" ]; then
echo "Error: conan_toolchain.cmake not found"
exit 1
fi
echo "Using toolchain: $TOOLCHAIN_FILE"
# Configure with toolchain to find Conan packages
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DNOVA_LLM_ENABLE_LOGGING=ON \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE"
ninja -v || cmake --build . --config Release
- name: Run cppcheck
run: |
cd build
# generate cppcheck report using compile_commands.json
if [ -f compile_commands.json ]; then
cppcheck --project=compile_commands.json --enable=all --inconclusive --std=c++17 --output-file=../cppcheck-report.txt || true
else
echo "compile_commands.json not found, running cppcheck on source tree" > ../cppcheck-report.txt
cppcheck --enable=warning,style,performance,portability --std=c++17 ../source || true
fi
- name: Run clang-tidy
run: |
cd build
# Run clang-tidy over translation units and append to a report
rm -f ../clang-tidy-report.txt
# find all .cpp files but exclude the build directory
for f in $(find .. -name '*.cpp' -not -path '*/build/*' -print); do
echo "---- $f ----" >> ../clang-tidy-report.txt
clang-tidy -p . "$f" 2>&1 | sed "s|^| |" >> ../clang-tidy-report.txt || true
done
- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: code-quality-reports
path: |
cppcheck-report.txt
clang-tidy-report.txt