Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions dist/index.js

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

19 changes: 9 additions & 10 deletions dist/post/index.js

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

20 changes: 10 additions & 10 deletions packages/setup-ocaml/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function composeCygwinCacheKeys() {
async function composeDuneCacheKeys() {
const { workflow, job, runId } = github.context;
const ocamlCompiler = await RESOLVED_COMPILER;
const plainKey = [ocamlCompiler, workflow, job].join(",");
const plainKey = [ocamlCompiler, workflow, job].join();
const hash = crypto.createHash("sha256").update(plainKey).digest("hex");
const key = `${CACHE_PREFIX}-setup-ocaml-dune-${PLATFORM}-${ARCHITECTURE}-${hash}-${runId}`;
const restoreKeys = [
Expand All @@ -48,7 +48,7 @@ async function composeOpamCacheKeys() {
const { version: opamVersion } = await retrieveLatestOpamRelease();
const sandbox = OPAM_DISABLE_SANDBOXING ? "nosandbox" : "sandbox";
const ocamlCompiler = await RESOLVED_COMPILER;
const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join(",");
const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join();
const osInfo = await system.osInfo();
const plainKey = [
PLATFORM,
Expand All @@ -58,7 +58,7 @@ async function composeOpamCacheKeys() {
ocamlCompiler,
repositoryUrls,
sandbox,
].join(",");
].join();
const hash = crypto.createHash("sha256").update(plainKey).digest("hex");
const key = `${CACHE_PREFIX}-setup-ocaml-opam-${hash}`;
const restoreKeys = [key];
Expand All @@ -67,9 +67,10 @@ async function composeOpamCacheKeys() {
}

async function composeOpamDownloadCacheKeys() {
const isWin = PLATFORM === "windows";
const ocamlCompiler = await RESOLVED_COMPILER;
const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join(",");
const plainKey = [ocamlCompiler, repositoryUrls].join(",");
const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join();
const plainKey = [isWin, ocamlCompiler, repositoryUrls].join();
const hash = crypto.createHash("sha256").update(plainKey).digest("hex");
const { runId } = github.context;
const key = `${CACHE_PREFIX}-setup-ocaml-opam-download-${hash}-${runId}`;
Expand Down Expand Up @@ -121,12 +122,11 @@ function composeOpamCachePaths() {
}

function composeOpamDownloadCachePaths() {
if (PLATFORM === "windows") {
const opamDownloadCachePath = path.join("D:", ".opam", "download-cache");
return [opamDownloadCachePath];
}
const homeDir = os.homedir();
const opamDownloadCachePath = path.join(homeDir, ".opam", "download-cache");
const opamDownloadCachePath =
PLATFORM === "windows"
? path.join("D:", ".opam", "download-cache")
: path.join(homeDir, ".opam", "download-cache");
return [opamDownloadCachePath];
}

Expand Down
Loading