From f11536f53bde7b84bcdf79cb6aceafd1bac50ae2 Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Fri, 14 Jun 2024 10:23:10 +0900 Subject: [PATCH] _ Signed-off-by: Sora Morimoto --- dist/index.js | 29 +++++++++++++++++++-------- dist/post/index.js | 27 ++++++++++++++++++------- packages/setup-ocaml/src/constants.ts | 25 +++++++++++++++++------ packages/setup-ocaml/src/installer.ts | 2 +- 4 files changed, 61 insertions(+), 22 deletions(-) diff --git a/dist/index.js b/dist/index.js index e1f2b5c3..92d8aec2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -92558,26 +92558,39 @@ var dist = __nccwpck_require__(8447); + const ARCHITECTURE = (() => { - switch (external_node_os_.arch()) { - case "x64": { - return "x86_64"; + switch (external_node_process_.arch) { + case "arm": { + return "armhf"; } case "arm64": { return "arm64"; } + case "s390x": { + return "s390x"; + } + case "x64": { + return "x86_64"; + } default: { throw new Error("The architecture is not supported."); } } })(); const PLATFORM = (() => { - switch (external_node_os_.platform()) { + switch (external_node_process_.platform) { + case "darwin": { + return "macos"; + } + case "freebsd": { + return "freebsd"; + } case "linux": { return "linux"; } - case "darwin": { - return "macos"; + case "openbsd": { + return "openbsd"; } case "win32": { return "windows"; @@ -92597,7 +92610,7 @@ const DUNE_CACHE_ROOT = (() => { const duneCacheDir = external_node_path_namespaceObject.join("D:", "dune"); return duneCacheDir; } - const xdgCacheHome = process.env.XDG_CACHE_HOME; + const xdgCacheHome = external_node_process_.env.XDG_CACHE_HOME; const duneCacheDir = xdgCacheHome ? external_node_path_namespaceObject.join(xdgCacheHome, "dune") : external_node_path_namespaceObject.join(homeDir, ".cache", "dune"); @@ -110534,7 +110547,7 @@ async function installer() { } lib_core.exportVariable("OPAMCOLOR", "always"); lib_core.exportVariable("OPAMCONFIRMLEVEL", "unsafe-yes"); - lib_core.exportVariable("OPAMDOWNLOADJOBS", external_node_os_.cpus().length * 2); + lib_core.exportVariable("OPAMDOWNLOADJOBS", external_node_os_.availableParallelism()); lib_core.exportVariable("OPAMERRLOGLEN", 0); lib_core.exportVariable("OPAMPRECISETRACKING", 1); lib_core.exportVariable("OPAMROOT", OPAM_ROOT); diff --git a/dist/post/index.js b/dist/post/index.js index dfe090a0..a0b76642 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -84692,26 +84692,39 @@ var dist = __nccwpck_require__(8447); + const constants_ARCHITECTURE = (() => { - switch (external_node_os_.arch()) { - case "x64": { - return "x86_64"; + switch (external_node_process_.arch) { + case "arm": { + return "armhf"; } case "arm64": { return "arm64"; } + case "s390x": { + return "s390x"; + } + case "x64": { + return "x86_64"; + } default: { throw new Error("The architecture is not supported."); } } })(); const constants_PLATFORM = (() => { - switch (external_node_os_.platform()) { + switch (external_node_process_.platform) { + case "darwin": { + return "macos"; + } + case "freebsd": { + return "freebsd"; + } case "linux": { return "linux"; } - case "darwin": { - return "macos"; + case "openbsd": { + return "openbsd"; } case "win32": { return "windows"; @@ -84731,7 +84744,7 @@ const DUNE_CACHE_ROOT = (() => { const duneCacheDir = external_node_path_namespaceObject.join("D:", "dune"); return duneCacheDir; } - const xdgCacheHome = process.env.XDG_CACHE_HOME; + const xdgCacheHome = external_node_process_.env.XDG_CACHE_HOME; const duneCacheDir = xdgCacheHome ? external_node_path_namespaceObject.join(xdgCacheHome, "dune") : external_node_path_namespaceObject.join(homeDir, ".cache", "dune"); diff --git a/packages/setup-ocaml/src/constants.ts b/packages/setup-ocaml/src/constants.ts index b9232f90..88b0a458 100644 --- a/packages/setup-ocaml/src/constants.ts +++ b/packages/setup-ocaml/src/constants.ts @@ -1,16 +1,23 @@ import * as os from "node:os"; import * as path from "node:path"; +import * as process from "node:process"; import * as core from "@actions/core"; import * as yaml from "yaml"; export const ARCHITECTURE = (() => { - switch (os.arch()) { - case "x64": { - return "x86_64"; + switch (process.arch) { + case "arm": { + return "armhf"; } case "arm64": { return "arm64"; } + case "s390x": { + return "s390x"; + } + case "x64": { + return "x86_64"; + } default: { throw new Error("The architecture is not supported."); } @@ -18,12 +25,18 @@ export const ARCHITECTURE = (() => { })(); export const PLATFORM = (() => { - switch (os.platform()) { + switch (process.platform) { + case "darwin": { + return "macos"; + } + case "freebsd": { + return "freebsd"; + } case "linux": { return "linux"; } - case "darwin": { - return "macos"; + case "openbsd": { + return "openbsd"; } case "win32": { return "windows"; diff --git a/packages/setup-ocaml/src/installer.ts b/packages/setup-ocaml/src/installer.ts index 8d344590..494d4a44 100644 --- a/packages/setup-ocaml/src/installer.ts +++ b/packages/setup-ocaml/src/installer.ts @@ -36,7 +36,7 @@ export async function installer() { } core.exportVariable("OPAMCOLOR", "always"); core.exportVariable("OPAMCONFIRMLEVEL", "unsafe-yes"); - core.exportVariable("OPAMDOWNLOADJOBS", os.cpus().length * 2); + core.exportVariable("OPAMDOWNLOADJOBS", os.availableParallelism()); core.exportVariable("OPAMERRLOGLEN", 0); core.exportVariable("OPAMPRECISETRACKING", 1); core.exportVariable("OPAMROOT", OPAM_ROOT);