From e4e74369d0aa6d1e592e7aac0ce584012facd207 Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Fri, 14 Jun 2024 09:42:36 +0900 Subject: [PATCH] _ Signed-off-by: Sora Morimoto --- .github/workflows/workflow.yml | 1 - dist/index.js | 50 +++++++++++++------------- dist/post/index.js | 44 ++++++++++++----------- packages/setup-ocaml/src/cache.ts | 51 +++++++++++++++------------ packages/setup-ocaml/src/installer.ts | 12 +------ 5 files changed, 78 insertions(+), 80 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 64602687..8877b7c6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -67,6 +67,5 @@ jobs: with: ocaml-compiler: ${{ matrix.ocaml-compiler }} allow-prerelease-opam: true - dune-cache: true - run: opam install uri diff --git a/dist/index.js b/dist/index.js index d8f29a4e..7dd08c98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -110423,14 +110423,34 @@ async function saveCache(key, paths) { lib_core.warning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com for any ongoing issue in actions."); } } -async function restoreCygwinCache() { - return await lib_core.group("Retrieve the Cygwin cache", async () => { - const { key, restoreKeys } = await composeCygwinCacheKeys(); - const paths = composeCygwinCachePaths(); +async function restoreDuneCache() { + return await lib_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; +} +async function restoreOpamCaches() { + return await lib_core.group("Retrieve the opam cache", async () => { + const [opamCacheHit, cygwinCacheHit] = await Promise.all(PLATFORM === "windows" + ? [restoreOpamCache(), restoreCygwinCache()] + : [restoreOpamCache()]); + return { opamCacheHit, cygwinCacheHit }; + }); +} async function saveCygwinCache() { await lib_core.group("Save the Cygwin cache", async () => { const { key } = await composeCygwinCacheKeys(); @@ -110438,14 +110458,6 @@ async function saveCygwinCache() { await saveCache(key, paths); }); } -async function restoreDuneCache() { - return await lib_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 saveDuneCache() { await core.group("Save the dune cache", async () => { const { key } = composeDuneCacheKeys(); @@ -110453,14 +110465,6 @@ async function saveDuneCache() { await saveCache(key, paths); }); } -async function restoreOpamCache() { - return await lib_core.group("Retrieve the opam cache", async () => { - const { key, restoreKeys } = await composeOpamCacheKeys(); - const paths = composeOpamCachePaths(); - const cacheKey = await restoreCache(key, restoreKeys, paths); - return cacheKey; - }); -} async function saveOpamCache() { await lib_core.group("Save the opam cache", async () => { await (0,lib_exec.exec)("opam", [ @@ -110524,12 +110528,6 @@ async function getOpamLocalPackages() { -async function restoreOpamCaches() { - const [opamCacheHit, cygwinCacheHit] = await Promise.all(PLATFORM === "windows" - ? [restoreOpamCache(), restoreCygwinCache()] - : [restoreOpamCache()]); - return { opamCacheHit, cygwinCacheHit }; -} async function installer() { if (lib_core.isDebug()) { lib_core.exportVariable("OPAMVERBOSE", 1); diff --git a/dist/post/index.js b/dist/post/index.js index d336ed92..dfe090a0 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -84911,14 +84911,34 @@ async function saveCache(key, paths) { lib_core.warning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com for any ongoing issue in actions."); } } -async function restoreCygwinCache() { - return await core.group("Retrieve the Cygwin cache", async () => { - const { key, restoreKeys } = await composeCygwinCacheKeys(); - const paths = composeCygwinCachePaths(); +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; +} +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 }; + }); +} async function saveCygwinCache() { await core.group("Save the Cygwin cache", async () => { const { key } = await composeCygwinCacheKeys(); @@ -84926,14 +84946,6 @@ async function saveCygwinCache() { await saveCache(key, paths); }); } -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 saveDuneCache() { await lib_core.group("Save the dune cache", async () => { const { key } = composeDuneCacheKeys(); @@ -84941,14 +84953,6 @@ async function saveDuneCache() { await saveCache(key, paths); }); } -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; - }); -} async function saveOpamCache() { await core.group("Save the opam cache", async () => { await exec("opam", [ diff --git a/packages/setup-ocaml/src/cache.ts b/packages/setup-ocaml/src/cache.ts index bb8f465c..a4667981 100644 --- a/packages/setup-ocaml/src/cache.ts +++ b/packages/setup-ocaml/src/cache.ts @@ -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(); @@ -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(); @@ -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", [ diff --git a/packages/setup-ocaml/src/installer.ts b/packages/setup-ocaml/src/installer.ts index 2d5c9dbf..242ae012 100644 --- a/packages/setup-ocaml/src/installer.ts +++ b/packages/setup-ocaml/src/installer.ts @@ -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"; @@ -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);