Skip to content

Commit

Permalink
[Meta]: Add GitHub check cmake-format style action
Browse files Browse the repository at this point in the history
  • Loading branch information
GwnDaan authored and ad3154 committed Jan 23, 2023
1 parent 7b378c3 commit 43084d4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 27 deletions.
File renamed without changes.
20 changes: 0 additions & 20 deletions .github/workflows/clang-format.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions utility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -31,7 +30,7 @@ add_library(${PROJECT_NAME}::Utility ALIAS Utility)
# library and use its functionality.
target_include_directories(
Utility PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

install(
TARGETS Utility
Expand Down

0 comments on commit 43084d4

Please sign in to comment.