Add powershell to call

This commit is contained in:
David Verdeguer 2020-10-08 12:06:29 +02:00
parent 424a9cfa1c
commit 735ec7d414
3 changed files with 25 additions and 20 deletions

20
lib/init.js generated
View file

@ -124,35 +124,39 @@ exports.injectWindowsTracer = injectWindowsTracer;
async function installPythonDeps(codeql, logger) {
logger.startGroup("Setup Python dependencies");
if (process.platform === "darwin") {
logger.info("Currently, auto-installing python dependancies is not supported on MacOS");
logger.info("Currently, auto-installing python dependencies is not supported on MacOS");
logger.endGroup();
return;
}
let install_tools_script = "install_tools.sh";
const auto_install_packages_script = "auto_install_packages.py";
if (process.platform === "win32") {
install_tools_script = "install_tools.ps1";
}
const scriptsFolder = path.resolve(__dirname, "../python-setup");
// Setup tools on the Github hosted runners
if (process.env["ImageOS"] !== undefined) {
try {
await new toolrunnner.ToolRunner(path.join(scriptsFolder, install_tools_script)).exec();
if (process.platform === "win32") {
await new toolrunnner.ToolRunner("powershell", [
path.join(scriptsFolder, "install_tools.ps1"),
]).exec();
}
else {
await new toolrunnner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec();
}
}
catch (e) {
// This script tries to install some needed tools in the runner. It should not fail, but if it does
// we just abort the process without failing the action
logger.endGroup();
logger.warning("Unable to download and extract the tools needed for installing the python dependecies. You can call this action with 'setup-python-dependencies: false' to disable this process.");
return;
}
}
// Install dependencies
try {
await new toolrunnner.ToolRunner(path.join(scriptsFolder, auto_install_packages_script), [path.dirname(codeql.getPath())]).exec();
await new toolrunnner.ToolRunner(path.join(scriptsFolder, "auto_install_packages.py"), [path.dirname(codeql.getPath())]).exec();
}
catch (e) {
logger.endGroup();
logger.warning("We were unable to install your python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process.");
return;
}
logger.endGroup();
}