Build outputs

This commit is contained in:
Daz DeBoer 2022-06-19 10:43:31 -06:00
parent 67f42d16a1
commit ce3874fec9
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
4 changed files with 72 additions and 42 deletions

55
dist/main/index.js vendored
View file

@ -66034,28 +66034,43 @@ function loadBuildResults() {
exports.loadBuildResults = loadBuildResults; exports.loadBuildResults = loadBuildResults;
function writeSummaryTable(results) { function writeSummaryTable(results) {
core.summary.addHeading('Gradle Builds', 3); core.summary.addHeading('Gradle Builds', 3);
core.summary.addTable([ core.summary.addRaw(`
[ <table>
{ data: 'Root Project', header: true }, <tr>
{ data: 'Tasks', header: true }, <th>Root Project</th>
{ data: 'Gradle Version', header: true }, <th>Requested Tasks</th>
{ data: 'Outcome', header: true } <th>Gradle Version</th>
], <th>Build Outcome</th>
...results.map(result => [ <th>Build Scan</th>
result.rootProjectName, </tr>${results.map(result => renderBuildResultRow(result)).join('')}
result.requestedTasks, </table>
result.gradleVersion, `);
renderOutcome(result) }
]) function renderBuildResultRow(result) {
]); return `
core.summary.addRaw('\n'); <tr>
<td>${result.rootProjectName}</td>
<td>${result.requestedTasks}</td>
<td align='center'>${result.gradleVersion}</td>
<td align='center'>${renderOutcome(result)}</td>
<td>${renderBuildScan(result)}</td>
</tr>`;
} }
function renderOutcome(result) { function renderOutcome(result) {
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build'; return result.buildFailed ? ':x:' : ':white_check_mark:';
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen'; }
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`; function renderBuildScan(result) {
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`; if (result.buildScanFailed) {
const targetUrl = result.buildScanUri ? result.buildScanUri : '#'; return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`; return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
} }

File diff suppressed because one or more lines are too long

55
dist/post/index.js vendored
View file

@ -64954,28 +64954,43 @@ function loadBuildResults() {
exports.loadBuildResults = loadBuildResults; exports.loadBuildResults = loadBuildResults;
function writeSummaryTable(results) { function writeSummaryTable(results) {
core.summary.addHeading('Gradle Builds', 3); core.summary.addHeading('Gradle Builds', 3);
core.summary.addTable([ core.summary.addRaw(`
[ <table>
{ data: 'Root Project', header: true }, <tr>
{ data: 'Tasks', header: true }, <th>Root Project</th>
{ data: 'Gradle Version', header: true }, <th>Requested Tasks</th>
{ data: 'Outcome', header: true } <th>Gradle Version</th>
], <th>Build Outcome</th>
...results.map(result => [ <th>Build Scan</th>
result.rootProjectName, </tr>${results.map(result => renderBuildResultRow(result)).join('')}
result.requestedTasks, </table>
result.gradleVersion, `);
renderOutcome(result) }
]) function renderBuildResultRow(result) {
]); return `
core.summary.addRaw('\n'); <tr>
<td>${result.rootProjectName}</td>
<td>${result.requestedTasks}</td>
<td align='center'>${result.gradleVersion}</td>
<td align='center'>${renderOutcome(result)}</td>
<td>${renderBuildScan(result)}</td>
</tr>`;
} }
function renderOutcome(result) { function renderOutcome(result) {
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build'; return result.buildFailed ? ':x:' : ':white_check_mark:';
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen'; }
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`; function renderBuildScan(result) {
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`; if (result.buildScanFailed) {
const targetUrl = result.buildScanUri ? result.buildScanUri : '#'; return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`; return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
} }

File diff suppressed because one or more lines are too long