Skip to content

Commit

Permalink
_
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 8b4a3e7 commit e4e7436
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 80 deletions.
1 change: 0 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
allow-prerelease-opam: true
dune-cache: true

- run: opam install uri
50 changes: 24 additions & 26 deletions dist/index.js

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

44 changes: 24 additions & 20 deletions dist/post/index.js

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

51 changes: 29 additions & 22 deletions packages/setup-ocaml/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,40 @@ async function saveCache(key: string, paths: string[]) {
}
}

export async function restoreCygwinCache() {
return await core.group("Retrieve the Cygwin cache", async () => {
const { key, restoreKeys } = await composeCygwinCacheKeys();
const paths = composeCygwinCachePaths();
export async function restoreDuneCache() {
return await core.group("Retrieve the dune cache", async () => {
const { key, restoreKeys } = composeDuneCacheKeys();
const paths = composeDuneCachePaths();
const cacheKey = await restoreCache(key, restoreKeys, paths);
return cacheKey;
});
}

async function restoreCygwinCache() {
const { key, restoreKeys } = await composeCygwinCacheKeys();
const paths = composeCygwinCachePaths();
const cacheKey = await restoreCache(key, restoreKeys, paths);
return cacheKey;
}

async function restoreOpamCache() {
const { key, restoreKeys } = await composeOpamCacheKeys();
const paths = composeOpamCachePaths();
const cacheKey = await restoreCache(key, restoreKeys, paths);
return cacheKey;
}

export async function restoreOpamCaches() {
return await core.group("Retrieve the opam cache", async () => {
const [opamCacheHit, cygwinCacheHit] = await Promise.all(
PLATFORM === "windows"
? [restoreOpamCache(), restoreCygwinCache()]
: [restoreOpamCache()],
);
return { opamCacheHit, cygwinCacheHit };
});
}

export async function saveCygwinCache() {
await core.group("Save the Cygwin cache", async () => {
const { key } = await composeCygwinCacheKeys();
Expand All @@ -176,15 +201,6 @@ export async function saveCygwinCache() {
});
}

export async function restoreDuneCache() {
return await core.group("Retrieve the dune cache", async () => {
const { key, restoreKeys } = composeDuneCacheKeys();
const paths = composeDuneCachePaths();
const cacheKey = await restoreCache(key, restoreKeys, paths);
return cacheKey;
});
}

export async function saveDuneCache() {
await core.group("Save the dune cache", async () => {
const { key } = composeDuneCacheKeys();
Expand All @@ -193,15 +209,6 @@ export async function saveDuneCache() {
});
}

export async function restoreOpamCache() {
return await core.group("Retrieve the opam cache", async () => {
const { key, restoreKeys } = await composeOpamCacheKeys();
const paths = composeOpamCachePaths();
const cacheKey = await restoreCache(key, restoreKeys, paths);
return cacheKey;
});
}

export async function saveOpamCache() {
await core.group("Save the opam cache", async () => {
await exec("opam", [
Expand Down
12 changes: 1 addition & 11 deletions packages/setup-ocaml/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import * as process from "node:process";
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import {
restoreCygwinCache,
restoreDuneCache,
restoreOpamCache,
restoreOpamCaches,
saveCygwinCache,
saveOpamCache,
} from "./cache.js";
Expand All @@ -31,15 +30,6 @@ 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

0 comments on commit e4e7436

Please sign in to comment.