Skip to content

Commit

Permalink
Use better dune cache keys
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <sora@morimoto.io>
  • Loading branch information
smorimoto committed Aug 6, 2024
1 parent 653dbf2 commit a1a3d11
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
### Changed

- Unlock `--with-doc` in analysis.
- Use better dune cache keys.

### Fixed

Expand Down
12 changes: 8 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions packages/setup-ocaml/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ async function composeCygwinCacheKeys() {
}

async function composeDuneCacheKeys() {
const { workflow, job } = github.context;
const { workflow, job, runId } = github.context;
const ocamlCompiler = await RESOLVED_COMPILER;
const plainKey = [PLATFORM, ARCHITECTURE, ocamlCompiler, workflow, job].join(
",",
);
const plainKey = [ocamlCompiler, workflow, job].join(",");
const hash = crypto.createHash("sha256").update(plainKey).digest("hex");
const key = `${CACHE_PREFIX}-setup-ocaml-dune-${hash}`;
const restoreKeys = [key];
const key = `${CACHE_PREFIX}-setup-ocaml-dune-${PLATFORM}-${ARCHITECTURE}-${hash}-${runId}`;
const restoreKeys = [
key,
`${CACHE_PREFIX}-setup-ocaml-dune-${PLATFORM}-${ARCHITECTURE}-${hash}-`,
`${CACHE_PREFIX}-setup-ocaml-dune-${PLATFORM}-${ARCHITECTURE}-`,
];
core.debug(`dune cache key: ${plainKey}`);
return { key, restoreKeys };
}
Expand Down

0 comments on commit a1a3d11

Please sign in to comment.