mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 15:41:38 +00:00
Way better travis.js
This commit is contained in:
parent
a25b87c2f0
commit
406782b8ba
@ -38,22 +38,30 @@ function parseLogs(log) {
|
||||
let issueFound = false;
|
||||
let last = '';
|
||||
for (let line of log.split('\n')) {
|
||||
const plain = line.replace(/\033\[..m/g, '');
|
||||
if (line.length === 0) {
|
||||
continue;
|
||||
}
|
||||
if (line.indexOf('FX]') !== -1) {
|
||||
if (plain.indexOf('FX]') !== -1) {
|
||||
obj.fx++;
|
||||
}
|
||||
if (line.indexOf('XX]') !== -1) {
|
||||
if (plain.indexOf('XX]') !== -1) {
|
||||
obj.xx++;
|
||||
console.log(' ' + line + last);
|
||||
} else if (line.indexOf('BR]') !== -1) {
|
||||
if (line.indexOf('XX]' !== -1)) {
|
||||
const w = last.split(' ').slice(5).join(' ');
|
||||
// console.log(' ' + line + colors.yellow(w));
|
||||
obj.issues.push(line + colors.yellow(w));
|
||||
} else {
|
||||
const w = line.split(' ');
|
||||
// console.log(' ' + w[0]);
|
||||
obj.issues.push(w[0]);
|
||||
}
|
||||
} else if (plain.indexOf('BR]') !== -1) {
|
||||
obj.br++;
|
||||
}
|
||||
last = line;
|
||||
}
|
||||
}
|
||||
obj.issues = obj.issues.length;
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -72,22 +80,22 @@ async function processJob(job) {
|
||||
if (!logExists) {
|
||||
fs.writeFileSync(logFile, log);
|
||||
}
|
||||
console.log(' [JOB]', job.id, 'XX:', result.xx, 'BR:', result.br, 'FX:', result.fx);
|
||||
/*
|
||||
const status = job.finished_at === null? '(running)': '(finished)';
|
||||
console.log(' [JOB]', job.id, 'XX:', result.xx, 'BR:', result.br, 'FX:', result.fx, status);
|
||||
for (let issue of result.issues) {
|
||||
// console.log(' - ', issue);
|
||||
console.log(' ', issue);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
async function main(limit) {
|
||||
try {
|
||||
const builds = await travis('builds', true);
|
||||
let lastBuild;
|
||||
for (let build of builds) {
|
||||
if (build.state === 'finished' && build.duration > 3000) {
|
||||
await processJob(build);
|
||||
await processJob(build);
|
||||
if (--limit === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@ -95,8 +103,21 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
console.log(parseLogs(fs.readFileSync(process.argv[2]).toString()));
|
||||
} else {
|
||||
main().then(process.exit).catch(console.error);
|
||||
function run(p) {
|
||||
p.then(process.exit).catch(console.error);
|
||||
}
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
const arg = process.argv[2];
|
||||
if (arg === '-h') {
|
||||
console.log('Usage: logstat [file|+limit]');
|
||||
} else {
|
||||
if (+arg) {
|
||||
run(main(+arg));
|
||||
} else {
|
||||
console.log(parseLogs(fs.readFileSync(process.argv[2]).toString()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
run(main(-1));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user