generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 43
/
setup-ros-windows.ts
83 lines (75 loc) · 2.31 KB
/
setup-ros-windows.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as path from "path";
import * as chocolatey from "./package_manager/chocolatey";
import * as pip from "./package_manager/pip";
import * as utils from "./utils";
const binaryReleases: { [index: string]: string } = {
dashing:
"https://github.com/ros2/ros2/releases/download/release-dashing-20210610/ros2-dashing-20210610-windows-amd64.zip",
eloquent:
"https://github.com/ros2/ros2/releases/download/release-eloquent-20200124/ros2-eloquent-20200124-windows-release-amd64.zip",
foxy: "https://github.com/ros2/ros2/releases/download/release-foxy-20210902/ros2-foxy-20210902-windows-release-amd64.zip",
galactic:
"https://github.com/ros2/ros2/releases/download/release-galactic-20210716/ros2-galactic-20210616-windows-release-amd64.zip",
};
const pip3Packages: string[] = ["lxml", "netifaces"];
/**
* Install ROS 2 build tools.
*/
async function prepareRos2BuildEnvironment() {
const python_dir = tc.find("Python", "3.7");
await utils.exec(
path.join(python_dir, "python"),
[
"-c",
"import sysconfig; print(sysconfig.get_config_var('BINDIR')); print(sysconfig.get_path('scripts'))",
],
{
listeners: {
stdline: (data: string) => {
const p = data.trim();
if (p) {
core.info("Prepending to path: " + JSON.stringify(p));
core.addPath(p);
}
},
},
}
);
core.addPath("c:\\program files\\cppcheck");
await chocolatey.installChocoDependencies();
await chocolatey.downloadAndInstallRos2NugetPackages();
await pip.installPython3Dependencies(false);
await pip.runPython3PipInstall(pip3Packages, false);
await pip.runPython3PipInstall(["rosdep", "vcstool"], false);
return utils.exec(`rosdep`, ["init"]);
}
/**
* Install ROS 2 binary releases.
*/
async function prepareRos2BinaryReleases() {
for (const rosDistro of utils.getRequiredRosDistributions()) {
if (rosDistro in binaryReleases) {
await utils.exec("wget", [
"--quiet",
binaryReleases[rosDistro],
"-O",
`${rosDistro}.zip`,
]);
await utils.exec("7z", [
"x",
`${rosDistro}.zip`,
"-y",
`-oC:\\dev\\${rosDistro}`,
]);
}
}
}
/**
* Install build environment on a Windows worker.
*/
export async function runWindows() {
await prepareRos2BuildEnvironment();
return await prepareRos2BinaryReleases();
}