Skip to content

Commit

Permalink
Fix: 'reserveCache failed: Cache already exists'
Browse files Browse the repository at this point in the history
Cache keys could be namespaced with arch now that darwin is supported
both on x86 and arm64
  • Loading branch information
ManasJayanth committed May 10, 2024
1 parent 6d00824 commit 4cde782
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ async function main() {
process.chdir(workingDirectory);

const platform = os.platform();
const arch = os.arch();
const installPath = ["~/.esy/source"];
const installKey = `source-${platform}-${cacheKey}`;
const installKey = `source-${platform}-${arch}-${cacheKey}`;
core.startGroup("Restoring install cache");
const installCacheKey = await cache.restoreCache(
installPath,
installKey,
[]
[],
);
if (installCacheKey) {
console.log("Restored the install cache");
Expand All @@ -55,14 +56,14 @@ async function main() {
.pop();

const depsPath = [path.join(ESY_FOLDER, esy3!, "i")];
const buildKey = `build-${platform}-${cacheKey}`;
const restoreKeys = [`build-${platform}-`, `build-`];
const buildKey = `build-${platform}-${arch}-${cacheKey}`;
const restoreKeys = [`build-${platform}-${arch}-`, `build-`];

core.startGroup("Restoring build cache");
const buildCacheKey = await cache.restoreCache(
depsPath,
buildKey,
restoreKeys
restoreKeys,
);
if (buildCacheKey) {
console.log("Restored the build cache");
Expand Down

0 comments on commit 4cde782

Please sign in to comment.