mirror of
https://github.com/Swatinem/rust-cache
synced 2025-09-03 18:18:09 +00:00
remove invalidation
This commit is contained in:
parent
07fbca13c8
commit
b37d2821f8
7 changed files with 135 additions and 222 deletions
|
@ -7,7 +7,7 @@ import { CARGO_HOME } from "./config";
|
|||
import { exists } from "./utils";
|
||||
import { Packages } from "./workspace";
|
||||
|
||||
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp: boolean) {
|
||||
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp = false) {
|
||||
core.debug(`cleaning target directory "${targetDir}"`);
|
||||
|
||||
// remove all *files* from the profile directory
|
||||
|
@ -32,7 +32,7 @@ export async function cleanTargetDir(targetDir: string, packages: Packages, chec
|
|||
}
|
||||
}
|
||||
|
||||
async function cleanProfileTarget(profileDir: string, packages: Packages, checkTimestamp: boolean) {
|
||||
async function cleanProfileTarget(profileDir: string, packages: Packages, checkTimestamp = false) {
|
||||
core.debug(`cleaning profile directory "${profileDir}"`);
|
||||
|
||||
// Quite a few testing utility crates store compilation artifacts as nested
|
||||
|
@ -51,12 +51,11 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
|
||||
// Delete everything else.
|
||||
await rmExcept(profileDir, new Set(["target", "trybuild"]), checkTimestamp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
|
||||
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
|
|
|
@ -10,7 +10,6 @@ import * as toml from "smol-toml";
|
|||
import { getCargoBins } from "./cleanup";
|
||||
import { CacheProvider, exists, getCmdOutput } from "./utils";
|
||||
import { Workspace } from "./workspace";
|
||||
import { isIncrementalMissing } from "./incremental";
|
||||
|
||||
const HOME = os.homedir();
|
||||
export const CARGO_HOME = process.env.CARGO_HOME || path.join(HOME, ".cargo");
|
||||
|
@ -365,14 +364,6 @@ export class CacheConfig {
|
|||
saveState() {
|
||||
core.saveState(STATE_CONFIG, this);
|
||||
}
|
||||
|
||||
isIncrementalMissing(): boolean {
|
||||
if (this.incremental) {
|
||||
return isIncrementalMissing();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,12 +7,6 @@ import path from "path";
|
|||
import { exists } from "./utils";
|
||||
// import { Packages } from "./workspace";
|
||||
|
||||
let incremental_missing = false;
|
||||
|
||||
export function isIncrementalMissing(): boolean {
|
||||
return incremental_missing;
|
||||
}
|
||||
|
||||
export async function restoreIncremental(targetDir: string) {
|
||||
core.debug(`restoring incremental directory "${targetDir}"`);
|
||||
|
||||
|
@ -52,6 +46,5 @@ async function restoreIncrementalProfile(dirName: string) {
|
|||
}
|
||||
} else {
|
||||
core.debug(`incremental-restore.json not found for ${dirName}`);
|
||||
incremental_missing = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,12 +39,12 @@ async function run() {
|
|||
|
||||
core.info(`... ${lookupOnly ? "Checking" : "Restoring"} cache ...`);
|
||||
const key = config.cacheKey;
|
||||
|
||||
// Pass a copy of cachePaths to avoid mutating the original array as reported by:
|
||||
// https://github.com/actions/toolkit/pull/1378
|
||||
// TODO: remove this once the underlying bug is fixed.
|
||||
const restoreKey = await cacheProvider.cache.restoreCache(config.cachePaths.slice(), key, [config.restoreKey], { lookupOnly });
|
||||
|
||||
const restoreKey = await cacheProvider.cache.restoreCache(config.cachePaths.slice(), key, [config.restoreKey], {
|
||||
lookupOnly,
|
||||
});
|
||||
if (restoreKey) {
|
||||
const match = restoreKey === key;
|
||||
core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
||||
|
|
|
@ -89,7 +89,7 @@ async function run() {
|
|||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
|
||||
core.info(`... Saving cache ...`);
|
||||
core.info(`... Saving cache with key ${config.cacheKey}`);
|
||||
// Pass a copy of cachePaths to avoid mutating the original array as reported by:
|
||||
// https://github.com/actions/toolkit/pull/1378
|
||||
// TODO: remove this once the underlying bug is fixed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue