Skip to content

Commit

Permalink
faster win setup
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed Jun 14, 2024
1 parent fd50cfe commit 8b4a3e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
17 changes: 11 additions & 6 deletions dist/index.js

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

20 changes: 14 additions & 6 deletions packages/setup-ocaml/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ import { getOpamLocalPackages } from "./packages.js";
import { resolveCompiler } from "./version.js";
import { setupCygwin } from "./windows.js";

async function restoreOpamCaches() {
const [opamCacheHit, cygwinCacheHit] = await Promise.all(
PLATFORM === "windows"
? [restoreOpamCache(), restoreCygwinCache()]
: [restoreOpamCache()],
);
return { opamCacheHit, cygwinCacheHit };
}

export async function installer() {
if (core.isDebug()) {
core.exportVariable("OPAMVERBOSE", 1);
Expand Down Expand Up @@ -58,13 +67,12 @@ export async function installer() {
]);
await exec("fsutil", ["behavior", "query", "SymlinkEvaluation"]);
});
const cygwinCacheHit = await restoreCygwinCache();
if (!cygwinCacheHit) {
await setupCygwin();
await saveCygwinCache();
}
}
const opamCacheHit = await restoreOpamCache();
const { opamCacheHit, cygwinCacheHit } = await restoreOpamCaches();
if (!cygwinCacheHit && PLATFORM === "windows") {
await setupCygwin();
await saveCygwinCache();
}
await setupOpam();
await repositoryRemoveAll();
await repositoryAddAll(OPAM_REPOSITORIES);
Expand Down

0 comments on commit 8b4a3e7

Please sign in to comment.