Skip to content

Commit

Permalink
[cmake] add CMakeLint support
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Aug 22, 2022
1 parent d1d0b7e commit 291f98c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 75 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/verify_code_static_analysis_cppcheck.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/verify_code_static_analysis_tidy.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/verify_static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Test Static Analysis"

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
- name: Install
run: |
sudo apt update
sudo apt install clang-tidy-14
pip install cmakelang
( cd /tmp ;
git clone --depth 1 https://gitlab.com/libeigen/eigen.git ;
( cd eigen ;
mkdir build ;
( cd build ;
cmake .. ;
cmake --build . ;
sudo make install ; ) ) )
( cd /tmp ;
git clone --depth 1 https://github.com/fmtlib/fmt.git ;
( cd fmt ;
mkdir build ;
( cd build ;
CXX=clang++-14 cmake -DFMT_HEADER_ONLY=TRUE .. ;
sudo make install ; ) ) )
( cd /tmp ;
git clone --depth 1 https://github.com/danmar/cppcheck.git ;
( cd cppcheck ;
mkdir build ;
( cd build ;
cmake .. ;
cmake --build . ;
sudo make install ; ) ) )
- name: Verify CppCheck
run: cppcheck --verbose --error-exitcode=1 --enable=all -I include .
- name: Verify ClangTidy
run: FILES=`find . -iname *.hpp -o -iname *.tpp` clang-tidy-14 ${FILES} --warnings-as-errors=* -- -x c++ -Iinclude -I/usr/local/include/eigen3 -Isupport/include/fcarouge -DFMT_HEADER_ONLY -Wall -Wextra -pedantic -std=c++2b -stdlib=libc++ -lfmt
- name: Verify CMakeLint
run: cmake-lint CMakeLists.txt
8 changes: 4 additions & 4 deletions .github/workflows/verify_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
sudo apt install clang-format-14
pip install cmakelang
- name: Verify
run: |
find . -iname *.hpp -o -iname *.cpp -o -iname *.tpp -o -iname support/** | xargs clang-format-14 --Werror --dry-run --verbose -style=file
cmake-format --check CMakeLists.txt
- name: Verify ClangFormat
run: find . -iname *.hpp -o -iname *.cpp -o -iname support/** | xargs clang-format-14 --Werror --dry-run --verbose -style=file
- name: Verify CMakeFormat
run: cmake-format --check CMakeLists.txt

0 comments on commit 291f98c

Please sign in to comment.