Skip to content

Commit

Permalink
Addded check for ros_gz
Browse files Browse the repository at this point in the history
Signed-off-by: Saurabh Kamat <[email protected]>
  • Loading branch information
sauk2 committed Aug 15, 2024
1 parent 7ea8a20 commit ca669a9
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,21 @@ jobs:
run: |
conda activate
gz sim --versions
test_install_ros_gz:
name: 'Install ros_gz side-by-side Gazebo'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: '20.x'
- name: 'Install ROS 2 Jazzy'
uses: ros-tooling/[email protected]
with:
required-ros-distributions: jazzy
- name: 'Install Gazebo with ros_gz'
uses: ./
with:
required-gazebo-distributions: 'harmonic'
install-ros-gz: 'true'
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ inputs:
Use nightly binaries from OSRF repository
required: false
default: 'false'
install-ros-gz:
description: |
Install ros_gz side-by-side with ROS 2 and Gazebo
required: false
default: 'false'
runs:
using: node20
main: dist/index.js
22 changes: 22 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26387,6 +26387,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.runLinux = runLinux;
const core = __importStar(__nccwpck_require__(2186));
const io = __importStar(__nccwpck_require__(7436));
const actions_exec = __importStar(__nccwpck_require__(1514));
const apt = __importStar(__nccwpck_require__(4671));
const utils = __importStar(__nccwpck_require__(1314));
/**
Expand Down Expand Up @@ -26477,6 +26478,16 @@ function addAptRepo(ubuntuCodename) {
yield utils.exec("sudo", ["apt-get", "update"]);
});
}
function installRosGz() {
return __awaiter(this, void 0, void 0, function* () {
yield utils.exec("bash", ["-c", `distros=($(ls /opt/ros -1))`]);
const output = yield actions_exec.getExecOutput("bash", [
"-c",
`echo $distros`,
]);
console.log(output.stdout);
});
}
/**
* Install Gazebo on a Linux worker.
*/
Expand All @@ -26492,6 +26503,7 @@ function runLinux() {
for (const gazeboDistro of utils.getRequiredGazeboDistributions()) {
yield apt.runAptGetInstall([`gz-${gazeboDistro}`]);
}
yield installRosGz();
});
}

Expand Down Expand Up @@ -26790,6 +26802,7 @@ exports.validateDistro = validateDistro;
exports.getRequiredGazeboDistributions = getRequiredGazeboDistributions;
exports.checkUbuntuCompatibility = checkUbuntuCompatibility;
exports.checkForUnstableAptRepos = checkForUnstableAptRepos;
exports.checkForRosGz = checkForRosGz;
const actions_exec = __importStar(__nccwpck_require__(1514));
const core = __importStar(__nccwpck_require__(2186));
// List of Valid Gazebo distributions with compatible
Expand All @@ -26798,22 +26811,27 @@ const validGazeboDistroList = [
{
name: "citadel",
compatibleUbuntuDistros: ["focal"],
compatibleRosDistros: ["foxy"],
},
{
name: "fortress",
compatibleUbuntuDistros: ["focal", "jammy"],
compatibleRosDistros: ["humble", "iron"],
},
{
name: "garden",
compatibleUbuntuDistros: ["focal", "jammy"],
compatibleRosDistros: [],
},
{
name: "harmonic",
compatibleUbuntuDistros: ["jammy", "noble"],
compatibleRosDistros: ["jazzy", "rolling"],
},
{
name: "ionic",
compatibleUbuntuDistros: ["noble"],
compatibleRosDistros: [],
},
];
/**
Expand Down Expand Up @@ -26925,6 +26943,10 @@ function checkForUnstableAptRepos() {
}
return unstableRepos;
}
function checkForRosGz() {
const installRosGz = core.getInput("install-ros-gz") === "true";
return installRosGz;
}


/***/ }),
Expand Down
11 changes: 11 additions & 0 deletions src/setup-gazebo-linux.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as core from "@actions/core";
import * as io from "@actions/io";
import * as actions_exec from "@actions/exec";

import * as apt from "./package_manager/apt";
import * as utils from "./utils";
Expand Down Expand Up @@ -92,6 +93,15 @@ async function addAptRepo(ubuntuCodename: string): Promise<void> {
await utils.exec("sudo", ["apt-get", "update"]);
}

async function installRosGz(): Promise<void> {
await utils.exec("bash", ["-c", `distros=($(ls /opt/ros -1))`]);
const output = await actions_exec.getExecOutput("bash", [
"-c",
`echo $distros`,
]);
console.log(output.stdout);
}

/**
* Install Gazebo on a Linux worker.
*/
Expand All @@ -110,4 +120,5 @@ export async function runLinux(): Promise<void> {
for (const gazeboDistro of utils.getRequiredGazeboDistributions()) {
await apt.runAptGetInstall([`gz-${gazeboDistro}`]);
}
await installRosGz();
}
11 changes: 11 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,32 @@ import * as im from "@actions/exec/lib/interfaces";
const validGazeboDistroList: {
name: string;
compatibleUbuntuDistros: string[];
compatibleRosDistros: string[];
}[] = [
{
name: "citadel",
compatibleUbuntuDistros: ["focal"],
compatibleRosDistros: ["foxy"],
},
{
name: "fortress",
compatibleUbuntuDistros: ["focal", "jammy"],
compatibleRosDistros: ["humble", "iron"],
},
{
name: "garden",
compatibleUbuntuDistros: ["focal", "jammy"],
compatibleRosDistros: [],
},
{
name: "harmonic",
compatibleUbuntuDistros: ["jammy", "noble"],
compatibleRosDistros: ["jazzy", "rolling"],
},
{
name: "ionic",
compatibleUbuntuDistros: ["noble"],
compatibleRosDistros: [],
},
];

Expand Down Expand Up @@ -161,3 +167,8 @@ export function checkForUnstableAptRepos(): string[] {
}
return unstableRepos;
}

export function checkForRosGz(): boolean {
const installRosGz = core.getInput("install-ros-gz") === "true";
return installRosGz;
}

0 comments on commit ca669a9

Please sign in to comment.