Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sample app version fetch #31

Merged
merged 3 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .github/workflows/test-ros2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ jobs:
# NOTES: We run 2 tests for robot_ws and simulation_ws
# The test steps are duplicated because github workflow does not support reusable step (with parameter yet)
# We also can use matrix to run tests with different parameters but it is overkill for this
steps:
- name: Setup permissions
run: |
# Due to user permisson issue, calling chown is necessary for now
# Related issue: https://github.com/actions/checkout/issues/47
# Note: rosbuild is the user of the docker image
# TODO(ros-tooling/setup-ros-docker#7):
sudo chown -R rosbuild:rosbuild "$HOME" .
steps:
# Checkout SA ros2 branch into default root folder
- name: Checkout hello world sample app
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function getSampleAppVersion() : Promise<string> {
try {
await exec.exec("bash", [
"-c",
"find ../robot_ws -name package.xml -exec grep -Po '(?<=<version>)[^\\s<>]*(?=</version>)' {} +"],
"find ../robot_ws -name package.xml -not -path ../robot_ws/src/deps/* -exec grep -Po '(?<=<version>)[^\\s<>]*(?=</version>)' {} +"],
getWorkingDirExecOptions(grepAfter));
version = grepAfter.stdout.trim();
} catch(error) {
Expand Down Expand Up @@ -107,6 +107,10 @@ async function fetchRosinstallDependencies(): Promise<string[]> {
async function setup() {
try{

//this function relies on the fact that there is only 1 package.xml in ./robot_ws
SAMPLE_APP_VERSION = await getSampleAppVersion();
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);

if (!fs.existsSync("/etc/timezone")) {
//default to US Pacific if timezone is not set.
const timezone = "US/Pacific";
Expand All @@ -118,9 +122,7 @@ async function fetchRosinstallDependencies(): Promise<string[]> {
await exec.exec("apt-get", ["update"]);
//zip required for prepare_sources step.
await exec.exec("apt-get", ["install", "-y", "zip"]);
SAMPLE_APP_VERSION = await getSampleAppVersion();
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);


let packages = await fetchRosinstallDependencies();
PACKAGES = packages.join(" ");
} catch (error) {
Expand Down