Skip to content

Commit

Permalink
Faster set-up when a cache hit occurs
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed Nov 9, 2024
1 parent 01a166b commit d67a46f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
30 changes: 19 additions & 11 deletions dist/index.js

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

9 changes: 6 additions & 3 deletions packages/setup-ocaml/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
repositoryAddAll,
repositoryRemoveAll,
setupOpam,
update,
} from "./opam.js";
import { retrieveOpamLocalPackages } from "./packages.js";
import { setupCygwin } from "./windows.js";
Expand Down Expand Up @@ -69,12 +70,14 @@ export async function installer() {
core.addPath(CYGWIN_ROOT_BIN);
}
await setupOpam();
await repositoryRemoveAll();
await repositoryAddAll(OPAM_REPOSITORIES);
const ocamlCompiler = await RESOLVED_COMPILER;
if (!opamCacheHit) {
await repositoryRemoveAll();
await repositoryAddAll(OPAM_REPOSITORIES);
const ocamlCompiler = await RESOLVED_COMPILER;
await installOcaml(ocamlCompiler);
await saveOpamCache();
} else {
await update();
}
if (DUNE_CACHE) {
await restoreDuneCache();
Expand Down
6 changes: 6 additions & 0 deletions packages/setup-ocaml/src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,9 @@ export async function repositoryRemoveAll() {
}
});
}

export async function update() {
await core.group("Update the list of available opam packages", async () => {
await exec("opam", ["update"]);
});
}

0 comments on commit d67a46f

Please sign in to comment.