diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d1d84e..33bfb078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to - Add opam support for the Dependency submission API. +### Fixed + +- Fix opam calls to support testing GitHub actions in local containers by using the act tool from [`nektos/act`](https://github.com/nektos/act). + ## [2.1.8] ### Fixed @@ -557,34 +561,20 @@ that require it. [2.0.2]: https://github.com/ocaml/setup-ocaml/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta13...v2.0.0 -[2.0.0-beta13]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta12...v2.0.0-beta13 -[2.0.0-beta12]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta11...v2.0.0-beta12 -[2.0.0-beta11]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta10...v2.0.0-beta11 -[2.0.0-beta10]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta9...v2.0.0-beta10 -[2.0.0-beta9]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta8...v2.0.0-beta9 -[2.0.0-beta8]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta7...v2.0.0-beta8 -[2.0.0-beta7]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta6...v2.0.0-beta7 -[2.0.0-beta6]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta5...v2.0.0-beta6 -[2.0.0-beta5]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta4...v2.0.0-beta5 -[2.0.0-beta4]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta3...v2.0.0-beta4 -[2.0.0-beta3]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta2...v2.0.0-beta3 -[2.0.0-beta2]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta...v2.0.0-beta2 -[2.0.0-beta]: - https://github.com/ocaml/setup-ocaml/compare/v2.0.0-alpha...v2.0.0-beta -[2.0.0-alpha]: - https://github.com/ocaml/setup-ocaml/compare/v1.1.11...v2.0.0-alpha +[2.0.0-beta13]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta12...v2.0.0-beta13 +[2.0.0-beta12]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta11...v2.0.0-beta12 +[2.0.0-beta11]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta10...v2.0.0-beta11 +[2.0.0-beta10]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta9...v2.0.0-beta10 +[2.0.0-beta9]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta8...v2.0.0-beta9 +[2.0.0-beta8]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta7...v2.0.0-beta8 +[2.0.0-beta7]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta6...v2.0.0-beta7 +[2.0.0-beta6]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta5...v2.0.0-beta6 +[2.0.0-beta5]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta4...v2.0.0-beta5 +[2.0.0-beta4]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta3...v2.0.0-beta4 +[2.0.0-beta3]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta2...v2.0.0-beta3 +[2.0.0-beta2]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-beta...v2.0.0-beta2 +[2.0.0-beta]: https://github.com/ocaml/setup-ocaml/compare/v2.0.0-alpha...v2.0.0-beta +[2.0.0-alpha]: https://github.com/ocaml/setup-ocaml/compare/v1.1.11...v2.0.0-alpha [1.1.11]: https://github.com/ocaml/setup-ocaml/compare/v1.1.10...v1.1.11 [1.1.10]: https://github.com/ocaml/setup-ocaml/compare/v1.1.9...v1.1.10 [1.1.9]: https://github.com/ocaml/setup-ocaml/compare/v1.1.8...v1.1.9 diff --git a/dist/index.js b/dist/index.js index ecb050b0..80027f80 100644 --- a/dist/index.js +++ b/dist/index.js @@ -126838,10 +126838,10 @@ const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path"); // EXTERNAL MODULE: ../../node_modules/@actions/exec/lib/exec.js var lib_exec = __nccwpck_require__(66473); -// EXTERNAL MODULE: ../../node_modules/@actions/cache/lib/cache.js -var cache = __nccwpck_require__(86930); // EXTERNAL MODULE: ../../node_modules/@actions/github/lib/github.js var lib_github = __nccwpck_require__(84005); +// EXTERNAL MODULE: ../../node_modules/@actions/cache/lib/cache.js +var cache = __nccwpck_require__(86930); // EXTERNAL MODULE: ../../node_modules/date-fns/index.js var date_fns = __nccwpck_require__(61223); // EXTERNAL MODULE: ../../node_modules/yaml/dist/index.js @@ -126883,7 +126883,7 @@ const PLATFORM = (() => { const CYGWIN_ROOT = external_node_path_namespaceObject.join("D:", "cygwin"); const CYGWIN_ROOT_BIN = external_node_path_namespaceObject.join(CYGWIN_ROOT, "bin"); const CYGWIN_ROOT_WRAPPERBIN = external_node_path_namespaceObject.join(CYGWIN_ROOT, "wrapperbin"); -// [todo] remove the branch for Windows once opam 2.2 is released as stable. +// [TODO] remove the branch for Windows once opam 2.2 is released as stable. const ALLOW_PRERELEASE_OPAM = PLATFORM !== "win32" && lib_core.getBooleanInput("allow-prerelease-opam", { required: false, @@ -126905,7 +126905,7 @@ const OCAML_COMPILER = lib_core.getInput("ocaml-compiler", { required: true, trimWhitespace: true, }); -// [todo] remove this once opam 2.2 is released as stable. +// [TODO] remove this once opam 2.2 is released as stable. const OPAM_DEPEXT = !ALLOW_PRERELEASE_OPAM && lib_core.getBooleanInput("opam-depext", { required: false, @@ -144366,7 +144366,7 @@ async function installUnixSystemPackages() { if (PLATFORM === "linux") { const { version: systemVersion } = await getSystemIdentificationInfo(); if (systemVersion === "18.04") { - // [info]: musl-tools bug in ubuntu 18.04; + // [INFO]: musl-tools bug in ubuntu 18.04; // await (0,lib_exec.exec)("sudo", ["add-apt-repository", "ppa:avsm/musl"]); } @@ -144400,7 +144400,9 @@ async function initializeOpamUnix() { await installUnixSystemPackages(); } const disableSandboxing = []; - if (OPAM_DISABLE_SANDBOXING) { + // [NOTE] fix opam to run in act containers which have no "/dev/pts" for + // bubblewrap: + if (OPAM_DISABLE_SANDBOXING || lib_github.context.actor === "nektos/act") { disableSandboxing.push("--disable-sandboxing"); } await (0,lib_exec.exec)("opam", [ @@ -145033,12 +145035,17 @@ async function getOpamLocalPackages() { + async function installer() { + // [NOTE] silence opam warnings triggered in act containers using root + if (lib_github.context.actor === "nektos/act") { + lib_core.exportVariable("OPAMROOTISOK", 1); + } if (ALLOW_PRERELEASE_OPAM) { lib_core.exportVariable("OPAMCONFIRMLEVEL", "unsafe-yes"); } else { - // [todo] remove this once opam 2.2 is released as stable. + // [TODO] remove this once opam 2.2 is released as stable. // https://github.com/ocaml/setup-ocaml/issues/299 lib_core.exportVariable("OPAMCLI", "2.0"); } @@ -145046,7 +145053,7 @@ async function installer() { lib_core.exportVariable("OPAMERRLOGLEN", 0); lib_core.exportVariable("OPAMJOBS", external_node_os_namespaceObject.cpus().length); lib_core.exportVariable("OPAMPRECISETRACKING", 1); - // [todo] remove this once opam 2.2 is released as stable. + // [TODO] remove this once opam 2.2 is released as stable. // https://github.com/ocaml/opam/issues/3447 lib_core.exportVariable("OPAMSOLVERTIMEOUT", 1000); lib_core.exportVariable("OPAMYES", 1); diff --git a/dist/post/index.js b/dist/post/index.js index 17745e34..f0796477 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -125701,7 +125701,7 @@ const constants_PLATFORM = (() => { const constants_CYGWIN_ROOT = external_node_path_namespaceObject.join("D:", "cygwin"); const constants_CYGWIN_ROOT_BIN = external_node_path_namespaceObject.join(constants_CYGWIN_ROOT, "bin"); const constants_CYGWIN_ROOT_WRAPPERBIN = external_node_path_namespaceObject.join(constants_CYGWIN_ROOT, "wrapperbin"); -// [todo] remove the branch for Windows once opam 2.2 is released as stable. +// [TODO] remove the branch for Windows once opam 2.2 is released as stable. const constants_ALLOW_PRERELEASE_OPAM = constants_PLATFORM !== "win32" && lib_core.getBooleanInput("allow-prerelease-opam", { required: false, @@ -125723,7 +125723,7 @@ const constants_OCAML_COMPILER = lib_core.getInput("ocaml-compiler", { required: true, trimWhitespace: true, }); -// [todo] remove this once opam 2.2 is released as stable. +// [TODO] remove this once opam 2.2 is released as stable. const constants_OPAM_DEPEXT = !constants_ALLOW_PRERELEASE_OPAM && lib_core.getBooleanInput("opam-depext", { required: false, @@ -143184,7 +143184,7 @@ async function installUnixSystemPackages() { if (PLATFORM === "linux") { const { version: systemVersion } = await getSystemIdentificationInfo(); if (systemVersion === "18.04") { - // [info]: musl-tools bug in ubuntu 18.04; + // [INFO]: musl-tools bug in ubuntu 18.04; // await exec("sudo", ["add-apt-repository", "ppa:avsm/musl"]); } @@ -143218,7 +143218,9 @@ async function initializeOpamUnix() { await installUnixSystemPackages(); } const disableSandboxing = []; - if (OPAM_DISABLE_SANDBOXING) { + // [NOTE] fix opam to run in act containers which have no "/dev/pts" for + // bubblewrap: + if (OPAM_DISABLE_SANDBOXING || github.context.actor === "nektos/act") { disableSandboxing.push("--disable-sandboxing"); } await exec("opam", [ diff --git a/packages/setup-ocaml/src/constants.ts b/packages/setup-ocaml/src/constants.ts index 1876da7d..f3ed7de0 100644 --- a/packages/setup-ocaml/src/constants.ts +++ b/packages/setup-ocaml/src/constants.ts @@ -41,7 +41,7 @@ export const CYGWIN_ROOT_BIN = path.join(CYGWIN_ROOT, "bin"); export const CYGWIN_ROOT_WRAPPERBIN = path.join(CYGWIN_ROOT, "wrapperbin"); -// [todo] remove the branch for Windows once opam 2.2 is released as stable. +// [TODO] remove the branch for Windows once opam 2.2 is released as stable. export const ALLOW_PRERELEASE_OPAM = PLATFORM !== "win32" && core.getBooleanInput("allow-prerelease-opam", { @@ -69,7 +69,7 @@ export const OCAML_COMPILER = core.getInput("ocaml-compiler", { trimWhitespace: true, }); -// [todo] remove this once opam 2.2 is released as stable. +// [TODO] remove this once opam 2.2 is released as stable. export const OPAM_DEPEXT = !ALLOW_PRERELEASE_OPAM && core.getBooleanInput("opam-depext", { diff --git a/packages/setup-ocaml/src/installer.ts b/packages/setup-ocaml/src/installer.ts index 478b56ab..ec8afd60 100644 --- a/packages/setup-ocaml/src/installer.ts +++ b/packages/setup-ocaml/src/installer.ts @@ -4,6 +4,7 @@ import * as process from "node:process"; import * as core from "@actions/core"; import { exec } from "@actions/exec"; +import * as github from "@actions/github"; import { restoreCygwinCache, @@ -35,10 +36,14 @@ import { updateUnixPackageIndexFiles } from "./system.js"; import { resolveCompiler } from "./version.js"; export async function installer() { + // [NOTE] silence opam warnings triggered in act containers using root + if (github.context.actor === "nektos/act") { + core.exportVariable("OPAMROOTISOK", 1); + } if (ALLOW_PRERELEASE_OPAM) { core.exportVariable("OPAMCONFIRMLEVEL", "unsafe-yes"); } else { - // [todo] remove this once opam 2.2 is released as stable. + // [TODO] remove this once opam 2.2 is released as stable. // https://github.com/ocaml/setup-ocaml/issues/299 core.exportVariable("OPAMCLI", "2.0"); } @@ -46,7 +51,7 @@ export async function installer() { core.exportVariable("OPAMERRLOGLEN", 0); core.exportVariable("OPAMJOBS", os.cpus().length); core.exportVariable("OPAMPRECISETRACKING", 1); - // [todo] remove this once opam 2.2 is released as stable. + // [TODO] remove this once opam 2.2 is released as stable. // https://github.com/ocaml/opam/issues/3447 core.exportVariable("OPAMSOLVERTIMEOUT", 1000); core.exportVariable("OPAMYES", 1); diff --git a/packages/setup-ocaml/src/opam.ts b/packages/setup-ocaml/src/opam.ts index 6a670a5d..f91e5444 100644 --- a/packages/setup-ocaml/src/opam.ts +++ b/packages/setup-ocaml/src/opam.ts @@ -103,7 +103,7 @@ async function installUnixSystemPackages() { if (PLATFORM === "linux") { const { version: systemVersion } = await getSystemIdentificationInfo(); if (systemVersion === "18.04") { - // [info]: musl-tools bug in ubuntu 18.04; + // [INFO]: musl-tools bug in ubuntu 18.04; // await exec("sudo", ["add-apt-repository", "ppa:avsm/musl"]); } @@ -138,7 +138,9 @@ async function initializeOpamUnix() { await installUnixSystemPackages(); } const disableSandboxing = []; - if (OPAM_DISABLE_SANDBOXING) { + // [NOTE] fix opam to run in act containers which have no "/dev/pts" for + // bubblewrap: + if (OPAM_DISABLE_SANDBOXING || github.context.actor === "nektos/act") { disableSandboxing.push("--disable-sandboxing"); } await exec("opam", [