Skip to content

Commit

Permalink
Add support for installing ROS using APT (#30)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
  • Loading branch information
Thomas Moulard authored Dec 9, 2019
1 parent a185f70 commit d4ba073
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ jobs:
- run: which colcon
- run: which rosdep
- run: which vcs

test_binary_install:
name: "ROS and ROS 2 Binary Install Test Suite (Linux only)"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm ci
- run: npm run build

- uses: ./ # Uses an action in the root directory
with:
required-ros-distributions: melodic dashing
- run: test -f /opt/ros/dashing/setup.sh
name: "Check that dashing setup.sh has been installed."
- run: test -f /opt/ros/melodic/setup.sh
name: "Check that melodic setup.sh has been installed."
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ author: 'ROS Tooling Working Group'
branding:
icon: 'box'
color: 'gray-dark'
inputs:
required-ros-distributions:
description: |
List of binary ROS distributions to be installed.
Support for non-Linux platform is not implemented yet, so this
parameter is ignored on Mac OS X and Windows.
Allowed ROS distributions
- "" (no value) - no ROS binary installation
- kinetic
- melodic
- dashing
- eloquent
- source
Multiple values can be passed using a whitespace delimited list
"melodic dashing".
For each passed ROS distribution, its desktop variant will be installed.
required: false
default: ""
runs:
using: 'node12'
main: 'dist/index.js'
12 changes: 12 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,11 @@ function runLinux() {
"--recv-keys",
"C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"
]);
yield utils.exec("sudo", [
"bash",
"-c",
`echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list`
]);
yield utils.exec("sudo", [
"bash",
"-c",
Expand All @@ -1063,6 +1068,13 @@ function runLinux() {
yield pip.installPython3Dependencies();
// Initializes rosdep
yield utils.exec("sudo", ["rosdep", "init"]);
const requiredRosDistributions = core.getInput("required-ros-distributions");
if (requiredRosDistributions) {
const requiredRosDistributionsList = requiredRosDistributions.split(RegExp("\\s"));
for (let rosDistro of requiredRosDistributionsList) {
yield apt.runAptGetInstall([`ros-${rosDistro}-desktop`]);
}
}
});
}
exports.runLinux = runLinux;
Expand Down
15 changes: 15 additions & 0 deletions src/setup-ros2-linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export async function runLinux() {
"--recv-keys",
"C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"
]);
await utils.exec("sudo", [
"bash",
"-c",
`echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list`
]);
await utils.exec("sudo", [
"bash",
"-c",
Expand All @@ -50,4 +55,14 @@ export async function runLinux() {
await pip.installPython3Dependencies();
// Initializes rosdep
await utils.exec("sudo", ["rosdep", "init"]);

const requiredRosDistributions = core.getInput("required-ros-distributions");
if (requiredRosDistributions) {
const requiredRosDistributionsList = requiredRosDistributions.split(
RegExp("\\s")
);
for (let rosDistro of requiredRosDistributionsList) {
await apt.runAptGetInstall([`ros-${rosDistro}-desktop`]);
}
}
}

0 comments on commit d4ba073

Please # to comment.