1+ name : ubuntu CI micro-ROS rcl
2+
3+ # The container image is derived from the branch under test, which works
4+ # because the branch names are the distro names:
5+ # - kilted -> ros:kilted-ros-base (Ubuntu 24.04 noble)
6+ # - lyrical -> ros:lyrical-ros-base (Ubuntu 26.04 resolute)
7+ # - rolling -> ros:rolling-ros-base (Ubuntu 26.04 resolute)
8+ #
9+ # Besides push and pull_request, this is callable via workflow_call so a scheduled
10+ # workflow on the default branch can run it once per distro branch. Note that
11+ # `uses: ./.github/workflows/ci.yml` always resolves to the *caller's* copy of this
12+ # file, so the default branch's copy is what runs for every branch it tests; only
13+ # the checked-out source and the container image follow `inputs.branch`.
14+
15+ on :
16+ push :
17+ branches :
18+ - kilted
19+ - lyrical
20+ - rolling
21+ pull_request :
22+ branches :
23+ - kilted
24+ - lyrical
25+ - rolling
26+ workflow_call :
27+ inputs :
28+ branch :
29+ description : >
30+ Distro branch to check out and test. Leave unset for push and
31+ pull_request, where the triggering ref is used instead.
32+ type : string
33+ required : false
34+ default : ' '
35+ # To enable manual trigger
36+ workflow_dispatch :
37+
38+ concurrency :
39+ group : ${{ github.workflow }}-${{ github.ref }}-${{ inputs.branch }}
40+ cancel-in-progress : true
41+
42+ env :
43+ # Single source of truth for what gets built and tested.
44+ TESTED_PACKAGES : rcl rcl_action rcl_lifecycle
45+
46+ defaults :
47+ run :
48+ shell : bash
49+
50+ jobs :
51+ rcl_microros_ci :
52+ runs-on : ubuntu-latest
53+ # inputs.branch is used when this workflow is called
54+ # github.base_ref covers pull requests
55+ # github.ref_name is the branch on a push
56+ container : ros:${{ inputs.branch || github.base_ref || github.ref_name }}-ros-base
57+ timeout-minutes : 90
58+
59+ steps :
60+ - uses : actions/checkout@v5
61+ with :
62+ # Empty on push and pull_request, which leaves checkout's own behaviour
63+ # intact — importantly the PR merge ref, so PRs keep testing the merge
64+ # result rather than the base branch.
65+ ref : ${{ inputs.branch }}
66+ path : src/rcl
67+
68+ - name : Download dependencies
69+ run : |
70+ : "${ROS_DISTRO:?not set — is the container a ros:<distro>-ros-base image?}"
71+ . /opt/ros/$ROS_DISTRO/setup.bash
72+
73+ # The image ships no apt lists (every layer of its Dockerfile ends in
74+ # `rm -rf /var/lib/apt/lists/*`) and rosdep does not refresh them itself,
75+ # so this is required before rosdep can install anything.
76+ apt-get update
77+ apt-get dist-upgrade -y
78+
79+ # Every rcl test dependency (mimick_vendor, osrf_testing_tools_cpp,
80+ # test_msgs, launch_testing_ament_cmake, ...) is a released binary.
81+ # rosdep is already initialised in the image; only its cache is stale.
82+ rosdep update --rosdistro $ROS_DISTRO
83+ rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r -y
84+
85+ - name : Build
86+ # GitHub replaces the image's entrypoint for container jobs, so
87+ # /ros_entrypoint.sh never runs and each step must source ROS itself.
88+ run : |
89+ . /opt/ros/$ROS_DISTRO/setup.bash
90+ colcon --log-base /dev/null build \
91+ --event-handlers console_direct+ \
92+ --packages-up-to $TESTED_PACKAGES \
93+ --cmake-args -DCMAKE_BUILD_TYPE=Release -DRCL_MICROROS=ON
94+
95+ - name : Test
96+ run : |
97+ . /opt/ros/$ROS_DISTRO/setup.bash
98+ colcon --log-base /dev/null test \
99+ --event-handlers console_direct+ \
100+ --return-code-on-test-failure \
101+ --packages-select $TESTED_PACKAGES
102+
103+ - name : Test results
104+ # The per-package tallies colcon prints are not a cross-package summary;
105+ # this step is. It runs even when the test step failed.
106+ if : ${{ !cancelled() }}
107+ run : |
108+ . /opt/ros/$ROS_DISTRO/setup.bash
109+ colcon test-result --verbose
0 commit comments