Skip to content

Commit a39dbb3

Browse files
cheng-kevinchengkeCheng
authored
support ros2 foxy (#23)
* support ros2 foxy use gazebo11 for focal exclude dashing+11 and foxy+9 updated package names switch python package on ubuntu-distro switch on ros_distro fix bug remove ubuntu distro add gazebo11 to output testing ros2 foxy branch - need to revert this create separate test for foxy fix wrong include * switch py3 packages on ubuntu-distro * remove optional ubuntu_distro from test.yaml * don't install py2 packages for focal * commit unsaved change * clean up code * use ros-distro to determine py3 vs py2 packages Co-authored-by: chengke <[email protected]> Co-authored-by: Cheng <[email protected]>
1 parent d78532a commit a39dbb3

File tree

7 files changed

+137
-21
lines changed

7 files changed

+137
-21
lines changed

.github/workflows/test-ros2.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
include:
2323
- distro: dashing
2424
gazebo: 9
25-
ubuntu_distro: bionic
25+
ubuntu_distro: bionic
26+
2627
container:
2728
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu_distro }}-ros-${{ matrix.distro }}-ros-base-latest
2829

@@ -37,7 +38,7 @@ jobs:
3738
# Note: rosbuild is the user of the docker image
3839
# TODO(ros-tooling/setup-ros-docker#7):
3940
sudo chown -R rosbuild:rosbuild "$HOME" .
40-
# Checkout SA ros1 branch into default root folder
41+
# Checkout SA ros2 branch into default root folder
4142
- name: Checkout hello world sample app
4243
uses: actions/checkout@v2
4344
with:
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "Test aws-robomaker-github-actions-ros-2"
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- master
8+
- 'releases/*'
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
test_robomaker-sample-app-ci-ros2:
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
distro: ['foxy']
21+
gazebo: [11]
22+
include:
23+
- distro: foxy
24+
gazebo: 11
25+
ubuntu_distro: focal
26+
27+
container:
28+
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu_distro }}-ros-${{ matrix.distro }}-ros-base-latest
29+
30+
# NOTES: We run 2 tests for robot_ws and simulation_ws
31+
# The test steps are duplicated because github workflow does not support reusable step (with parameter yet)
32+
# We also can use matrix to run tests with different parameters but it is overkill for this
33+
steps:
34+
- name: Setup permissions
35+
run: |
36+
# Due to user permisson issue, calling chown is necessary for now
37+
# Related issue: https://github.com/actions/checkout/issues/47
38+
# Note: rosbuild is the user of the docker image
39+
# TODO(ros-tooling/setup-ros-docker#7):
40+
sudo chown -R rosbuild:rosbuild "$HOME" .
41+
# Checkout SA ros2 branch into default root folder
42+
- name: Checkout hello world sample app
43+
uses: actions/checkout@v2
44+
with:
45+
repository: aws-robotics/aws-robomaker-sample-application-helloworld
46+
ref: ros2_foxy
47+
# Checkout action code into action folder
48+
- name: Checkout action code
49+
uses: actions/checkout@v2
50+
with:
51+
path: action
52+
- name: Setup nodeJS
53+
uses: actions/[email protected]
54+
with:
55+
node-version: '12.x'
56+
- name: Install nodeJS packages
57+
run: npm install
58+
working-directory: ./action/robomaker-sample-app-ci
59+
- name: Build test script
60+
run: npm run build
61+
working-directory: ./action/robomaker-sample-app-ci
62+
63+
# Trigger to run robomaker-sample-app-ci action script
64+
- name: Build and bundle robot_ws
65+
uses: ./action/robomaker-sample-app-ci
66+
with:
67+
ros-distro: ${{ matrix.distro }}
68+
gazebo-version: ${{ matrix.gazebo }}
69+
workspace-dir: ./robot_ws
70+
generate-sources: true
71+
# Expectation: bundle file, build files, and dependencies all exist
72+
- name: Check robot_ws file existence
73+
id: check_robot_ws_files
74+
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
75+
with:
76+
files: "./robot_ws.tar, ./robot_ws/build, ./robot_ws/install, ./robot_ws/src/deps"
77+
allow_failure: true
78+
79+
# Trigger to run robomaker-sample-app-ci action script
80+
- name: Build and bundle simulation_ws
81+
uses: ./action/robomaker-sample-app-ci
82+
with:
83+
ros-distro: ${{ matrix.distro }}
84+
gazebo-version: ${{ matrix.gazebo }}
85+
workspace-dir: ./simulation_ws
86+
generate-sources: false
87+
# Expectation: bundle file, build files, and dependencies all exist
88+
- name: Check simulation_ws file existence
89+
id: check_simulation_ws_files
90+
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
91+
with:
92+
files: "./simulation_ws.tar, ./simulation_ws/build, ./simulation_ws/install, ./simulation_ws/src/deps"
93+
allow_failure: true
94+
95+
# Expectation: source files exist
96+
- name: Check source file existence
97+
id: check_source_files
98+
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
99+
with:
100+
files: "./sources.zip, ./sources.tar.gz"
101+
102+
- name: Check all files exists
103+
if: steps.check_robot_ws_files.outputs.files_exists == 'true' && steps.check_simulation_ws_files.outputs.files_exists == 'true' && steps.check_source_files.outputs.files_exists == 'true'
104+
# Only runs if all of the files exists
105+
run: echo All files exists!

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
ros-distro: ${{ matrix.distro }}
7777
gazebo-version: ${{ matrix.gazebo }}
7878
workspace-dir: ./robot_ws
79-
generate-sources: true
79+
generate-sources: true
8080
# Expectation: bundle file, build files, and dependencies all exist
8181
- name: Check robot_ws file existence
8282
id: check_robot_ws_files
@@ -92,7 +92,7 @@ jobs:
9292
ros-distro: ${{ matrix.distro }}
9393
gazebo-version: ${{ matrix.gazebo }}
9494
workspace-dir: ./simulation_ws
95-
generate-sources: false
95+
generate-sources: false
9696
# Expectation: bundle file, build files, and dependencies all exist
9797
- name: Check simulation_ws file existence
9898
id: check_simulation_ws_files

