forked from mdavidsaver/ci-core-dumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.js
63 lines (53 loc) · 1.83 KB
/
prepare.js
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
// SPDX-License-Identifier: GPL-3.0-or-later
const { spawnSync } = require('child_process');
const { argv, stdout, stderr, env } = require('process');
const os = require('os');
const cdb_args = env['INPUT_EXTRA_CDB']||'';
const gdb_args = env['INPUT_EXTRA_GDB']||'';
if(os.type()=='Linux') {
console.log('::group::Install GDB')
spawnSync(
'sudo',
['apt-get', 'update'],
{stdio: ['ignore', 'inherit', 'inherit']},
)
spawnSync(
'sudo',
['apt-get', '--yes', '--no-install-recommends', 'install', 'gdb'],
{stdio: ['ignore', 'inherit', 'inherit']},
)
console.log("::endgroup::")
}
const fs = require('fs');
const path = require('path');
const process = require('process');
// we are called like:
// nodejs /path/to/analyze.js
const actiondir = path.dirname(argv[1]);
// modify PYTHONPATH for our child process
process.env.PYTHONPATH = actiondir+path.delimiter+(process.env.PYTHONPATH||'')
// modify PYTHONPATH for post and intermediate
// cf. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
fs.appendFileSync(
process.env.GITHUB_ENV,
'PYTHONPATH='+process.env.PYTHONPATH,
);
if(os.type()=='Windows_NT') {
console.log('Adjust PATH')
// add our dummy 'ulimit' command to %PATH%
// cf. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
fs.appendFileSync(
process.env.GITHUB_PATH,
actiondir,
);
}
console.log('::group::ci-core-dumper install')
spawnSync(
'python',
['-m', 'ci_core_dumper', '-v', 'install',
'--cdb-commands', cdb_args,
'--gdb-commands', gdb_args,
].concat(argv.slice(2)),
{stdio: ['ignore', 'inherit', 'inherit']},
)
console.log("::endgroup::")