ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
436 stars 283 forks source link

Setup CI #310

Closed hsd-dev closed 3 years ago

hsd-dev commented 3 years ago

This PR sets up CI using GIthub Actions. It builds and tests ros1_bridge for foxy (ros:foxy-ros1-bridge-focal) and rolling (ros:rolling-ros1-bridge-focal).

It also sets up ccache which helps reduce the build times from ~18 minutes to ~2 minutes. Here are the ccache stats

cache directory                     /home/runner/.ccache
primary config                      /home/runner/.ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats updated                       Fri Apr  2 10:43:59 2021
cache hit (direct)                   249
cache hit (preprocessed)               0
cache miss                           247
cache hit rate                     50.20 %
called for link                       42
cleanups performed                     0
files in cache                       496
cache size                         744.5 MB
max cache size                       5.0 GB

Finally a small fix (FieldHash in ros1_bridge/__init__.py to lowercase) for the tests to pass.

Here is link for the push job.

hsd-dev commented 3 years ago

The cache hit rate with ros-tooling/action-ros-ci is just 1.44 % (see here; and the config) and it still takes ~30 min to build and test. With my custom scripts, I was just building and testing, but with ros-tooling/action-ros-ci, the steps performed are:

Invoking: bash -c 'source /opt/ros/noetic/setup.sh && source /opt/ros/rolling/setup.sh && colcon build --event-handlers console_cohesion+ --packages-up-to ros1_bridge   --symlink-install'
Invoking: bash -c 'source /opt/ros/noetic/setup.sh && source /opt/ros/rolling/setup.sh && colcon lcov-result --initial'
Invoking: bash -c 'source /opt/ros/noetic/setup.sh && source /opt/ros/rolling/setup.sh && colcon test --event-handlers console_cohesion+ --return-code-on-test-failure --packages-select ros1_bridge '
Invoking: bash -c 'source /opt/ros/noetic/setup.sh && source /opt/ros/rolling/setup.sh && colcon lcov-result --filter  --packages-select ros1_bridge --verbose'
Invoking: bash -c 'source /opt/ros/noetic/setup.sh && source /opt/ros/rolling/setup.sh && colcon coveragepy-result --packages-select ros1_bridge --verbose --coverage-report-args -m'

If build times are not a major concern, we can leave out ccache entirely.

jacobperron commented 3 years ago

I don't think a 30min CI time is anything to worry about. We typically run this Jenkins job to test ros1_bridge, which takes about 2 hours. Leaving out ccache sounds good to me, keeping things simple.

hsd-dev commented 3 years ago

@jacobperron should be good to go.