robomaker-sample-app-ci/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AWS RoboMaker Sample Application CI Github Action
22

33
This action will build and bundle your AWS RoboMaker Sample Application package.
4-
It must run in an environment that has all core ROS dependencies already installed for the ROS distro you are using (Kinetic, Melodic, Dashing, etc).
4+
It must run in an environment that has all core ROS dependencies already installed for the ROS distro you are using (Kinetic, Melodic, Dashing, Foxy etc).
55

66
You use a [setup-ros-docker docker container], see usage section to see how to use this container.
77

@@ -42,7 +42,7 @@ jobs:
4242

4343
### `ros-distro`
4444

45-
**Required** Distribution of ROS you are using (`[kinetic|melodic|dashing]`)
45+
**Required** Distribution of ROS you are using (`[kinetic|melodic|dashing|foxy]`)
4646

4747
### `workspace-dir`
4848

robomaker-sample-app-ci/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: 'aws-robomaker-sample-application-ci'
22
description: 'Build and Bundle an AWS RoboMaker Sample Application Package'
33
inputs:
44
ros-distro:
5-
description: 'Distribution of ROS to use [kinetic|melodic|dashing]'
5+
description: 'Distribution of ROS to use [kinetic|melodic|dashing|foxy]'
66
required: true
77
gazebo-version:
8-
description: 'Version of Gazebo to use [unspecified|7|9]'
8+
description: 'Version of Gazebo to use [unspecified|7|9|11]'
99
default: ''
1010
workspace-dir:
1111
description: 'Path to the workspace folder that contains your packages [robot_ws|simulation_ws]'
@@ -19,9 +19,9 @@ inputs:
1919

