Skip to content

Commit

Permalink
Build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Aug 16, 2022
1 parent b49446f commit 25e9b4d
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 62 deletions.
76 changes: 46 additions & 30 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,17 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
core.info('Cache restored successfully');
return restoredEntry;
}
catch (error) {
const typedError = error;
if (typedError.name === ValidationError.name) {
throw error;
}
else {
// Supress all non-validation cache related errors because caching should be optional
core.warning(`Failed to restore: ${error.message}`);
}
}
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else {
// // Supress all non-validation cache related errors because caching should be optional
// core.warning(`Failed to restore: ${error.message}`);
// }
// }
finally {
// Try to delete the archive to save space
try {
Expand Down Expand Up @@ -193,18 +194,19 @@ function saveCache(paths, key, options) {
core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
}
catch (error) {
const typedError = error;
if (typedError.name === ValidationError.name) {
throw error;
}
else if (typedError.name === ReserveCacheError.name) {
core.info(`Failed to save: ${typedError.message}`);
}
else {
core.warning(`Failed to save: ${typedError.message}`);
}
}
// PATCH: Error handling is done in action code, allowing us to provide better reporting
// catch (error) {
// const typedError = error;
// if (typedError.name === ValidationError.name) {
// throw error;
// }
// else if (typedError.name === ReserveCacheError.name) {
// core.info(`Failed to save: ${typedError.message}`);
// }
// else {
// core.warning(`Failed to save: ${typedError.message}`);
// }
// }
finally {
// Try to delete the archive to save space
try {
Expand Down Expand Up @@ -65745,10 +65747,10 @@ class GradleStateCache {
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
for (const entryListener of listener.cacheEntries) {
if (entryListener === gradleHomeEntryListener) {
entryListener.markUnsaved('cache key not changed');
entryListener.markNotSaved('cache key not changed');
}
else {
entryListener.markUnsaved(`referencing '${this.cacheDescription}' cache entry not saved`);
entryListener.markNotSaved(`referencing '${this.cacheDescription}' cache entry not saved`);
}
}
return;
Expand Down Expand Up @@ -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;
if (previouslyRestoredKey === cacheKey) {
(0, cache_utils_1.cacheDebug)(`No change to previously restored ${artifactType}. Not saving.`);
entryListener.markUnsaved('contents unchanged');
entryListener.markNotSaved('contents unchanged');
}
else {
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`);
Expand Down Expand Up @@ -66230,6 +66232,10 @@ class CacheEntryListener {
this.restoredSize = size;
return this;
}
markNotRestored(message) {
this.notRestored = message;
return this;
}
markSaved(key, size) {
this.savedKey = key;
this.savedSize = size;
Expand All @@ -66240,8 +66246,8 @@ class CacheEntryListener {
this.savedSize = 0;
return this;
}
markUnsaved(message) {
this.unsaved = message;
markNotSaved(message) {
this.notSaved = message;
return this;
}
}
Expand Down Expand Up @@ -66294,9 +66300,15 @@ function renderEntryDetails(listener) {
.join('---\n');
}
function getRestoredMessage(entry, cacheWriteOnly) {
if (entry.notRestored) {
return `(Entry not restored: ${entry.notRestored})`;
}
if (cacheWriteOnly) {
return '(Entry not restored: cache is write-only)';
}
if (entry.requestedKey === undefined) {
return '(Entry not restored: not requested)';
}
if (entry.restoredKey === undefined) {
return '(Entry not restored: no match found)';
}
Expand All @@ -66306,8 +66318,8 @@ function getRestoredMessage(entry, cacheWriteOnly) {
return '(Entry restored: partial match found)';
}
function getSavedMessage(entry, cacheReadOnly) {
if (entry.unsaved) {
return `(Entry not saved: ${entry.unsaved})`;
if (entry.notSaved) {
return `(Entry not saved: ${entry.notSaved})`;
}
if (entry.savedKey === undefined) {
if (cacheReadOnly) {
Expand All @@ -66321,7 +66333,7 @@ function getSavedMessage(entry, cacheReadOnly) {
return '(Entry saved)';
}
function getCount(cacheEntries, predicate) {
return cacheEntries.filter(e => predicate(e) !== undefined).length;
return cacheEntries.filter(e => predicate(e)).length;
}
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);
Expand Down Expand Up @@ -66478,6 +66490,7 @@ function restoreCache(cachePath, cacheKey, cacheRestoreKeys, listener) {
return restoredEntry;
}
catch (error) {
listener.markNotRestored(error.message);
handleCacheFailure(error, `Failed to restore ${cacheKey}`);
return undefined;
}
Expand All @@ -66494,6 +66507,9 @@ function saveCache(cachePath, cacheKey, listener) {
if (error instanceof cache.ReserveCacheError) {
listener.markAlreadyExists(cacheKey);
}
else {
listener.markNotSaved(error.message);
}
handleCacheFailure(error, `Failed to save cache entry with path '${cachePath}' and key: ${cacheKey}`);
}
});
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

0 comments on commit 25e9b4d

Please sign in to comment.