Skip to content

Commit

Permalink
Move cache out of the worktree
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Oct 8, 2023
1 parent 9ec9ca3 commit 5441bc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59595,7 +59595,7 @@ async function restore(ccacheVariant) {
const keyPrefix = ccacheVariant + "-";
const primaryKey = inputs.primaryKey ? keyPrefix + inputs.primaryKey + "-" : keyPrefix;
const restoreKeys = inputs.restoreKeys.map(k => keyPrefix + k + "-");
const paths = [`.${ccacheVariant}`];
const paths = [`../${ccacheVariant}`];
core.saveState("primaryKey", primaryKey);
const shouldRestore = core.getBooleanInput("restore");
if (!shouldRestore) {
Expand All @@ -59620,7 +59620,7 @@ async function configure(ccacheVariant, platform) {
const ghWorkSpace = external_process_namespaceObject.env.GITHUB_WORKSPACE || "unreachable, make ncc happy";
const maxSize = core.getInput('max-size');
if (ccacheVariant === "ccache") {
await execBash(`ccache --set-config=cache_dir='${external_path_default().join(ghWorkSpace, '.ccache')}'`);
await execBash(`ccache --set-config=cache_dir='${external_path_default().join(ghWorkSpace, '..', 'ccache')}'`);
await execBash(`ccache --set-config=max_size='${maxSize}'`);
await execBash(`ccache --set-config=compression=true`);
if (platform === "darwin") {
Expand All @@ -59630,7 +59630,7 @@ async function configure(ccacheVariant, platform) {
await execBash("ccache -p");
}
else {
const options = `SCCACHE_IDLE_TIMEOUT=0 SCCACHE_DIR='${ghWorkSpace}'/.sccache SCCACHE_CACHE_SIZE='${maxSize}'`;
const options = `SCCACHE_IDLE_TIMEOUT=0 SCCACHE_DIR='${ghWorkSpace}'/../sccache SCCACHE_CACHE_SIZE='${maxSize}'`;
await execBash(`env ${options} sccache --start-server`);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function restore(ccacheVariant : string) : Promise<void> {
const keyPrefix = ccacheVariant + "-";
const primaryKey = inputs.primaryKey ? keyPrefix + inputs.primaryKey + "-" : keyPrefix;
const restoreKeys = inputs.restoreKeys.map(k => keyPrefix + k + "-")
const paths = [`.${ccacheVariant}`];
const paths = [`../${ccacheVariant}`];

core.saveState("primaryKey", primaryKey);

Expand Down Expand Up @@ -50,7 +50,7 @@ async function configure(ccacheVariant : string, platform : string) : Promise<vo
const maxSize = core.getInput('max-size');

if (ccacheVariant === "ccache") {
await execBash(`ccache --set-config=cache_dir='${path.join(ghWorkSpace, '.ccache')}'`);
await execBash(`ccache --set-config=cache_dir='${path.join(ghWorkSpace, '..', 'ccache')}'`);
await execBash(`ccache --set-config=max_size='${maxSize}'`);
await execBash(`ccache --set-config=compression=true`);
if (platform === "darwin") {
Expand All @@ -59,7 +59,7 @@ async function configure(ccacheVariant : string, platform : string) : Promise<vo
core.info("Cccache config:");
await execBash("ccache -p");
} else {
const options = `SCCACHE_IDLE_TIMEOUT=0 SCCACHE_DIR='${ghWorkSpace}'/.sccache SCCACHE_CACHE_SIZE='${maxSize}'`;
const options = `SCCACHE_IDLE_TIMEOUT=0 SCCACHE_DIR='${ghWorkSpace}'/../sccache SCCACHE_CACHE_SIZE='${maxSize}'`;
await execBash(`env ${options} sccache --start-server`);
}

Expand Down

0 comments on commit 5441bc0

Please sign in to comment.