mirror of
https://github.com/Swatinem/rust-cache
synced 2025-11-08 00:15:06 +00:00
Improve errors and cleanup
- Silence errors and do not create error annotations, fixes #144 - Implement cleanup for new sparse registry - Do not clean `-sys` dependencies from `registry/src`, hopefully fixes #150
This commit is contained in:
parent
e97a782690
commit
f6987ea139
7 changed files with 213 additions and 56 deletions
14
src/save.ts
14
src/save.ts
|
|
@ -3,7 +3,7 @@ import * as exec from "@actions/exec";
|
|||
|
||||
import { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup";
|
||||
import { CacheConfig, isCacheUpToDate } from "./config";
|
||||
import { getCacheHandler } from "./utils";
|
||||
import { getCacheHandler, reportError } from "./utils";
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
core.error(e.message);
|
||||
|
|
@ -42,30 +42,30 @@ async function run() {
|
|||
core.info(`... Cleaning ${workspace.target} ...`);
|
||||
await cleanTargetDir(workspace.target, packages);
|
||||
} catch (e) {
|
||||
core.error(`${(e as any).stack}`);
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const crates = core.getInput("cache-all-crates").toLowerCase() || "false"
|
||||
const crates = core.getInput("cache-all-crates").toLowerCase() || "false";
|
||||
core.info(`... Cleaning cargo registry cache-all-crates: ${crates} ...`);
|
||||
await cleanRegistry(allPackages, crates !== "true");
|
||||
} catch (e) {
|
||||
core.error(`${(e as any).stack}`);
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
|
||||
try {
|
||||
core.info(`... Cleaning cargo/bin ...`);
|
||||
await cleanBin(config.cargoBins);
|
||||
} catch (e) {
|
||||
core.error(`${(e as any).stack}`);
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
|
||||
try {
|
||||
core.info(`... Cleaning cargo git cache ...`);
|
||||
await cleanGit(allPackages);
|
||||
} catch (e) {
|
||||
core.error(`${(e as any).stack}`);
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
|
||||
core.info(`... Saving cache ...`);
|
||||
|
|
@ -74,7 +74,7 @@ async function run() {
|
|||
// TODO: remove this once the underlying bug is fixed.
|
||||
await cache.saveCache(config.cachePaths.slice(), config.cacheKey);
|
||||
} catch (e) {
|
||||
core.error(`${(e as any).stack}`);
|
||||
reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue