Skip to content

Commit bab67e5

Browse files
cheng-kevinchengke
andauthored
Use sample application setup script for build and bundle (#29)
* use vanilla ubuntu image * remove comment * pass in --install-ros * remove gazebo input/output * commit index.js * update readme * use ros2 branch * remove gazebo-version from test action input Co-authored-by: chengke <[email protected]>
1 parent 865c557 commit bab67e5

File tree

6 files changed

+41
-303
lines changed

6 files changed

+41
-303
lines changed

.github/workflows/test-ros2.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
distro: ['dashing']
21-
gazebo: [9]
20+
distro: ['foxy']
21+
gazebo: [11]
2222
include:
23-
- distro: dashing
24-
gazebo: 9
25-
ubuntu_distro: bionic
23+
- distro: foxy
24+
gazebo: 11
25+
ubuntu_distro: focal
2626

2727
container:
28-
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu_distro }}-ros-${{ matrix.distro }}-ros-base-latest
28+
image: ubuntu:${{ matrix.ubuntu_distro }}
2929

3030
# NOTES: We run 2 tests for robot_ws and simulation_ws
3131
# The test steps are duplicated because github workflow does not support reusable step (with parameter yet)
@@ -65,7 +65,6 @@ jobs:
6565
uses: ./action/robomaker-sample-app-ci
6666
with:
6767
ros-distro: ${{ matrix.distro }}
68-
gazebo-version: ${{ matrix.gazebo }}
6968
workspace-dir: ./robot_ws
7069
generate-sources: true
7170
# Expectation: bundle file, build files, and dependencies all exist
@@ -81,9 +80,8 @@ jobs:
8180
uses: ./action/robomaker-sample-app-ci
8281
with:
8382
ros-distro: ${{ matrix.distro }}
84-
gazebo-version: ${{ matrix.gazebo }}
8583
workspace-dir: ./simulation_ws
86-
generate-sources: false
84+
generate-sources: false
8785
# Expectation: bundle file, build files, and dependencies all exist
8886
- name: Check simulation_ws file existence
8987
id: check_simulation_ws_files

.github/workflows/test-ros2foxy.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,20 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
distro: ['kinetic', 'melodic']
21-
gazebo: [7, 9]
20+
distro: ['melodic']
21+
gazebo: [9]
2222
include:
23-
- distro: kinetic
24-
gazebo: 7
25-
ubuntu_distro: xenial
26-
- distro: kinetic
27-
gazebo: 9
28-
ubuntu_distro: xenial
2923
- distro: melodic
3024
gazebo: 9
31-
ubuntu_distro: bionic
32-
exclude:
33-
- distro: 'melodic'
34-
gazebo: 7
25+
ubuntu_distro: bionic
3526

3627
container:
37-
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu_distro }}-ros-${{ matrix.distro }}-ros-base-latest
28+
image: ubuntu:${{ matrix.ubuntu_distro }}
3829

3930
# NOTES: We run 2 tests for robot_ws and simulation_ws
4031
# The test steps are duplicated because github workflow does not support reusable step (with parameter yet)
4132
# We also can use matrix to run tests with different parameters but it is overkill for this
4233
steps:
43-
- name: Setup permissions
44-
run: |
45-
# Due to user permisson issue, calling chown is necessary for now
46-
# Related issue: https://github.com/actions/checkout/issues/47
47-
# Note: rosbuild is the user of the docker image
48-
# TODO(ros-tooling/setup-ros-docker#7):
49-
sudo chown -R rosbuild:rosbuild "$HOME" .
5034
# Checkout SA ros1 branch into default root folder
5135
- name: Checkout hello world sample app
5236
uses: actions/checkout@v2
@@ -68,13 +52,11 @@ jobs:
6852
- name: Build test script
6953
run: npm run build
7054
working-directory: ./action/robomaker-sample-app-ci
71-
7255
# Trigger to run robomaker-sample-app-ci action script
7356
- name: Build and bundle robot_ws
7457
uses: ./action/robomaker-sample-app-ci
7558
with:
7659
ros-distro: ${{ matrix.distro }}
77-
gazebo-version: ${{ matrix.gazebo }}
7860
workspace-dir: ./robot_ws
7961
generate-sources: true
8062
# Expectation: bundle file, build files, and dependencies all exist
@@ -90,7 +72,6 @@ jobs:
9072
uses: ./action/robomaker-sample-app-ci
9173
with:
9274
ros-distro: ${{ matrix.distro }}
93-
gazebo-version: ${{ matrix.gazebo }}
9475
workspace-dir: ./simulation_ws
9576
generate-sources: false
9677
# Expectation: bundle file, build files, and dependencies all exist

robomaker-sample-app-ci/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
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, Foxy etc).
54

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

87
## Usage
98

10-
Using a [setup-ros-docker docker container] docker container:
9+
Using a Ubuntu docker container:
1110

1211
```
1312
jobs:
1413
build-and-bundle-robot_ws-kinetic:
1514
runs-on: ubuntu-latest
1615
name: Build Kinetic
1716
container:
18-
image: rostooling/setup-ros-docker:ubuntu-xenial-ros-kinetic-ros-base-latest
17+
image: ubuntu:bionic
1918
steps:
2019
- name: Build
2120
uses: aws-robotics/aws-robomaker-github-actions/[email protected]
2221
with:
2322
ros-distro: kinetic
24-
gazebo-version: 7
2523
workspace-dir: robot_ws
2624
generate-sources: true
2725
build-and-bundle-simulation_ws-kinetic:
@@ -34,18 +32,17 @@ jobs:
3432
uses: aws-robotics/aws-robomaker-github-actions/[email protected]
3533
with:
3634
ros-distro: kinetic
37-
gazebo-version: 7
3835
workspace-dir: simulation_ws
3936
```
4037

4138
## Inputs
4239

4340
### `ros-distro`
4441

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

4744
### `workspace-dir`
4845

4946
Path to the workspace folder of your package (*eg.*: `[robot_ws|simulation_ws]`, *default:* `./`).
5047

51-
[setup-ros-docker container]: https://hub.docker.com/r/rostooling/setup-ros-docker
48+
[ubuntu container]: https://hub.docker.com/_/ubuntu

