-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add cppcheck #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add cppcheck #12
Changes from all commits
1e1cbc2
932876f
4968a94
df9decd
89df532
1e63799
a1d1aa1
145210b
dfc802a
4718070
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,90 +7,68 @@ on: | |
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| format-check: | ||
| static-analysis: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install clang-format | ||
|
|
||
| - name: Install Linting Tools | ||
| run: | | ||
| sudo apt update --yes | ||
| sudo apt install --yes clang-format | ||
| sudo apt install --yes clang-format cppcheck | ||
|
|
||
| - name: Run clang-format | ||
| run: | | ||
| clang-format -style=file -i --dry-run --Werror $(find . \( -name "*.cpp" -o -name "*.cc" -o -name "*.cxx" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.hxx" -o -name "*.inl" \) -not -path "*/build*/*") | ||
| find . \( -name "*.cpp" -o -name "*.cc" -o -name "*.cxx" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.hxx" -o -name "*.inl" \) \ | ||
| -not -path "*/build*/*" | xargs clang-format -style=file --dry-run --Werror | ||
|
|
||
| build-gcc14: | ||
| runs-on: ubuntu-22.04 | ||
| container: gcc:14 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install dependencies | ||
| run: | | ||
| apt update --yes | ||
| apt install --yes cmake clang-tidy | ||
| - name: Build | ||
| - name: Run Cppcheck | ||
| run: | | ||
| mkdir build-gcc14 | ||
| cd build-gcc14 | ||
| cmake -DBUILD_TESTS=ON -DPRODUCTION=ON ../ | ||
| make | ||
| - name: Archive build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-gcc14 | ||
| path: build-gcc14/ | ||
| # --library=googletest: Pomaga zrozumieć makra TEST_F, EXPECT_EQ itp. | ||
| # -DTEST_F(A,B)=void A##B(): "Zaślepkowe" definicje makr, jeśli biblioteka nie wystarczy. | ||
| # -I include: Wskazuje folder z nagłówkami (dostosuj, jeśli masz inną nazwę). | ||
| cppcheck --enable=all \ | ||
| --suppress=unusedFunction \ | ||
| --suppress=missingIncludeSystem \ | ||
| --library=googletest \ | ||
| --inline-suppr \ | ||
| --error-exitcode=1 \ | ||
| -I include \ | ||
| . -i build/ | ||
|
|
||
| test-gcc14: | ||
| build-and-test: | ||
| needs: static-analysis | ||
| runs-on: ubuntu-22.04 | ||
| container: gcc:14 | ||
| needs: build-gcc14 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build-gcc14 | ||
| path: build-gcc14 | ||
| - name: Run unit tests | ||
| run: | | ||
| chmod +x build-gcc14/tests/minic_tests | ||
| cd build-gcc14 | ||
| ./tests/minic_tests | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| gcc_version: [14, 15] | ||
| build_type: [Debug, Release] | ||
|
|
||
| container: gcc:${{ matrix.gcc_version }} | ||
|
|
||
| build-gcc15: | ||
| runs-on: ubuntu-22.04 | ||
| container: gcc:15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install dependencies | ||
|
|
||
| - name: Install Build Dependencies | ||
| run: | | ||
| apt update --yes | ||
| apt install --yes cmake clang-tidy | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| cmake -B build -S . \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DUSE_SANITIZERS=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \ | ||
| -DBUILD_TESTS=ON \ | ||
| -DBUILD_BENCHMARKS=${{ matrix.build_type == 'Release' && 'ON' || 'OFF' }} \ | ||
| -DPRODUCTION=${{ matrix.build_type == 'Release' && 'ON' || 'OFF' }} | ||
|
|
||
| - name: Build | ||
| run: | | ||
|
Comment on lines
+64
to
68
|
||
| mkdir build-gcc15 | ||
| cd build-gcc15 | ||
| cmake -DBUILD_TESTS=ON -DPRODUCTION=ON ../ | ||
| make | ||
| - name: Archive build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-gcc15 | ||
| path: build-gcc15/ | ||
| cmake --build build -j $(nproc) | ||
|
|
||
| test-gcc15: | ||
| runs-on: ubuntu-22.04 | ||
| container: gcc:15 | ||
| needs: build-gcc15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build-gcc15 | ||
| path: build-gcc15 | ||
| - name: Run unit tests | ||
| run: | | ||
| chmod +x build-gcc15/tests/minic_tests | ||
| cd build-gcc15 | ||
| ./tests/minic_tests | ||
| cd build | ||
| ctest --output-on-failure | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
find ... | xargs clang-formatpipeline isn’t robust: filenames with spaces/newlines will be split byxargs, and iffindmatches nothing,xargsmay still invokeclang-formatwith no files (failing the step). Prefer usingfind ... -print0 | xargs -0 -r clang-format ...(orfind ... -exec clang-format ... +) to make this reliable.