Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
yq \
ca-certificates \
clang-format \
ccache \
clang-tidy \
graphviz \
plantuml \
Expand Down
10 changes: 10 additions & 0 deletions .devcontainer/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
grep -Fxq "source /opt/ros/jazzy/setup.bash" ~/.bashrc || echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
grep -Fxq "source /opt/ros/jazzy/setup.zsh" ~/.zshrc || echo "source /opt/ros/jazzy/setup.zsh" >> ~/.zshrc

# ccache configuration for PCH compatibility
grep -Fxq 'export CCACHE_SLOPPINESS=pch_defines,time_macros' ~/.bashrc || echo 'export CCACHE_SLOPPINESS=pch_defines,time_macros' >> ~/.bashrc
grep -Fxq 'export CCACHE_SLOPPINESS=pch_defines,time_macros' ~/.zshrc || echo 'export CCACHE_SLOPPINESS=pch_defines,time_macros' >> ~/.zshrc

# Source the current shell to apply changes immediately
if [ -n "$ZSH_VERSION" ]; then
# Running in zsh
Expand All @@ -22,6 +26,12 @@ if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then
fi
rosdep update

# Install pre-commit hooks (pre-commit for local, pre-push for clang-tidy)
if command -v pre-commit &>/dev/null; then
pre-commit install
pre-commit install --hook-type pre-push
fi

# Test installations
echo "Testing installations..."
echo "ROS2 Jazzy: $(test -f /opt/ros/jazzy/setup.bash && echo 'Installed' || echo 'Not found')"
Expand Down
227 changes: 215 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
fail-fast: false
matrix:
include:
- ros_distro: jazzy
os_image: ubuntu:noble
- ros_distro: humble
os_image: ubuntu:jammy
- ros_distro: rolling
Expand All @@ -41,6 +39,17 @@ jobs:
with:
required-ros-distributions: ${{ matrix.ros_distro }}

- name: Install ccache
run: apt-get install -y ccache

- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-${{ matrix.ros_distro }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.ros_distro }}-

- name: Install cpp-httplib from source (Humble)
if: matrix.ros_distro == 'humble'
run: |
Expand All @@ -58,13 +67,9 @@ jobs:
run: |
apt-get update
apt-get install -y ros-${{ matrix.ros_distro }}-test-msgs
# Linter tools only needed on Jazzy (clang versions differ across Ubuntu releases)
if [ "${{ matrix.ros_distro }}" = "jazzy" ]; then
apt-get install -y clang-format clang-tidy
fi
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
rosdep update
# On Humble, skip the libcpp-httplib-dev rosdep key the apt version (0.10.3)
# On Humble, skip the libcpp-httplib-dev rosdep key - the apt version (0.10.3)
# is too old; cpp-httplib v0.14.3 is built from source in an earlier step.
if [ "${{ matrix.ros_distro }}" = "humble" ]; then
rosdep install --from-paths src --ignore-src -r -y --skip-keys="libcpp-httplib-dev"
Expand All @@ -73,25 +78,207 @@ jobs:
fi

- name: Build packages
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers console_direct+
ccache -s

- name: Run linters (clang-format, clang-tidy, etc.)
if: matrix.ros_distro == 'jazzy'
- name: Run unit and integration tests
timeout-minutes: 15
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
source install/setup.bash
colcon test --return-code-on-test-failure \
--ctest-args -LE linter \
--event-handlers console_direct+

- name: Show test results
if: always()
run: colcon test-result --verbose

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.ros_distro }}
path: |
log/
build/*/test_results/

jazzy-build:
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 30
defaults:
run:
shell: bash

steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy

- name: Install ccache
run: apt-get install -y ccache

- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-jazzy-${{ github.sha }}
restore-keys: |
ccache-jazzy-

- name: Install dependencies
run: |
apt-get update
apt-get install -y ros-jazzy-test-msgs clang-format clang-tidy
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y

- name: Build packages
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG_TIDY=ON \
--event-handlers console_direct+
ccache -s

- name: Package build artifacts
run: tar cf /tmp/jazzy-build.tar build/ install/

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: jazzy-build
path: /tmp/jazzy-build.tar
retention-days: 1

jazzy-lint:
needs: jazzy-build
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 30
defaults:
run:
shell: bash

steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy

- name: Install dependencies
run: |
apt-get update
apt-get install -y clang-format clang-tidy
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: jazzy-build

- name: Extract build artifacts
run: tar xf jazzy-build.tar && rm jazzy-build.tar

- name: Run linters
run: |
source /opt/ros/jazzy/setup.bash
source install/setup.bash
colcon test --return-code-on-test-failure \
--ctest-args -L linter \
--event-handlers console_direct+

- name: Show test results
if: always()
run: colcon test-result --verbose

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-jazzy-lint
path: |
log/
build/*/test_results/

jazzy-test:
needs: jazzy-build
runs-on: ubuntu-latest
container:
image: ubuntu:noble
timeout-minutes: 15
defaults:
run:
shell: bash

steps:
- name: Install Git
run: |
apt-get update
apt-get install -y git

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up ROS 2 Jazzy
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: jazzy

- name: Install dependencies
run: |
apt-get update
apt-get install -y ros-jazzy-test-msgs
source /opt/ros/jazzy/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: jazzy-build

- name: Extract build artifacts
run: tar xf jazzy-build.tar && rm jazzy-build.tar

- name: Run unit and integration tests
timeout-minutes: 15
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
source /opt/ros/jazzy/setup.bash
source install/setup.bash
colcon test --return-code-on-test-failure \
--ctest-args -LE linter \
Expand All @@ -105,7 +292,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.ros_distro }}
name: test-results-jazzy-test
path: |
log/
build/*/test_results/
Expand Down Expand Up @@ -133,6 +320,17 @@ jobs:
with:
required-ros-distributions: jazzy

- name: Install ccache
run: apt-get install -y ccache

- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-coverage-${{ github.sha }}
restore-keys: |
ccache-coverage-

- name: Install dependencies
run: |
apt-get update
Expand All @@ -142,11 +340,16 @@ jobs:
rosdep install --from-paths src --ignore-src -r -y

- name: Build packages with coverage
env:
CCACHE_DIR: /root/.cache/ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros
run: |
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON \
--event-handlers console_direct+
ccache -s

- name: Run unit and integration tests for coverage
run: |
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ repos:
language: system
types_or: [c, c++, python, cmake]
exclude: /vendored/

# ── Incremental clang-tidy (pre-push only) ────────────────────────
# Requires: pre-commit install --hook-type pre-push
- repo: local
hooks:
- id: clang-tidy-diff
name: clang-tidy (changed files only)
entry: ./scripts/clang-tidy-diff.sh
language: system
types: [c++]
exclude: /vendored/
stages: [pre-push]
Loading