Skip to content

Commit 67ffc02

Browse files
Make tests pass on ROS 2 (#124)
* Install the test assets to the share directory; otherwise the tests cannot locate the files to install * Check for the systemd config file, not upstart. Upstart check left but commented-out for legacy & reference * Add github workflows * Modify CI to make sure tests are run * Specify container * Roll back to official template (https://github.com/marketplace/actions/ros-2-ci-action), explicitly set skip-tests to false * Add CI for other supported ROS distros * Remove Foxy * Improve workspace fallback * Fix build status in the README * Set branches for CI (this repo also has ROS 1 branches we don't care about testing with the new CI)
1 parent 12340f4 commit 67ffc02

File tree

5 files changed

+60
-7
lines changed

5 files changed

+60
-7
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: robot_upstart_ci
2+
3+
on:
4+
push:
5+
branches: [foxy-devel]
6+
pull_request:
7+
branches: [foxy-devel]
8+
9+
jobs:
10+
jazzy_ci:
11+
name: Jazzy
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/[email protected]
15+
- uses: ros-tooling/[email protected]
16+
with:
17+
required-ros-distributions: jazzy
18+
- uses: ros-tooling/[email protected]
19+
id: action_ros_ci_step
20+
with:
21+
target-ros2-distro: jazzy
22+
import-token: ${{ secrets.GITHUB_TOKEN }}
23+
skip-tests: false
24+
package-name:
25+
robot_upstart
26+
27+
humble_ci:
28+
name: Humble
29+
runs-on: ubuntu-22.04
30+
steps:
31+
- uses: actions/[email protected]
32+
- uses: ros-tooling/[email protected]
33+
with:
34+
required-ros-distributions: humble
35+
- uses: ros-tooling/[email protected]
36+
id: action_ros_ci_step
37+
with:
38+
target-ros2-distro: humble
39+
import-token: ${{ secrets.GITHUB_TOKEN }}
40+
skip-tests: false
41+
package-name:
42+
robot_upstart

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
robot_upstart [![Build Status](https://travis-ci.org/clearpathrobotics/robot_upstart.svg?branch=jade-devel)](https://travis-ci.org/clearpathrobotics/robot_upstart)
2-
=============
1+
# robot_upstart [![robot_upstart_ci](https://github.com/clearpathrobotics/robot_upstart/actions/workflows/ci.yml/badge.svg?branch=foxy-devel)](https://github.com/clearpathrobotics/robot_upstart/actions/workflows/ci.yml)
32

43
Clearpath Robotics presents a suite of scripts to assist with launching background ROS processes on Ubuntu Linux PCs. Please see the [generated documentation](http://docs.ros.org/latest-available/api/robot_upstart/html/) and [ROS Wiki](http://wiki.ros.org/robot_upstart).

robot_upstart/job.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,18 @@ def __init__(self, name="ros", rmw=None, rmw_config=None, interface=None,
8282
# Fall back on current user as the user to run ROS as.
8383
self.user = user or getpass.getuser()
8484

85-
# Fall back on current workspace setup file if not explicitly specified.
86-
self.workspace_setup = workspace_setup or \
87-
os.environ['CMAKE_PREFIX_PATH'].split(':')[0] + '/../setup.bash'
88-
8985
# Fall back on current distro if not otherwise specified.
9086
self.rosdistro = rosdistro or os.environ['ROS_DISTRO']
9187

88+
# Prioritize specified workspace, falling back to current workspace if possible, or
89+
# system workspace as a last-resort
90+
if workspace_setup:
91+
self.workspace_setup = workspace_setup
92+
elif 'CMAKE_PREFIX_PATH' in os.environ.keys():
93+
self.workspace_setup = os.environ['CMAKE_PREFIX_PATH'].split(':')[0] + '/../setup.bash'
94+
else:
95+
self.workspace_setup = f'/opt/ros/{self.rosdistro}/setup.bash'
96+
9297
self.rmw = rmw or "rmw_fastrtps_cpp"
9398

9499
self.rmw_config = rmw_config or ""

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
(os.path.join('lib', PACKAGE_NAME, 'scripts'), glob('scripts/*')),
1616
(os.path.join('share', PACKAGE_NAME, 'scripts'), glob('scripts/*')),
1717
(os.path.join('share', PACKAGE_NAME, 'templates'), glob('templates/*')),
18+
(os.path.join('share', PACKAGE_NAME, 'test'), glob('test/*.py')),
19+
(os.path.join('share', PACKAGE_NAME, 'test/launch'), glob('test/launch/*.launch')),
1820
],
1921
install_requires=['setuptools'],
2022
zip_safe=True,

test/test_basics.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def test_install(self):
3232

3333
self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-start")), "Start script not created.")
3434
self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-stop")), "Stop script not created.")
35-
self.assertTrue(os.path.exists(self.pjoin("etc/init/foo.conf")), "Upstart configuration file not created.")
35+
36+
# Systemd config
37+
self.assertTrue(os.path.exists(self.pjoin("etc/systemd/system/multi-user.target.wants/foo.service")), "Systemd service file not created.")
38+
39+
# Upstart config
40+
#self.assertTrue(os.path.exists(self.pjoin("etc/init/foo.conf")), "Upstart configuration file not created.")
3641

3742
self.assertEqual(0, subprocess.call(["bash", "-n", self.pjoin("usr/sbin/foo-start")]),
3843
"Start script not valid bash syntax.")

0 commit comments

Comments
 (0)