Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces local colcon test time from ~20 minutes to ~1-2 minutes by making clang-tidy opt-in (default OFF), adding ccache support, introducing precompiled headers for the gateway package, adding parallel CTest execution, and providing convenience scripts. The changes enable faster development iteration while maintaining full linting coverage in CI.
Changes:
- Made clang-tidy opt-in via
ENABLE_CLANG_TIDYCMake option (OFF by default, enabled in CI for Jazzy) - Added ccache integration via new
ROS2MedkitCcache.cmakemodule included in all 5 C++ packages - Added precompiled headers to gateway_lib (rclcpp, nlohmann/json, httplib, common STL headers)
- Created
test.shconvenience script with presets (unit, integ, lint, tidy, all) and parallel execution - Added incremental clang-tidy support via
clang-tidy-diff.shand pre-push hook - Configured CI ccache with persistent caching across builds
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmake/ROS2MedkitCcache.cmake | New shared module for auto-detecting and enabling ccache |
| src/ros2_medkit_serialization/CMakeLists.txt | Add ccache module, gate clang-tidy behind ENABLE_CLANG_TIDY option |
| src/ros2_medkit_gateway/CMakeLists.txt | Add ccache module, PCH for gateway_lib, gate clang-tidy behind ENABLE_CLANG_TIDY option |
| src/ros2_medkit_fault_reporter/CMakeLists.txt | Add ccache module, gate clang-tidy behind ENABLE_CLANG_TIDY option |
| src/ros2_medkit_fault_manager/CMakeLists.txt | Add ccache module, gate clang-tidy behind ENABLE_CLANG_TIDY option |
| src/ros2_medkit_diagnostic_bridge/CMakeLists.txt | Add ccache module, gate clang-tidy behind ENABLE_CLANG_TIDY option |
| scripts/test.sh | New convenience script with named presets for fast test execution |
| scripts/merge-compile-commands.sh | Utility to merge per-package compile_commands.json for project-wide tooling |
| scripts/clang-tidy-diff.sh | Incremental clang-tidy for pre-push hook (changed .cpp files only) |
| .pre-commit-config.yaml | Add pre-push hook for incremental clang-tidy |
| .gitignore | Add git worktrees directory to ignore list |
| .github/workflows/ci.yml | Install ccache, configure caching, conditionally enable clang-tidy on Jazzy |
mfaferek93
reviewed
Feb 25, 2026
mfaferek93
approved these changes
Feb 26, 2026
c34f805 to
13b6ab6
Compare
Provides named presets (unit, integ, lint, tidy, all) with parallel CTest execution to avoid remembering ctest filter flags.
clang-tidy takes 8-10 min on the gateway package alone. Gated behind ENABLE_CLANG_TIDY=OFF (default). CI sets it ON for the Jazzy linter job. Developers can still run it with: colcon build --cmake-args -DENABLE_CLANG_TIDY=ON ./scripts/test.sh tidy
Adds ROS2MedkitCcache.cmake module that enables ccache when found on PATH. All C++ packages include it. No effect when ccache is absent. Set CCACHE_SLOPPINESS=pch_defines,time_macros for PCH compatibility.
PCH for rclcpp, nlohmann/json, httplib, and common STL headers. Reduces full gateway build time by ~30-40%. Can be disabled with -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON.
ccache with persistent cache reduces CI rebuild times by ~30-50% on subsequent runs. CCACHE_SLOPPINESS set for PCH compatibility.
Runs clang-tidy only on changed C++ source files using a merged compile_commands.json. Typical run: 5-30s vs 8-10 min for full analysis. Registered as pre-push hook (not pre-commit) to avoid slowing normal commits. Run ./scripts/merge-compile-commands.sh after build.
…cmake Extract duplicated option(ENABLE_CLANG_TIDY) and clang-tidy configuration into a shared cmake module. Each package now calls ros2_medkit_clang_tidy() with optional HEADER_FILTER and TIMEOUT parameters.
Adds ccache with persistent GitHub Actions cache to the coverage build. Uses separate cache key (ccache-coverage-) from Release builds since coverage builds with -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON.
Removes Jazzy from the build-and-test matrix and creates dedicated jazzy-build, jazzy-lint, and jazzy-test jobs. Lint and test run in parallel after the build job completes, reducing wall-clock time by ~3min (previously sequential: build -> lint -> test). Humble and Rolling remain as single build-and-test matrix jobs.
- Replace raw colcon test commands with scripts/test.sh presets - Add pre-push hook section documenting clang-tidy-diff.sh and merge-compile-commands.sh setup - Update CI/CD section to reflect the split Jazzy build/lint/test jobs
72fd28f to
1e2042f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces local test cycle from ~20 min to ~1-2 min and optimizes CI wall-clock time by splitting Jazzy into parallel jobs.
Local DX:
-DENABLE_CLANG_TIDY=ON), mandatory in CIscripts/test.shconvenience script with presets (unit, integ, lint, tidy, all)scripts/clang-tidy-diff.sh)CI optimizations:
jazzy-build->jazzy-lint|jazzy-test(parallel after build)Other:
ENABLE_CLANG_TIDYintocmake/ROS2MedkitLinting.cmakeIssue
Type
Testing
Local verification (requires ROS 2 Jazzy environment):
./scripts/test.sh- unit tests (~1-2 min with warm ccache)./scripts/test.sh lint- linters excluding clang-tidy (~30s)./scripts/test.sh tidy- clang-tidy only (opt-in, ~8-10 min)./scripts/test.sh unit --packages-select ros2_medkit_gateway- single package./scripts/merge-compile-commands.sh && ./scripts/clang-tidy-diff.sh- incremental clang-tidycolcon build 2>&1 | grep "ccache found"- verify ccache auto-detectionCI verification:
build-and-test(Humble + Rolling): build with ccache + unit/integration testsjazzy-build: build with ccache + clang-tidy enabledjazzy-lint+jazzy-test: run in parallel afterjazzy-buildcoverage: build with ccache (separate cache key for Debug builds)Checklist