Skip to content

Commit 705712c

Browse files
committed
Add ENABLE_CLANG_TIDY option to CMake and update CI
1 parent a93f583 commit 705712c

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
ROS_DISTRO: [humble, jazzy, kilted, rolling]
18+
ROS_DISTRO: [humble, jazzy, kilted]
1919
ROS_REPO: [testing, main]
20+
include:
21+
- ROS_DISTRO: rolling
22+
ROS_REPO: testing
23+
CMAKE_ARGS: "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_CLANG_TIDY=ON"
24+
- ROS_DISTRO: rolling
25+
ROS_REPO: main
26+
CMAKE_ARGS: "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_CLANG_TIDY=ON"
2027
env:
2128
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
2229
ROS_REPO: ${{ matrix.ROS_REPO }}
30+
CMAKE_ARGS: ${{ matrix.CMAKE_ARGS }}
2331
steps:
2432
- name: Checkout repo
2533
uses: actions/checkout@v4
2634
- name: Source tests
2735
uses: "ros-industrial/industrial_ci@master"
28-
env:
29-
CMAKE_ARGS: "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"

CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,17 @@ if(BUILD_TESTING)
165165
)
166166
endif()
167167

168-
# Skip ament_clang_tidy check for all distros except rolling
169-
# to avoid issues with multiple versions of clang being used
170-
if(NOT $ENV{ROS_DISTRO} STREQUAL "rolling")
168+
option(ENABLE_CLANG_TIDY "Enable ament_clang_tidy test" OFF)
169+
if(ENABLE_CLANG_TIDY)
170+
include(ProcessorCount)
171+
processorcount(N)
172+
set(ament_cmake_clang_tidy_JOBS ${N})
173+
else()
171174
list(APPEND AMENT_LINT_AUTO_EXCLUDE
172175
ament_cmake_clang_tidy
173176
)
174177
endif()
175178

176-
include(ProcessorCount)
177-
processorcount(N)
178-
set(ament_cmake_clang_tidy_JOBS ${N})
179-
180179
ament_lint_auto_find_test_dependencies()
181180
endif()
182181

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<exec_depend>rclcpp_components</exec_depend>
3737

3838
<test_depend>ament_lint_auto</test_depend>
39-
<test_depend condition="$ROS_DISTRO == rolling">ament_cmake_clang_tidy</test_depend>
39+
<test_depend>ament_cmake_clang_tidy</test_depend>
4040
<test_depend>ament_cmake_copyright</test_depend>
4141
<test_depend>ament_cmake_lint_cmake</test_depend>
4242
<test_depend>ament_cmake_xmllint</test_depend>

0 commit comments

Comments
 (0)