Skip to content

Add cached folder sizes to the debug log #319

Description

@Danil42Russia

Hello!
We were surprised to find that our cache had doubled in size. The first thing we did was enable debug logs to figure out where the space in the cache was going. We eventually found the problem, but not straight away.
However, we eventually realised that the logs lacked information on how much space a particular path occupied out of the total cache size.

Currently, rust-cache has a complex caching scheme:

rust-cache/src/config.ts

Lines 272 to 289 in 85fb424

self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
if (self.cacheBin) {
self.cachePaths = [
path.join(CARGO_HOME, "bin"),
path.join(CARGO_HOME, ".crates.toml"),
path.join(CARGO_HOME, ".crates2.json"),
...self.cachePaths,
];
}
const cacheTargets = core.getInput("cache-targets").toLowerCase() || "true";
if (cacheTargets === "true") {
self.cachePaths.push(...workspaces.map((ws) => ws.target));
}
const cacheDirectories = core.getInput("cache-directories");
for (const dir of cacheDirectories.trim().split(/\s+/).filter(Boolean)) {
self.cachePaths.push(dir);
}

It might be useful to include information on how much space was used in the Post Cache Cargo step, along with the key debug logs :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions