diff --git a/.cmake-format.yml b/.cmake-format.yaml similarity index 100% rename from .cmake-format.yml rename to .cmake-format.yaml diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml deleted file mode 100644 index 12a38980..00000000 --- a/.github/workflows/clang-format.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Linting -on: pull_request -jobs: - formatting-check: - name: Formatting Check - runs-on: ubuntu-latest - strategy: - matrix: - path: - - 'isobus' - - 'socket_can' - - 'examples' - steps: - - uses: actions/checkout@v3 - - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.9.0 - with: - clang-format-version: '13' - check-path: ${{ matrix.path }} - fallback-style: 'Google' # optional \ No newline at end of file diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 00000000..61f51e17 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,41 @@ +name: Linting +on: pull_request +jobs: + clang-format: + name: clang-format style + runs-on: ubuntu-latest + strategy: + matrix: + path: + - "isobus" + - "socket_can" + - "examples" + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.9.0 + with: + clang-format-version: "13" + check-path: ${{ matrix.path }} + fallback-style: "Google" # optional + cmake-format: + name: cmake-format style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install lint tool + run: | + python -m pip install --upgrade pip + pip install cmake-format pyyaml + - name: Check cmake-lint + run: find . -name CMakeLists.txt | xargs cmake-lint + - name: Run cmake-format + run: find . -name CMakeLists.txt | xargs cmake-format -i + - name: Check cmake-format + run: git diff --patch-with-stat --exit-code diff --git a/CMakeLists.txt b/CMakeLists.txt index 67c29523..d76e4cbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,8 +104,7 @@ if(BUILD_TESTING) target_link_libraries( unit_tests PRIVATE GTest::gtest_main ${PROJECT_NAME}::Isobus - ${PROJECT_NAME}::HardwareIntegration - ${PROJECT_NAME}::Utility) + ${PROJECT_NAME}::HardwareIntegration ${PROJECT_NAME}::Utility) include(GoogleTest) gtest_discover_tests(unit_tests name_tests identifier_tests) diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt index 6d87b973..139796bf 100644 --- a/utility/CMakeLists.txt +++ b/utility/CMakeLists.txt @@ -9,18 +9,17 @@ set(UTILITY_INCLUDE_DIR "include/isobus/utility") # Set source files set(UTILITY_SRC "system_timing.cpp" "processing_flags.cpp" - "iop_file_interface.cpp") + "iop_file_interface.cpp") # Prepend the source directory path to all the source files prepend(UTILITY_SRC ${UTILITY_SRC_DIR} ${UTILITY_SRC}) # Set the include files set(UTILITY_INCLUDE "system_timing.hpp" "processing_flags.hpp" - "iop_file_interface.hpp" "to_string.hpp") + "iop_file_interface.hpp" "to_string.hpp") # Prepend the include directory path to all the include files -prepend(UTILITY_INCLUDE ${UTILITY_INCLUDE_DIR} - ${UTILITY_INCLUDE}) +prepend(UTILITY_INCLUDE ${UTILITY_INCLUDE_DIR} ${UTILITY_INCLUDE}) # Create the library from the source and include files add_library(Utility ${UTILITY_SRC} ${UTILITY_INCLUDE}) @@ -31,7 +30,7 @@ add_library(${PROJECT_NAME}::Utility ALIAS Utility) # library and use its functionality. target_include_directories( Utility PUBLIC $ - $) + $) install( TARGETS Utility