mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 01:56:18 +08:00
Merge pull request #340 from gradle/dd/github-enterprise-support
Improve support for GitHub Enterprise
This commit is contained in:
commit
ea4554d4d2
69
dist/main/index.js
vendored
69
dist/main/index.js
vendored
@ -65405,8 +65405,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.logCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
|
exports.logCachingReport = exports.writeCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
class CacheListener {
|
class CacheListener {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.cacheEntries = [];
|
this.cacheEntries = [];
|
||||||
@ -65418,6 +65419,8 @@ class CacheListener {
|
|||||||
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored());
|
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored());
|
||||||
}
|
}
|
||||||
get cacheStatus() {
|
get cacheStatus() {
|
||||||
|
if (!cache.isFeatureAvailable())
|
||||||
|
return 'not available';
|
||||||
if (this.isCacheDisabled)
|
if (this.isCacheDisabled)
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
if (this.isCacheWriteOnly)
|
if (this.isCacheWriteOnly)
|
||||||
@ -65486,7 +65489,7 @@ class CacheEntryListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CacheEntryListener = CacheEntryListener;
|
exports.CacheEntryListener = CacheEntryListener;
|
||||||
function logCachingReport(listener) {
|
function writeCachingReport(listener) {
|
||||||
const entries = listener.cacheEntries;
|
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.addRaw(`\n<details><summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>\n`);
|
||||||
core.summary.addTable([
|
core.summary.addTable([
|
||||||
@ -65499,7 +65502,26 @@ function logCachingReport(listener) {
|
|||||||
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
|
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
|
||||||
]);
|
]);
|
||||||
core.summary.addHeading('Cache Entry Details', 5);
|
core.summary.addHeading('Cache Entry Details', 5);
|
||||||
const entryDetails = listener.cacheEntries
|
const entryDetails = renderEntryDetails(listener);
|
||||||
|
core.summary.addRaw(`<pre>
|
||||||
|
${entryDetails}
|
||||||
|
</pre>
|
||||||
|
</details>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
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 => {
|
.map(entry => {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
return `Entry: ${entry.entryName}
|
return `Entry: ${entry.entryName}
|
||||||
@ -65513,13 +65535,7 @@ function logCachingReport(listener) {
|
|||||||
`;
|
`;
|
||||||
})
|
})
|
||||||
.join('---\n');
|
.join('---\n');
|
||||||
core.summary.addRaw(`<pre>
|
|
||||||
${entryDetails}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
`);
|
|
||||||
}
|
}
|
||||||
exports.logCachingReport = logCachingReport;
|
|
||||||
function getRestoredMessage(entry, isCacheWriteOnly) {
|
function getRestoredMessage(entry, isCacheWriteOnly) {
|
||||||
if (isCacheWriteOnly) {
|
if (isCacheWriteOnly) {
|
||||||
return '(Entry not restored: cache is write-only)';
|
return '(Entry not restored: cache is write-only)';
|
||||||
@ -65623,6 +65639,9 @@ const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
|||||||
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
||||||
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
||||||
function isCacheDisabled() {
|
function isCacheDisabled() {
|
||||||
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||||
}
|
}
|
||||||
exports.isCacheDisabled = isCacheDisabled;
|
exports.isCacheDisabled = isCacheDisabled;
|
||||||
@ -66073,7 +66092,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.loadBuildResults = exports.writeJobSummary = void 0;
|
exports.loadBuildResults = exports.logJobSummary = exports.writeJobSummary = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
@ -66087,11 +66106,23 @@ function writeJobSummary(buildResults, cacheListener) {
|
|||||||
else {
|
else {
|
||||||
writeSummaryTable(buildResults);
|
writeSummaryTable(buildResults);
|
||||||
}
|
}
|
||||||
(0, cache_reporting_1.logCachingReport)(cacheListener);
|
(0, cache_reporting_1.writeCachingReport)(cacheListener);
|
||||||
yield core.summary.write();
|
yield core.summary.write();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.writeJobSummary = writeJobSummary;
|
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.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logSummaryTable(buildResults);
|
||||||
|
}
|
||||||
|
(0, cache_reporting_1.logCachingReport)(cacheListener);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.logJobSummary = logJobSummary;
|
||||||
function loadBuildResults() {
|
function loadBuildResults() {
|
||||||
const buildResultsDir = path_1.default.resolve(process.env['RUNNER_TEMP'], '.build-results');
|
const buildResultsDir = path_1.default.resolve(process.env['RUNNER_TEMP'], '.build-results');
|
||||||
if (!fs_1.default.existsSync(buildResultsDir)) {
|
if (!fs_1.default.existsSync(buildResultsDir)) {
|
||||||
@ -66145,6 +66176,17 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
|||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
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>`;
|
||||||
}
|
}
|
||||||
|
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}`);
|
||||||
|
}
|
||||||
|
core.info('============================');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -66537,7 +66579,10 @@ function complete() {
|
|||||||
const gradleUserHome = core.getState(GRADLE_USER_HOME);
|
const gradleUserHome = core.getState(GRADLE_USER_HOME);
|
||||||
yield caches.save(gradleUserHome, cacheListener);
|
yield caches.save(gradleUserHome, cacheListener);
|
||||||
if (shouldGenerateJobSummary()) {
|
if (shouldGenerateJobSummary()) {
|
||||||
(0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
|
yield (0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(0, job_summary_1.logJobSummary)(buildResults, cacheListener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
69
dist/post/index.js
vendored
69
dist/post/index.js
vendored
@ -64456,8 +64456,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.logCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
|
exports.logCachingReport = exports.writeCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
class CacheListener {
|
class CacheListener {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.cacheEntries = [];
|
this.cacheEntries = [];
|
||||||
@ -64469,6 +64470,8 @@ class CacheListener {
|
|||||||
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored());
|
return this.cacheEntries.every(x => !x.wasRequestedButNotRestored());
|
||||||
}
|
}
|
||||||
get cacheStatus() {
|
get cacheStatus() {
|
||||||
|
if (!cache.isFeatureAvailable())
|
||||||
|
return 'not available';
|
||||||
if (this.isCacheDisabled)
|
if (this.isCacheDisabled)
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
if (this.isCacheWriteOnly)
|
if (this.isCacheWriteOnly)
|
||||||
@ -64537,7 +64540,7 @@ class CacheEntryListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CacheEntryListener = CacheEntryListener;
|
exports.CacheEntryListener = CacheEntryListener;
|
||||||
function logCachingReport(listener) {
|
function writeCachingReport(listener) {
|
||||||
const entries = listener.cacheEntries;
|
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.addRaw(`\n<details><summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>\n`);
|
||||||
core.summary.addTable([
|
core.summary.addTable([
|
||||||
@ -64550,7 +64553,26 @@ function logCachingReport(listener) {
|
|||||||
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
|
['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
|
||||||
]);
|
]);
|
||||||
core.summary.addHeading('Cache Entry Details', 5);
|
core.summary.addHeading('Cache Entry Details', 5);
|
||||||
const entryDetails = listener.cacheEntries
|
const entryDetails = renderEntryDetails(listener);
|
||||||
|
core.summary.addRaw(`<pre>
|
||||||
|
${entryDetails}
|
||||||
|
</pre>
|
||||||
|
</details>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
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 => {
|
.map(entry => {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
return `Entry: ${entry.entryName}
|
return `Entry: ${entry.entryName}
|
||||||
@ -64564,13 +64586,7 @@ function logCachingReport(listener) {
|
|||||||
`;
|
`;
|
||||||
})
|
})
|
||||||
.join('---\n');
|
.join('---\n');
|
||||||
core.summary.addRaw(`<pre>
|
|
||||||
${entryDetails}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
`);
|
|
||||||
}
|
}
|
||||||
exports.logCachingReport = logCachingReport;
|
|
||||||
function getRestoredMessage(entry, isCacheWriteOnly) {
|
function getRestoredMessage(entry, isCacheWriteOnly) {
|
||||||
if (isCacheWriteOnly) {
|
if (isCacheWriteOnly) {
|
||||||
return '(Entry not restored: cache is write-only)';
|
return '(Entry not restored: cache is write-only)';
|
||||||
@ -64674,6 +64690,9 @@ const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
|||||||
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
||||||
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
||||||
function isCacheDisabled() {
|
function isCacheDisabled() {
|
||||||
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||||
}
|
}
|
||||||
exports.isCacheDisabled = isCacheDisabled;
|
exports.isCacheDisabled = isCacheDisabled;
|
||||||
@ -64993,7 +65012,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.loadBuildResults = exports.writeJobSummary = void 0;
|
exports.loadBuildResults = exports.logJobSummary = exports.writeJobSummary = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
@ -65007,11 +65026,23 @@ function writeJobSummary(buildResults, cacheListener) {
|
|||||||
else {
|
else {
|
||||||
writeSummaryTable(buildResults);
|
writeSummaryTable(buildResults);
|
||||||
}
|
}
|
||||||
(0, cache_reporting_1.logCachingReport)(cacheListener);
|
(0, cache_reporting_1.writeCachingReport)(cacheListener);
|
||||||
yield core.summary.write();
|
yield core.summary.write();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.writeJobSummary = writeJobSummary;
|
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.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logSummaryTable(buildResults);
|
||||||
|
}
|
||||||
|
(0, cache_reporting_1.logCachingReport)(cacheListener);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.logJobSummary = logJobSummary;
|
||||||
function loadBuildResults() {
|
function loadBuildResults() {
|
||||||
const buildResultsDir = path_1.default.resolve(process.env['RUNNER_TEMP'], '.build-results');
|
const buildResultsDir = path_1.default.resolve(process.env['RUNNER_TEMP'], '.build-results');
|
||||||
if (!fs_1.default.existsSync(buildResultsDir)) {
|
if (!fs_1.default.existsSync(buildResultsDir)) {
|
||||||
@ -65065,6 +65096,17 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
|||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
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>`;
|
||||||
}
|
}
|
||||||
|
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}`);
|
||||||
|
}
|
||||||
|
core.info('============================');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -65221,7 +65263,10 @@ function complete() {
|
|||||||
const gradleUserHome = core.getState(GRADLE_USER_HOME);
|
const gradleUserHome = core.getState(GRADLE_USER_HOME);
|
||||||
yield caches.save(gradleUserHome, cacheListener);
|
yield caches.save(gradleUserHome, cacheListener);
|
||||||
if (shouldGenerateJobSummary()) {
|
if (shouldGenerateJobSummary()) {
|
||||||
(0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
|
yield (0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(0, job_summary_1.logJobSummary)(buildResults, cacheListener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
import * as cache from '@actions/cache'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects information on what entries were saved and restored during the action.
|
* Collects information on what entries were saved and restored during the action.
|
||||||
@ -15,6 +16,7 @@ export class CacheListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get cacheStatus(): string {
|
get cacheStatus(): string {
|
||||||
|
if (!cache.isFeatureAvailable()) return 'not available'
|
||||||
if (this.isCacheDisabled) return 'disabled'
|
if (this.isCacheDisabled) return 'disabled'
|
||||||
if (this.isCacheWriteOnly) return 'write-only'
|
if (this.isCacheWriteOnly) return 'write-only'
|
||||||
if (this.isCacheReadOnly) return 'read-only'
|
if (this.isCacheReadOnly) return 'read-only'
|
||||||
@ -104,7 +106,7 @@ export class CacheEntryListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logCachingReport(listener: CacheListener): void {
|
export function writeCachingReport(listener: CacheListener): void {
|
||||||
const entries = listener.cacheEntries
|
const entries = listener.cacheEntries
|
||||||
|
|
||||||
core.summary.addRaw(
|
core.summary.addRaw(
|
||||||
@ -123,10 +125,34 @@ export function logCachingReport(listener: CacheListener): void {
|
|||||||
|
|
||||||
core.summary.addHeading('Cache Entry Details', 5)
|
core.summary.addHeading('Cache Entry Details', 5)
|
||||||
|
|
||||||
const entryDetails = listener.cacheEntries
|
const entryDetails = renderEntryDetails(listener)
|
||||||
|
core.summary.addRaw(`<pre>
|
||||||
|
${entryDetails}
|
||||||
|
</pre>
|
||||||
|
</details>
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function logCachingReport(listener: CacheListener): void {
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderEntryDetails(listener: CacheListener): string {
|
||||||
|
return listener.cacheEntries
|
||||||
.map(
|
.map(
|
||||||
entry =>
|
entry => `Entry: ${entry.entryName}
|
||||||
`Entry: ${entry.entryName}
|
|
||||||
Requested Key : ${entry.requestedKey ?? ''}
|
Requested Key : ${entry.requestedKey ?? ''}
|
||||||
Restored Key : ${entry.restoredKey ?? ''}
|
Restored Key : ${entry.restoredKey ?? ''}
|
||||||
Size: ${formatSize(entry.restoredSize)}
|
Size: ${formatSize(entry.restoredSize)}
|
||||||
@ -137,12 +163,6 @@ export function logCachingReport(listener: CacheListener): void {
|
|||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join('---\n')
|
.join('---\n')
|
||||||
|
|
||||||
core.summary.addRaw(`<pre>
|
|
||||||
${entryDetails}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRestoredMessage(entry: CacheEntryListener, isCacheWriteOnly: boolean): string {
|
function getRestoredMessage(entry: CacheEntryListener, isCacheWriteOnly: boolean): string {
|
||||||
|
@ -25,6 +25,9 @@ const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE'
|
|||||||
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION'
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION'
|
||||||
|
|
||||||
export function isCacheDisabled(): boolean {
|
export function isCacheDisabled(): boolean {
|
||||||
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import {logCachingReport, CacheListener} from './cache-reporting'
|
import {writeCachingReport, CacheListener, logCachingReport} from './cache-reporting'
|
||||||
|
|
||||||
export interface BuildResult {
|
export interface BuildResult {
|
||||||
get rootProjectName(): string
|
get rootProjectName(): string
|
||||||
@ -23,11 +23,21 @@ export async function writeJobSummary(buildResults: BuildResult[], cacheListener
|
|||||||
writeSummaryTable(buildResults)
|
writeSummaryTable(buildResults)
|
||||||
}
|
}
|
||||||
|
|
||||||
logCachingReport(cacheListener)
|
writeCachingReport(cacheListener)
|
||||||
|
|
||||||
await core.summary.write()
|
await core.summary.write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function logJobSummary(buildResults: BuildResult[], cacheListener: CacheListener): Promise<void> {
|
||||||
|
if (buildResults.length === 0) {
|
||||||
|
core.debug('No Gradle build results found. Summary table will not be logged.')
|
||||||
|
} else {
|
||||||
|
logSummaryTable(buildResults)
|
||||||
|
}
|
||||||
|
|
||||||
|
logCachingReport(cacheListener)
|
||||||
|
}
|
||||||
|
|
||||||
export function loadBuildResults(): BuildResult[] {
|
export function loadBuildResults(): BuildResult[] {
|
||||||
const buildResultsDir = path.resolve(process.env['RUNNER_TEMP']!, '.build-results')
|
const buildResultsDir = path.resolve(process.env['RUNNER_TEMP']!, '.build-results')
|
||||||
if (!fs.existsSync(buildResultsDir)) {
|
if (!fs.existsSync(buildResultsDir)) {
|
||||||
@ -92,3 +102,19 @@ function renderBuildScanBadge(outcomeText: string, outcomeColor: string, targetU
|
|||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`
|
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>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logSummaryTable(results: BuildResult[]): void {
|
||||||
|
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}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
core.info('============================')
|
||||||
|
}
|
||||||
|
@ -7,7 +7,7 @@ import * as os from 'os'
|
|||||||
import * as caches from './caches'
|
import * as caches from './caches'
|
||||||
|
|
||||||
import {CacheListener} from './cache-reporting'
|
import {CacheListener} from './cache-reporting'
|
||||||
import {BuildResult, loadBuildResults, writeJobSummary} from './job-summary'
|
import {BuildResult, loadBuildResults, logJobSummary, writeJobSummary} from './job-summary'
|
||||||
|
|
||||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
||||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
||||||
@ -63,7 +63,9 @@ export async function complete(): Promise<void> {
|
|||||||
await caches.save(gradleUserHome, cacheListener)
|
await caches.save(gradleUserHome, cacheListener)
|
||||||
|
|
||||||
if (shouldGenerateJobSummary()) {
|
if (shouldGenerateJobSummary()) {
|
||||||
writeJobSummary(buildResults, cacheListener)
|
await writeJobSummary(buildResults, cacheListener)
|
||||||
|
} else {
|
||||||
|
logJobSummary(buildResults, cacheListener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user