Skip to content

feat: add quality.yml CI workflow with sanitizers and decoupled clang-tidy#348

Open
bburda wants to merge 5 commits intomainfrom
feat/346-quality-ci
Open

feat: add quality.yml CI workflow with sanitizers and decoupled clang-tidy#348
bburda wants to merge 5 commits intomainfrom
feat/346-quality-ci

Conversation

@bburda
Copy link
Copy Markdown
Collaborator

@bburda bburda commented Apr 3, 2026

Pull Request

Summary

  • New quality.yml workflow with 4 parallel Jazzy-only jobs: format-lint, incremental clang-tidy (with ctcache), ASan+UBSan, and TSan
  • New ROS2MedkitSanitizers.cmake module for -DSANITIZER=asan,ubsan / -DSANITIZER=tsan
  • TSan suppression file for known DDS/rclcpp false positives
  • Simplified ci.yml: clang-tidy removed from jazzy-build, jazzy-lint job deleted

Issue


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

  • Local build passes without sanitizers (regression check, 2413 tests pass)
  • Local build + unit tests pass under ASan+UBSan (2413 tests, 0 failures)
  • Sanitizer cmake module verified: -fsanitize=address,undefined flags confirmed in build output
  • CI will validate all 4 quality jobs on this PR
  • TSan suppression file covers known DDS/rclcpp false positives
  • ASan options include new_delete_type_mismatch=0 to suppress known ROS 2/DDS allocator mismatches

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

Copilot AI review requested due to automatic review settings April 3, 2026 10:34
@bburda bburda self-assigned this Apr 3, 2026
@bburda bburda requested a review from mfaferek93 April 3, 2026 10:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated “Quality” CI workflow to run Jazzy-only formatting/linting, incremental clang-tidy, and sanitizer (ASan/UBSan + TSan) unit-test runs, while simplifying the existing CI workflow by removing Jazzy clang-tidy/lint steps.

Changes:

  • Introduces .github/workflows/quality.yml with parallel jobs for format-lint, clang-tidy (with ctcache), ASan+UBSan, and TSan.
  • Adds ROS2MedkitSanitizers.cmake and wires it into several packages to enable -DSANITIZER=... builds.
  • Removes Jazzy clang-tidy/lint coupling from .github/workflows/ci.yml and adds a TSan suppressions file.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsan_suppressions.txt Adds CI-referenced TSan suppressions for known ROS 2/DDS false positives.
src/ros2_medkit_serialization/CMakeLists.txt Includes new sanitizer module for per-package sanitizer flag injection.
src/ros2_medkit_gateway/CMakeLists.txt Includes new sanitizer module for gateway builds/tests.
src/ros2_medkit_fault_reporter/CMakeLists.txt Includes new sanitizer module for sanitizer-enabled builds/tests.
src/ros2_medkit_fault_manager/CMakeLists.txt Includes new sanitizer module for sanitizer-enabled builds/tests.
src/ros2_medkit_discovery_plugins/ros2_medkit_linux_introspection/CMakeLists.txt Includes new sanitizer module for sanitizer-enabled builds/tests.
src/ros2_medkit_diagnostic_bridge/CMakeLists.txt Includes new sanitizer module for sanitizer-enabled builds/tests.
src/ros2_medkit_cmake/CMakeLists.txt Installs the new sanitizer CMake module.
src/ros2_medkit_cmake/cmake/ROS2MedkitSanitizers.cmake Implements -DSANITIZER=... parsing/validation and applies sanitizer flags.
src/ros2_medkit_cmake/cmake/ros2_medkit_cmake-extras.cmake Updates documentation comment to mention the sanitizer module.
.github/workflows/quality.yml New quality workflow running format-lint, clang-tidy, ASan+UBSan, and TSan jobs.
.github/workflows/ci.yml Removes clang-tidy from Jazzy build and deletes the Jazzy lint job; updates gating dependencies.

# Full: all files (filter to our source only)
run-clang-tidy -p build -clang-tidy-binary clang-tidy-cache \
-header-filter='.*ros2_medkit.*' \
'src/ros2_medkit_.*/src/.*\.cpp$'
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the “Full” path, run-clang-tidy is passed a regex-like string as a positional argument. run-clang-tidy typically expects either explicit file paths or a -regex selector; passing a regex as a file argument will likely analyze nothing or fail. Consider switching this to the appropriate -regex option (or enumerating files with find and passing the list) so pushes to main actually run a full analysis.

Suggested change
'src/ros2_medkit_.*/src/.*\.cpp$'
-regex='src/ros2_medkit_.*/src/.*\.cpp$'

Copilot uses AI. Check for mistakes.
endforeach()
list(JOIN _FSANITIZE_FLAGS "," _FSANITIZE_VALUE)

add_compile_options(-fsanitize=${_FSANITIZE_VALUE} -fno-omit-frame-pointer -O1)
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module unconditionally adds -O1 when sanitizers are enabled. That can override the chosen CMAKE_BUILD_TYPE (e.g., Debug’s -O0) and makes sanitizer builds less predictable. Consider not forcing an optimization level here (or making it configurable / conditional) and leave optimization control to the build type/toolchain.

Suggested change
add_compile_options(-fsanitize=${_FSANITIZE_VALUE} -fno-omit-frame-pointer -O1)
add_compile_options(-fsanitize=${_FSANITIZE_VALUE} -fno-omit-frame-pointer)

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +66
add_link_options(-fsanitize=${_FSANITIZE_VALUE})

Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_link_options() requires relatively recent CMake (introduced after older 3.x releases). Since the packages declare cmake_minimum_required(VERSION 3.8), this can break users/build agents running older CMake even if they otherwise satisfy the declared minimum. Either bump the project-wide minimum CMake version accordingly, or add a compatibility fallback (e.g., using target_link_options where possible, or appending to linker flags for older CMake).

Suggested change
add_link_options(-fsanitize=${_FSANITIZE_VALUE})
if(COMMAND add_link_options)
add_link_options(-fsanitize=${_FSANITIZE_VALUE})
else()
foreach(_LINKER_FLAG_VAR
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS)
set(${_LINKER_FLAG_VAR} "${${_LINKER_FLAG_VAR}} -fsanitize=${_FSANITIZE_VALUE}")
endforeach()
endif()

Copilot uses AI. Check for mistakes.
…containers

- PyPI package is 'ctcache', not 'clang-tidy-cache'
- Use shell expansion for TSAN_OPTIONS suppressions path to resolve
  correctly inside GitHub Actions containers (github.workspace gives
  host path, not container path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add quality.yml CI workflow: sanitizers + decoupled clang-tidy

2 participants