Build outputs

This commit is contained in:
Daz DeBoer 2022-08-16 15:48:55 -06:00
parent b49446f8e1
commit 25e9b4d3f6
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
4 changed files with 94 additions and 62 deletions

76
dist/main/index.js vendored
View file

@ -115,16 +115,17 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
core.info('Cache restored successfully'); core.info('Cache restored successfully');
return restoredEntry; return restoredEntry;
} }
catch (error) { // PATCH: Error handling is done in action code, allowing us to provide better reporting
const typedError = error; // catch (error) {
if (typedError.name === ValidationError.name) { // const typedError = error;
throw error; // if (typedError.name === ValidationError.name) {
} // throw error;
else { // }
// Supress all non-validation cache related errors because caching should be optional // else {
core.warning(`Failed to restore: ${error.message}`); // // Supress all non-validation cache related errors because caching should be optional
} // core.warning(`Failed to restore: ${error.message}`);
} // }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -193,18 +194,19 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`); core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options); yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
catch (error) { // PATCH: Error handling is done in action code, allowing us to provide better reporting
const typedError = error; // catch (error) {
if (typedError.name === ValidationError.name) { // const typedError = error;
throw error; // if (typedError.name === ValidationError.name) {
} // throw error;
else if (typedError.name === ReserveCacheError.name) { // }
core.info(`Failed to save: ${typedError.message}`); // else if (typedError.name === ReserveCacheError.name) {
} // core.info(`Failed to save: ${typedError.message}`);
else { // }
core.warning(`Failed to save: ${typedError.message}`); // else {
} // core.warning(`Failed to save: ${typedError.message}`);
} // }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -65745,10 +65747,10 @@ class GradleStateCache {
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`); core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
for (const entryListener of listener.cacheEntries) { for (const entryListener of listener.cacheEntries) {
if (entryListener === gradleHomeEntryListener) { if (entryListener === gradleHomeEntryListener) {
entryListener.markUnsaved('cache key not changed'); entryListener.markNotSaved('cache key not changed');
} }
else { else {
entryListener.markUnsaved(`referencing '${this.cacheDescription}' cache entry not saved`); entryListener.markNotSaved(`referencing '${this.cacheDescription}' cache entry not saved`);
} }
} }
return; return;
@ -65992,7 +65994,7 @@ class AbstractEntryExtractor {
const previouslyRestoredKey = (_a = previouslyRestoredEntries.find(x => x.artifactType === artifactType && x.pattern === pattern)) === null || _a === void 0 ? void 0 : _a.cacheKey; const previouslyRestoredKey = (_a = previouslyRestoredEntries.find(x => x.artifactType === artifactType && x.pattern === pattern)) === null || _a === void 0 ? void 0 : _a.cacheKey;
if (previouslyRestoredKey === cacheKey) { if (previouslyRestoredKey === cacheKey) {
(0, cache_utils_1.cacheDebug)(`No change to previously restored ${artifactType}. Not saving.`); (0, cache_utils_1.cacheDebug)(`No change to previously restored ${artifactType}. Not saving.`);
entryListener.markUnsaved('contents unchanged'); entryListener.markNotSaved('contents unchanged');
} }
else { else {
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`); core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`);
@ -66230,6 +66232,10 @@ class CacheEntryListener {
this.restoredSize = size; this.restoredSize = size;
return this; return this;
} }
markNotRestored(message) {
this.notRestored = message;
return this;
}
markSaved(key, size) { markSaved(key, size) {
this.savedKey = key; this.savedKey = key;
this.savedSize = size; this.savedSize = size;
@ -66240,8 +66246,8 @@ class CacheEntryListener {
this.savedSize = 0; this.savedSize = 0;
return this; return this;
} }
markUnsaved(message) { markNotSaved(message) {
this.unsaved = message; this.notSaved = message;
return this; return this;
} }
} }
@ -66294,9 +66300,15 @@ function renderEntryDetails(listener) {
.join('---\n'); .join('---\n');
} }
function getRestoredMessage(entry, cacheWriteOnly) { function getRestoredMessage(entry, cacheWriteOnly) {
if (entry.notRestored) {
return `(Entry not restored: ${entry.notRestored})`;
}
if (cacheWriteOnly) { if (cacheWriteOnly) {
return '(Entry not restored: cache is write-only)'; return '(Entry not restored: cache is write-only)';
} }
if (entry.requestedKey === undefined) {
return '(Entry not restored: not requested)';
}
if (entry.restoredKey === undefined) { if (entry.restoredKey === undefined) {
return '(Entry not restored: no match found)'; return '(Entry not restored: no match found)';
} }
@ -66306,8 +66318,8 @@ function getRestoredMessage(entry, cacheWriteOnly) {
return '(Entry restored: partial match found)'; return '(Entry restored: partial match found)';
} }
function getSavedMessage(entry, cacheReadOnly) { function getSavedMessage(entry, cacheReadOnly) {
if (entry.unsaved) { if (entry.notSaved) {
return `(Entry not saved: ${entry.unsaved})`; return `(Entry not saved: ${entry.notSaved})`;
} }
if (entry.savedKey === undefined) { if (entry.savedKey === undefined) {
if (cacheReadOnly) { if (cacheReadOnly) {
@ -66321,7 +66333,7 @@ function getSavedMessage(entry, cacheReadOnly) {
return '(Entry saved)'; return '(Entry saved)';
} }
function getCount(cacheEntries, predicate) { function getCount(cacheEntries, predicate) {
return cacheEntries.filter(e => predicate(e) !== undefined).length; return cacheEntries.filter(e => predicate(e)).length;
} }
function getSize(cacheEntries, predicate) { function getSize(cacheEntries, predicate) {
const bytes = cacheEntries.map(e => { var _a; return (_a = predicate(e)) !== null && _a !== void 0 ? _a : 0; }).reduce((p, v) => p + v, 0); const bytes = cacheEntries.map(e => { var _a; return (_a = predicate(e)) !== null && _a !== void 0 ? _a : 0; }).reduce((p, v) => p + v, 0);
@ -66478,6 +66490,7 @@ function restoreCache(cachePath, cacheKey, cacheRestoreKeys, listener) {
return restoredEntry; return restoredEntry;
} }
catch (error) { catch (error) {
listener.markNotRestored(error.message);
handleCacheFailure(error, `Failed to restore ${cacheKey}`); handleCacheFailure(error, `Failed to restore ${cacheKey}`);
return undefined; return undefined;
} }
@ -66494,6 +66507,9 @@ function saveCache(cachePath, cacheKey, listener) {
if (error instanceof cache.ReserveCacheError) { if (error instanceof cache.ReserveCacheError) {
listener.markAlreadyExists(cacheKey); listener.markAlreadyExists(cacheKey);
} }
else {
listener.markNotSaved(error.message);
}
handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`); handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`);
} }
}); });

File diff suppressed because one or more lines are too long

76
dist/post/index.js vendored
View file

@ -115,16 +115,17 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
core.info('Cache restored successfully'); core.info('Cache restored successfully');
return restoredEntry; return restoredEntry;
} }
catch (error) { // PATCH: Error handling is done in action code, allowing us to provide better reporting
const typedError = error; // catch (error) {
if (typedError.name === ValidationError.name) { // const typedError = error;
throw error; // if (typedError.name === ValidationError.name) {
} // throw error;
else { // }
// Supress all non-validation cache related errors because caching should be optional // else {
core.warning(`Failed to restore: ${error.message}`); // // Supress all non-validation cache related errors because caching should be optional
} // core.warning(`Failed to restore: ${error.message}`);
} // }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -193,18 +194,19 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`); core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options); yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
catch (error) { // PATCH: Error handling is done in action code, allowing us to provide better reporting
const typedError = error; // catch (error) {
if (typedError.name === ValidationError.name) { // const typedError = error;
throw error; // if (typedError.name === ValidationError.name) {
} // throw error;
else if (typedError.name === ReserveCacheError.name) { // }
core.info(`Failed to save: ${typedError.message}`); // else if (typedError.name === ReserveCacheError.name) {
} // core.info(`Failed to save: ${typedError.message}`);
else { // }
core.warning(`Failed to save: ${typedError.message}`); // else {
} // core.warning(`Failed to save: ${typedError.message}`);
} // }
// }
finally { finally {
// Try to delete the archive to save space // Try to delete the archive to save space
try { try {
@ -64796,10 +64798,10 @@ class GradleStateCache {
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`); core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
for (const entryListener of listener.cacheEntries) { for (const entryListener of listener.cacheEntries) {
if (entryListener === gradleHomeEntryListener) { if (entryListener === gradleHomeEntryListener) {
entryListener.markUnsaved('cache key not changed'); entryListener.markNotSaved('cache key not changed');
} }
else { else {
entryListener.markUnsaved(`referencing '${this.cacheDescription}' cache entry not saved`); entryListener.markNotSaved(`referencing '${this.cacheDescription}' cache entry not saved`);
} }
} }
return; return;
@ -65043,7 +65045,7 @@ class AbstractEntryExtractor {
const previouslyRestoredKey = (_a = previouslyRestoredEntries.find(x => x.artifactType === artifactType && x.pattern === pattern)) === null || _a === void 0 ? void 0 : _a.cacheKey; const previouslyRestoredKey = (_a = previouslyRestoredEntries.find(x => x.artifactType === artifactType && x.pattern === pattern)) === null || _a === void 0 ? void 0 : _a.cacheKey;
if (previouslyRestoredKey === cacheKey) { if (previouslyRestoredKey === cacheKey) {
(0, cache_utils_1.cacheDebug)(`No change to previously restored ${artifactType}. Not saving.`); (0, cache_utils_1.cacheDebug)(`No change to previously restored ${artifactType}. Not saving.`);
entryListener.markUnsaved('contents unchanged'); entryListener.markNotSaved('contents unchanged');
} }
else { else {
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`); core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`);
@ -65281,6 +65283,10 @@ class CacheEntryListener {
this.restoredSize = size; this.restoredSize = size;
return this; return this;
} }
markNotRestored(message) {
this.notRestored = message;
return this;
}
markSaved(key, size) { markSaved(key, size) {
this.savedKey = key; this.savedKey = key;
this.savedSize = size; this.savedSize = size;
@ -65291,8 +65297,8 @@ class CacheEntryListener {
this.savedSize = 0; this.savedSize = 0;
return this; return this;
} }
markUnsaved(message) { markNotSaved(message) {
this.unsaved = message; this.notSaved = message;
return this; return this;
} }
} }
@ -65345,9 +65351,15 @@ function renderEntryDetails(listener) {
.join('---\n'); .join('---\n');
} }
function getRestoredMessage(entry, cacheWriteOnly) { function getRestoredMessage(entry, cacheWriteOnly) {
if (entry.notRestored) {
return `(Entry not restored: ${entry.notRestored})`;
}
if (cacheWriteOnly) { if (cacheWriteOnly) {
return '(Entry not restored: cache is write-only)'; return '(Entry not restored: cache is write-only)';
} }
if (entry.requestedKey === undefined) {
return '(Entry not restored: not requested)';
}
if (entry.restoredKey === undefined) { if (entry.restoredKey === undefined) {
return '(Entry not restored: no match found)'; return '(Entry not restored: no match found)';
} }
@ -65357,8 +65369,8 @@ function getRestoredMessage(entry, cacheWriteOnly) {
return '(Entry restored: partial match found)'; return '(Entry restored: partial match found)';
} }
function getSavedMessage(entry, cacheReadOnly) { function getSavedMessage(entry, cacheReadOnly) {
if (entry.unsaved) { if (entry.notSaved) {
return `(Entry not saved: ${entry.unsaved})`; return `(Entry not saved: ${entry.notSaved})`;
} }
if (entry.savedKey === undefined) { if (entry.savedKey === undefined) {
if (cacheReadOnly) { if (cacheReadOnly) {
@ -65372,7 +65384,7 @@ function getSavedMessage(entry, cacheReadOnly) {
return '(Entry saved)'; return '(Entry saved)';
} }
function getCount(cacheEntries, predicate) { function getCount(cacheEntries, predicate) {
return cacheEntries.filter(e => predicate(e) !== undefined).length; return cacheEntries.filter(e => predicate(e)).length;
} }
function getSize(cacheEntries, predicate) { function getSize(cacheEntries, predicate) {
const bytes = cacheEntries.map(e => { var _a; return (_a = predicate(e)) !== null && _a !== void 0 ? _a : 0; }).reduce((p, v) => p + v, 0); const bytes = cacheEntries.map(e => { var _a; return (_a = predicate(e)) !== null && _a !== void 0 ? _a : 0; }).reduce((p, v) => p + v, 0);
@ -65529,6 +65541,7 @@ function restoreCache(cachePath, cacheKey, cacheRestoreKeys, listener) {
return restoredEntry; return restoredEntry;
} }
catch (error) { catch (error) {
listener.markNotRestored(error.message);
handleCacheFailure(error, `Failed to restore ${cacheKey}`); handleCacheFailure(error, `Failed to restore ${cacheKey}`);
return undefined; return undefined;
} }
@ -65545,6 +65558,9 @@ function saveCache(cachePath, cacheKey, listener) {
if (error instanceof cache.ReserveCacheError) { if (error instanceof cache.ReserveCacheError) {
listener.markAlreadyExists(cacheKey); listener.markAlreadyExists(cacheKey);
} }
else {
listener.markNotSaved(error.message);
}
handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`); handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`);
} }
}); });

File diff suppressed because one or more lines are too long