robomaker-sample-app-ci/dist/index.js

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ const core = __importStar(__webpack_require__(470));
727727
const exec = __importStar(__webpack_require__(986));
728728
const fs = __webpack_require__(747);
729729
const ROS_DISTRO = core.getInput('ros-distro', { required: true });
730-
let GAZEBO_VERSION = core.getInput('gazebo-version');
731730
let SAMPLE_APP_VERSION = '';
732731
const WORKSPACE_DIRECTORY = core.getInput('workspace-dir');
733732
const GENERATE_SOURCES = core.getInput('generate-sources');
@@ -830,36 +829,19 @@ function fetchRosinstallDependencies() {
830829
function setup() {
831830
return __awaiter(this, void 0, void 0, function* () {
832831
try {
833-
yield exec.exec("sudo", ["apt-key", "adv", "--fetch-keys", "http://packages.osrfoundation.org/gazebo.key"]);
834-
let aptPackages = [
835-
"zip",
836-
"cmake",
837-
"lcov",
838-
"libgtest-dev",
839-
"python3-colcon-common-extensions",
840-
"python3-apt",
841-
"python3-pip",
842-
(ROS_DISTRO == "foxy") ? "python3-rosinstall" : "python-rosinstall",
843-
];
844-
if (ROS_DISTRO != "foxy") {
845-
//focal (foxy) does not ship with python2 and does not require python-pip
846-
//using the ros_distro instead of ubuntu_distro saves users from specifying another
847-
//essentially redundant parameter.
848-
aptPackages = aptPackages.concat(["python-pip"]);
832+
if (!fs.existsSync("/etc/timezone")) {
833+
//default to US Pacific if timezone is not set.
834+
const timezone = "US/Pacific";
835+
yield exec.exec("bash", ["-c", `ln -snf /usr/share/zoneinfo/${timezone} /etc/localtime`]);
836+
yield exec.exec("bash", ["-c", `echo ${timezone} > /etc/timezone`]);
849837
}
850-
const python3Packages = [
851-
"setuptools",
852-
"colcon-bundle",
853-
"colcon-ros-bundle"
854-
];
855-
yield exec.exec("sudo", ["apt-get", "update"]);
856-
yield exec.exec("sudo", ["apt-get", "install", "-y"].concat(aptPackages));
857-
yield exec.exec("sudo", ["pip3", "install", "-U"].concat(python3Packages));
858-
yield exec.exec("rosdep", ["update"]);
859-
yield loadROSEnvVariables();
838+
yield exec.exec("bash", ["-c", `scripts/setup.sh --install-ros ${ROS_DISTRO}`]);
839+
loadROSEnvVariables();
840+
yield exec.exec("apt-get", ["update"]);
841+
//zip required for prepare_sources step.
842+
yield exec.exec("apt-get", ["install", "-y", "zip"]);
860843
SAMPLE_APP_VERSION = yield getSampleAppVersion();
861844
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
862-
// Update PACKAGES_TO_SKIP_TESTS with the new packages added by 'rosws update'.
863845
let packages = yield fetchRosinstallDependencies();
864846
PACKAGES = packages.join(" ");
865847
}
@@ -868,29 +850,6 @@ function setup() {
868850
}
869851
});
870852
}
871-
function setup_gazebo_source() {
872-
return __awaiter(this, void 0, void 0, function* () {
873-
try {
874-
const gazebo_apt_file = "/etc/apt/sources.list.d/gazebo-stable.list";
875-
yield exec.exec("sudo", ["rm", "-f", gazebo_apt_file]);
876-
yield exec.exec("bash", ["-c", `echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable \`lsb_release -cs\` main" | sudo tee ${gazebo_apt_file}`]);
877-
yield exec.exec("sudo", ["apt-get", "update"]);
878-
if (ROS_DISTRO == "kinetic") {
879-
const gazebo9_rosdep_file = "/etc/ros/rosdep/sources.list.d/00-gazebo9.list";
880-
yield exec.exec("sudo", ["rm", "-f", gazebo9_rosdep_file]);
881-
yield exec.exec("bash", ["-c", `echo "yaml https://github.com/osrf/osrf-rosdep/raw/master/gazebo9/gazebo.yaml" | sudo tee -a ${gazebo9_rosdep_file}`]);
882-
yield exec.exec("bash", ["-c", `echo "yaml https://github.com/osrf/osrf-rosdep/raw/master/gazebo9/releases/indigo.yaml indigo" | sudo tee -a ${gazebo9_rosdep_file}`]);
883-
yield exec.exec("bash", ["-c", `echo "yaml https://github.com/osrf/osrf-rosdep/raw/master/gazebo9/releases/jade.yaml jade" | sudo tee -a ${gazebo9_rosdep_file}`]);
884-
yield exec.exec("bash", ["-c", `echo "yaml https://github.com/osrf/osrf-rosdep/raw/master/gazebo9/releases/kinetic.yaml kinetic" | sudo tee -a ${gazebo9_rosdep_file}`]);
885-
yield exec.exec("bash", ["-c", `echo "yaml https://github.com/osrf/osrf-rosdep/raw/master/gazebo9/releases/lunar.yaml lunar" | sudo tee -a ${gazebo9_rosdep_file}`]);
886-
yield exec.exec("rosdep", ["update"]);
887-
}
888-
}
889-
catch (error) {
890-
core.setFailed(error.message);
891-
}
892-
});
893-
}
894853
function prepare_sources() {
895854
return __awaiter(this, void 0, void 0, function* () {
896855
try {
@@ -914,8 +873,6 @@ function prepare_sources() {
914873
function build() {
915874
return __awaiter(this, void 0, void 0, function* () {
916875
try {
917-
yield exec.exec("rosdep", ["install", "--from-paths", ".", "--ignore-src", "-r", "-y", "--rosdistro", ROS_DISTRO], getWorkingDirExecOptions());
918-
console.log(`Building the following packages: ${PACKAGES}`);
919876
yield exec.exec("colcon", ["build", "--build-base", "build", "--install-base", "install"], getWorkingDirExecOptions());
920877
}
921878
catch (error) {
@@ -951,7 +908,6 @@ function bundle() {
951908
function run() {
952909
return __awaiter(this, void 0, void 0, function* () {
953910
console.log(`ROS_DISTRO: ${ROS_DISTRO}`);
954-
console.log(`GAZEBO_VERSION: ${GAZEBO_VERSION}`);
955911
console.log(`WORKSPACE_DIRECTORY: ${WORKSPACE_DIRECTORY}`);
956912
console.log(`GENERATE_SOURCES: ${GENERATE_SOURCES}`);
957913
console.log(`COLCON_BUNDLE_RETRIES: ${COLCON_BUNDLE_RETRIES}`);
@@ -960,34 +916,12 @@ function run() {
960916
core.setFailed(`Invalid number of colcon bundle retries. Must be between 0-9 inclusive`);
961917
}
962918
yield setup();
963-
if (ROS_DISTRO == "kinetic" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "7")) {
964-
GAZEBO_VERSION = "7";
965-
}
966-
else if (ROS_DISTRO == "kinetic" && GAZEBO_VERSION == "9") {
967-
yield setup_gazebo_source();
968-
}
969-
else if (ROS_DISTRO == "melodic" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "9")) {
970-
GAZEBO_VERSION = "9";
971-
yield setup_gazebo_source();
972-
}
973-
else if (ROS_DISTRO == "dashing" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "9")) {
974-
GAZEBO_VERSION = "9";
975-
yield setup_gazebo_source();
976-
}
977-
else if (ROS_DISTRO == "foxy" && (GAZEBO_VERSION == "" || GAZEBO_VERSION == "11")) {
978-
GAZEBO_VERSION = "11";
979-
yield setup_gazebo_source();
980-
}
981-
else {
982-
core.setFailed(`Invalid ROS and Gazebo combination`);
983-
}
984919
if (GENERATE_SOURCES == 'true') {
985920
yield prepare_sources();
986921
}
987922
yield build();
988923
yield bundle();
989924
core.setOutput('ros-distro', ROS_DISTRO);
990-
core.setOutput('gazebo-version', "gazebo" + GAZEBO_VERSION);
991925
core.setOutput('sample-app-version', SAMPLE_APP_VERSION);
992926
});
993927
}

0 commit comments

Comments
 (0)