Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In nektos/act, disable sandboxing and set OPAMROOTISOK #737

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

### Removed

- Since decent official support is now available to deploy natively to GitHub Pages, `deploy-doc` has been deprecated and removed.
Expand Down
23 changes: 15 additions & 8 deletions dist/index.js

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

10 changes: 6 additions & 4 deletions dist/post/index.js

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

4 changes: 2 additions & 2 deletions packages/setup-ocaml/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down Expand Up @@ -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", {
Expand Down
9 changes: 7 additions & 2 deletions packages/setup-ocaml/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -35,18 +36,22 @@ 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");
}
core.exportVariable("OPAMCOLOR", "always");
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);
Expand Down
6 changes: 4 additions & 2 deletions packages/setup-ocaml/src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
// <https://github.com/ocaml/ocaml/issues/9131#issuecomment-599765888>
await exec("sudo", ["add-apt-repository", "ppa:avsm/musl"]);
}
Expand Down Expand Up @@ -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", [
Expand Down