Skip to content

Commit 0b7949b

Browse files
cheng-kevinchengke
andauthored
fix sample app version fetch (#31)
* fix sample app version fetch * exclude src/deps from package.xml search * remove setup permissions step Co-authored-by: chengke <[email protected]>
1 parent bab67e5 commit 0b7949b

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

.github/workflows/test-ros2.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ jobs:
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)
3232
# 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" .
33+
steps:
4134
# Checkout SA ros2 branch into default root folder
4235
- name: Checkout hello world sample app
4336
uses: actions/checkout@v2

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function getSampleAppVersion() : Promise<string> {
6969
try {
7070
await exec.exec("bash", [
7171
"-c",
72-
"find ../robot_ws -name package.xml -exec grep -Po '(?<=<version>)[^\\s<>]*(?=</version>)' {} +"],
72+
"find ../robot_ws -name package.xml -not -path ../robot_ws/src/deps/* -exec grep -Po '(?<=<version>)[^\\s<>]*(?=</version>)' {} +"],
7373
getWorkingDirExecOptions(grepAfter));
7474
version = grepAfter.stdout.trim();
7575
} catch(error) {
@@ -107,6 +107,10 @@ async function fetchRosinstallDependencies(): Promise<string[]> {
107107
async function setup() {
108108
try{
109109

110+
//this function relies on the fact that there is only 1 package.xml in ./robot_ws
111+
SAMPLE_APP_VERSION = await getSampleAppVersion();
112+
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
113+
110114
if (!fs.existsSync("/etc/timezone")) {
111115
//default to US Pacific if timezone is not set.
112116
const timezone = "US/Pacific";
@@ -118,9 +122,7 @@ async function fetchRosinstallDependencies(): Promise<string[]> {
118122
await exec.exec("apt-get", ["update"]);
119123
//zip required for prepare_sources step.
120124
await exec.exec("apt-get", ["install", "-y", "zip"]);
121-
SAMPLE_APP_VERSION = await getSampleAppVersion();
122-
console.log(`Sample App version found to be: ${SAMPLE_APP_VERSION}`);
123-
125+
124126
let packages = await fetchRosinstallDependencies();
125127
PACKAGES = packages.join(" ");
126128
} catch (error) {

0 commit comments

Comments
 (0)