3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-06-19 06:43:41 +00:00
This commit is contained in:
Arpad Borsos 2020-12-07 23:58:13 +01:00
parent 9e10a44ea3
commit 08d3994b7a
2 changed files with 39 additions and 51 deletions

20
dist/restore/index.js vendored
View file

@ -55105,6 +55105,10 @@ var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
process.on("uncaughtException", (e) => { process.on("uncaughtException", (e) => {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);
}); });
const cwd = core.getInput("working-directory");
if (cwd) {
process.chdir(cwd);
}
const stateKey = "RUST_CACHE_KEY"; const stateKey = "RUST_CACHE_KEY";
const stateHash = "RUST_CACHE_HASH"; const stateHash = "RUST_CACHE_HASH";
const home = external_os_default().homedir(); const home = external_os_default().homedir();
@ -55231,6 +55235,7 @@ async function rmExcept(dirName, keepPrefix) {
} }
} }
async function rm(parent, dirent) { async function rm(parent, dirent) {
try {
const fileName = external_path_default().join(parent, dirent.name); const fileName = external_path_default().join(parent, dirent.name);
core.debug(`deleting "${fileName}"`); core.debug(`deleting "${fileName}"`);
if (dirent.isFile()) { if (dirent.isFile()) {
@ -55240,22 +55245,19 @@ async function rm(parent, dirent) {
await io.rmRF(fileName); await io.rmRF(fileName);
} }
} }
catch { }
}
// CONCATENATED MODULE: ./src/restore.ts // CONCATENATED MODULE: ./src/restore.ts
async function run() { async function run() {
if (!isValidEvent()) {
return;
}
try { try {
core.exportVariable("CARGO_INCREMENTAL", 0); core.exportVariable("CARGO_INCREMENTAL", 0);
const start = Date.now();
const { paths, key, restoreKeys } = await getCacheConfig(); const { paths, key, restoreKeys } = await getCacheConfig();
core.info(`Restoring paths:\n ${paths.join("\n ")}`); core.info(`Restoring paths:\n ${paths.join("\n ")}`);
core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`); core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
try {
const restoreKey = await cache.restoreCache(paths, key, restoreKeys); const restoreKey = await cache.restoreCache(paths, key, restoreKeys);
if (restoreKey) { if (restoreKey) {
core.info(`Restored from cache key "${restoreKey}".`); core.info(`Restored from cache key "${restoreKey}".`);
@ -55273,14 +55275,6 @@ async function run() {
catch (e) { catch (e) {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);
} }
const duration = Math.round((Date.now() - start) / 1000);
if (duration) {
core.info(`Took ${duration}s.`);
}
}
catch (e) {
core.info(`[warning] ${e.message}`);
}
} }
run(); run();

20
dist/save/index.js vendored
View file

@ -55105,6 +55105,10 @@ var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
process.on("uncaughtException", (e) => { process.on("uncaughtException", (e) => {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);
}); });
const cwd = core.getInput("working-directory");
if (cwd) {
process.chdir(cwd);
}
const stateKey = "RUST_CACHE_KEY"; const stateKey = "RUST_CACHE_KEY";
const stateHash = "RUST_CACHE_HASH"; const stateHash = "RUST_CACHE_HASH";
const home = external_os_default().homedir(); const home = external_os_default().homedir();
@ -55231,6 +55235,7 @@ async function rmExcept(dirName, keepPrefix) {
} }
} }
async function rm(parent, dirent) { async function rm(parent, dirent) {
try {
const fileName = external_path_default().join(parent, dirent.name); const fileName = external_path_default().join(parent, dirent.name);
core.debug(`deleting "${fileName}"`); core.debug(`deleting "${fileName}"`);
if (dirent.isFile()) { if (dirent.isFile()) {
@ -55240,6 +55245,8 @@ async function rm(parent, dirent) {
await io.rmRF(fileName); await io.rmRF(fileName);
} }
} }
catch { }
}
// CONCATENATED MODULE: ./src/save.ts // CONCATENATED MODULE: ./src/save.ts
@ -55251,11 +55258,7 @@ async function rm(parent, dirent) {
async function run() { async function run() {
if (!isValidEvent()) {
return;
}
try { try {
const start = Date.now();
const { paths: savePaths, key } = await getCacheConfig(); const { paths: savePaths, key } = await getCacheConfig();
if (core.getState(stateKey) === key) { if (core.getState(stateKey) === key) {
core.info(`Cache up-to-date.`); core.info(`Cache up-to-date.`);
@ -55279,20 +55282,11 @@ async function run() {
catch { } catch { }
core.info(`Saving paths:\n ${savePaths.join("\n ")}`); core.info(`Saving paths:\n ${savePaths.join("\n ")}`);
core.info(`Using key "${key}".`); core.info(`Using key "${key}".`);
try {
await cache.saveCache(savePaths, key); await cache.saveCache(savePaths, key);
} }
catch (e) { catch (e) {
core.info(`[warning] ${e.message}`); core.info(`[warning] ${e.message}`);
} }
const duration = Math.round((Date.now() - start) / 1000);
if (duration) {
core.info(`Took ${duration}s.`);
}
}
catch (e) {
core.info(`[warning] ${e.message}`);
}
} }
run(); run();
async function getRegistryName() { async function getRegistryName() {