2020
outputs:
2121
ros-distro:
22-
description: 'Distribution of ROS to use [kinetic|melodic|dashing]'
22+
description: 'Distribution of ROS to use [kinetic|melodic|dashing|foxy]'
2323
gazebo-version:
24-
description: 'Version of Gazebo to use [gazebo7|gazebo9]'
24+
description: 'Version of Gazebo to use [gazebo7|gazebo9|gazebo11]'
2525
sample-app-version:
2626
description: 'Version of the sample application that was built (from the package.xml)'
2727
runs:

robomaker-sample-app-ci/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"kinetic",
1919
"melodic",
2020
"dashing",
21+
"foxy",
2122
"setup"
2223
],
2324
"author": "AWS RoboMaker",

robomaker-sample-app-ci/src/aws-robomaker-sample-application-ci.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,24 @@ async function setup() {
110110
try {
111111
await exec.exec("sudo", ["apt-key", "adv", "--fetch-keys", "http://packages.osrfoundation.org/gazebo.key"]);
112112

113-
const aptPackages = [
113+
let aptPackages = [
114114
"zip",
115115
"cmake",
116116
"lcov",
117117
"libgtest-dev",
118-
"python-pip",
119-
"python-rosinstall",
120118
"python3-colcon-common-extensions",
119+
"python3-apt",
121120
"python3-pip",
122-
"python3-apt"
121+
(ROS_DISTRO == "foxy") ? "python3-rosinstall" : "python-rosinstall",
123122
];
124123

124+
if(ROS_DISTRO!="foxy"){
125+
//focal (foxy) does not ship with python2 and does not require python-pip
126+
//using the ros_distro instead of ubuntu_distro saves users from specifying another
127+
//essentially redundant parameter.
128+
aptPackages = aptPackages.concat(["python-pip"])
129+
}
130+
125131
const python3Packages = [
126132
"setuptools",
127133
"colcon-bundle",
@@ -147,11 +153,11 @@ async function setup() {
147153
}
148154
}
149155

150-
async function setup_gazebo9() {
156+
async function setup_gazebo_source() {
151157
try {
152-
const gazebo9_apt_file = "/etc/apt/sources.list.d/gazebo-stable.list";
153-
await exec.exec("sudo", ["rm", "-f", gazebo9_apt_file]);
154-
await exec.exec("bash", ["-c", `echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable \`lsb_release -cs\` main" | sudo tee ${gazebo9_apt_file}`]);
158+
const gazebo_apt_file = "/etc/apt/sources.list.d/gazebo-stable.list";
159+
await exec.exec("sudo", ["rm", "-f", gazebo_apt_file]);
160+
await exec.exec("bash", ["-c", `echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable \`lsb_release -cs\` main" | sudo tee ${gazebo_apt_file}`]);
155161
await exec.exec("sudo", ["apt-get", "update"]);
156162

157163
if (ROS_DISTRO == "kinetic") {
@@ -237,13 +243,16 @@ async function run() {
237243
if (ROS_DISTRO == "kinetic" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "7")) {
238244
GAZEBO_VERSION = "7";
239245
} else if (ROS_DISTRO == "kinetic" && GAZEBO_VERSION == "9") {
240-
await setup_gazebo9();
246+
await setup_gazebo_source();
241247
} else if (ROS_DISTRO == "melodic" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "9")) {
242248
GAZEBO_VERSION = "9";
243-
await setup_gazebo9();
249+
await setup_gazebo_source();
244250
} else if (ROS_DISTRO == "dashing" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "9")) {
245251
GAZEBO_VERSION = "9";
246-
await setup_gazebo9();
252+
await setup_gazebo_source();
253+
} else if (ROS_DISTRO == "foxy" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "11")) {
254+
GAZEBO_VERSION = "11";
255+
await setup_gazebo_source();
247256
} else {
248257
core.setFailed(`Invalid ROS and Gazebo combination`);
249258
}

0 commit comments

Comments
 (0)