log individual timings

This commit is contained in:
Arpad Borsos 2020-09-28 12:25:15 +02:00
parent a6b59fa340
commit 271ff4b692
2 changed files with 18 additions and 10 deletions

View File

@ -12,10 +12,11 @@ async function run() {
const caches = await getCaches();
for (const [type, { name, path, key, restoreKeys }] of Object.entries(caches)) {
const start = Date.now();
core.startGroup(`Restoring ${name}"…`);
core.info(`Restoring to path "${path}".`);
core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
try {
core.startGroup(`Restoring ${name}"…`);
core.info(`Restoring to path "${path}".`);
core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
const restoreKey = await cache.restoreCache([path], key, restoreKeys);
if (restoreKey) {
core.info(`Restored from cache key "${restoreKey}".`);
@ -25,9 +26,12 @@ async function run() {
}
} catch (e) {
core.info(`[warning] ${e.message}`);
} finally {
core.endGroup();
}
const duration = Math.round((Date.now() - start) / 1000);
if (duration) {
core.info(`Took ${duration}s.`);
}
core.endGroup();
}
} catch (e) {
core.info(`[warning] ${e.message}`);

View File

@ -38,16 +38,20 @@ async function run() {
core.info(`${name} up-to-date.`);
continue;
}
const start = Date.now();
core.startGroup(`Saving ${name}`);
core.info(`Saving path "${path}".`);
core.info(`Using key "${key}".`);
try {
core.startGroup(`Saving ${name}`);
core.info(`Saving path "${path}".`);
core.info(`Using key "${key}".`);
await cache.saveCache([path], key);
} catch (e) {
core.info(`[warning] ${e.message}`);
} finally {
core.endGroup();
}
const duration = Math.round((Date.now() - start) / 1000);
if (duration) {
core.info(`Took ${duration}s.`);
}
core.endGroup();
}
} catch (e) {
core.info(`[warning] ${e.message}`);