Skip to content

Commit

Permalink
Build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Dec 31, 2023
1 parent 14d6442 commit 28f293a
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 160 deletions.
136 changes: 57 additions & 79 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139284,8 +139284,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.logCachingReport = exports.writeCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
const core = __importStar(__nccwpck_require__(42186));
exports.generateCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
const cache = __importStar(__nccwpck_require__(27799));
class CacheListener {
constructor() {
Expand Down Expand Up @@ -139373,37 +139372,36 @@ class CacheEntryListener {
}
}
exports.CacheEntryListener = CacheEntryListener;
function writeCachingReport(listener) {
function generateCachingReport(listener) {
const entries = listener.cacheEntries;
core.summary.addRaw(`\n<details><summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>\n`);
core.summary.addTable([
[
{ data: '', header: true },
{ data: 'Count', header: true },
{ data: 'Total Size (Mb)', header: true }
],
['Entries Restored', `${getCount(entries, e => e.restoredSize)}`, `${getSize(entries, e => e.restoredSize)}`],
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
]);
core.summary.addHeading('Cache Entry Details', 5);
const entryDetails = renderEntryDetails(listener);
core.summary.addRaw(`<pre>
${entryDetails}
</pre>
</details>
`);
return `
<details>
<summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>
${renderEntryTable(entries)}

<h5>Cache Entry Details</h5>
<pre>
${renderEntryDetails(listener)}
</pre>
</details
`;
}
exports.generateCachingReport = generateCachingReport;
function renderEntryTable(entries) {
return `
<table>
<tr><td></td><th>Count</th><th>Total Size (Mb)</th></tr>
<tr><td>Entries Restored</td>
<td>${getCount(entries, e => e.restoredSize)}</td>
<td>${getSize(entries, e => e.restoredSize)}</td>
</tr>
<tr><td>Entries Saved</td>
<td>${getCount(entries, e => e.savedSize)}</td>
<td>${getSize(entries, e => e.savedSize)}</td>
</tr>
</table>
`;
}
exports.writeCachingReport = writeCachingReport;
function logCachingReport(listener) {
const entries = listener.cacheEntries;
core.startGroup(`Caching for gradle-build-action was ${listener.cacheStatus} - expand for details`);
core.info(`Entries Restored: ${getCount(entries, e => e.restoredSize)} (${getSize(entries, e => e.restoredSize)} Mb)`);
core.info(`Entries Saved : ${getCount(entries, e => e.savedSize)} (${getSize(entries, e => e.savedSize)} Mb)`);
core.info(`Cache Entry Details`);
core.info(renderEntryDetails(listener));
core.endGroup();
}
exports.logCachingReport = logCachingReport;
function renderEntryDetails(listener) {
return listener.cacheEntries
.map(entry => {
Expand Down Expand Up @@ -140515,38 +140513,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.logJobSummary = exports.writeJobSummary = void 0;
exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const summary_1 = __nccwpck_require__(81327);
const params = __importStar(__nccwpck_require__(23885));
const cache_reporting_1 = __nccwpck_require__(66674);
function writeJobSummary(buildResults, cacheListener) {
function generateJobSummary(buildResults, cacheListener) {
return __awaiter(this, void 0, void 0, function* () {
core.info('Writing job summary');
if (buildResults.length === 0) {
core.debug('No Gradle build results found. Summary table will not be generated.');
}
else {
writeSummaryTable(buildResults);
}
(0, cache_reporting_1.writeCachingReport)(cacheListener);
yield core.summary.write();
});
}
exports.writeJobSummary = writeJobSummary;
function logJobSummary(buildResults, cacheListener) {
return __awaiter(this, void 0, void 0, function* () {
if (buildResults.length === 0) {
core.debug('No Gradle build results found. Summary table will not be logged.');
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary()) {
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
}
else {
logSummaryTable(buildResults);
core.info('============================');
core.info(summaryTable);
core.info('============================');
core.info(cachingReport);
core.info('============================');
}
(0, cache_reporting_1.logCachingReport)(cacheListener);
});
}
exports.logJobSummary = logJobSummary;
function writeSummaryTable(results) {
core.summary.addHeading('Gradle Builds', 3);
core.summary.addRaw(`
exports.generateJobSummary = generateJobSummary;
function renderSummaryTable(results) {
if (results.length === 0) {
return 'No Gradle build results detected.';
}
return `
<h3>Gradle Builds</h3>
<table>
<tr>
<th>Root Project</th>
Expand All @@ -140556,7 +140551,7 @@ function writeSummaryTable(results) {
<th>Build Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`);
`;
}
function renderBuildResultRow(result) {
return `
Expand Down Expand Up @@ -140585,16 +140580,11 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
}
function logSummaryTable(results) {
core.info('============================');
core.info('Gradle Builds');
core.info('----------------------------');
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
core.info('----------------------------');
for (const result of results) {
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
function shouldGenerateJobSummary() {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
core.info('============================');
return params.isJobSummaryEnabled();
}


Expand Down Expand Up @@ -140990,14 +140980,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.complete = exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514));
const summary_1 = __nccwpck_require__(81327);
const path = __importStar(__nccwpck_require__(71017));
const os = __importStar(__nccwpck_require__(22037));
const caches = __importStar(__nccwpck_require__(23800));
const layout = __importStar(__nccwpck_require__(28182));
const params = __importStar(__nccwpck_require__(23885));
const dependencyGraph = __importStar(__nccwpck_require__(80));
const job_summary_1 = __nccwpck_require__(87345);
const jobSummary = __importStar(__nccwpck_require__(87345));
const build_results_1 = __nccwpck_require__(82107);
const cache_reporting_1 = __nccwpck_require__(66674);
const daemon_controller_1 = __nccwpck_require__(85146);
Expand Down Expand Up @@ -141033,12 +141022,7 @@ function complete() {
const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
const daemonController = new daemon_controller_1.DaemonController(buildResults);
yield caches.save(gradleUserHome, cacheListener, daemonController);
if (shouldGenerateJobSummary()) {
yield (0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
}
else {
(0, job_summary_1.logJobSummary)(buildResults, cacheListener);
}
yield jobSummary.generateJobSummary(buildResults, cacheListener);
yield dependencyGraph.complete(params.getDependencyGraphOption());
core.info('Completed post-action step');
});
Expand Down Expand Up @@ -141068,12 +141052,6 @@ function determineUserHome() {
return userHome;
});
}
function shouldGenerateJobSummary() {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
return params.isJobSummaryEnabled();
}


/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 28f293a

Please sign in to comment.