Skip to content

Commit 8b4a3e7

Browse files
committed
faster win setup
Signed-off-by: Sora Morimoto <[email protected]>
1 parent fd50cfe commit 8b4a3e7

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

dist/index.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/setup-ocaml/src/installer.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ import { getOpamLocalPackages } from "./packages.js";
3131
import { resolveCompiler } from "./version.js";
3232
import { setupCygwin } from "./windows.js";
3333

34+
async function restoreOpamCaches() {
35+
const [opamCacheHit, cygwinCacheHit] = await Promise.all(
36+
PLATFORM === "windows"
37+
? [restoreOpamCache(), restoreCygwinCache()]
38+
: [restoreOpamCache()],
39+
);
40+
return { opamCacheHit, cygwinCacheHit };
41+
}
42+
3443
export async function installer() {
3544
if (core.isDebug()) {
3645
core.exportVariable("OPAMVERBOSE", 1);
@@ -58,13 +67,12 @@ export async function installer() {
5867
]);
5968
await exec("fsutil", ["behavior", "query", "SymlinkEvaluation"]);
6069
});
61-
const cygwinCacheHit = await restoreCygwinCache();
62-
if (!cygwinCacheHit) {
63-
await setupCygwin();
64-
await saveCygwinCache();
65-
}
6670
}
67-
const opamCacheHit = await restoreOpamCache();
71+
const { opamCacheHit, cygwinCacheHit } = await restoreOpamCaches();
72+
if (!cygwinCacheHit && PLATFORM === "windows") {
73+
await setupCygwin();
74+
await saveCygwinCache();
75+
}
6876
await setupOpam();
6977
await repositoryRemoveAll();
7078
await repositoryAddAll(OPAM_REPOSITORIES);

0 commit comments

Comments
 (0)