From e28497016da8a1b339d20b87994ca711e9bdeda5 Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Wed, 13 Sep 2023 11:08:15 +0900 Subject: [PATCH] Add the OCaml problem matcher Signed-off-by: Sora Morimoto --- .github/ocaml.json | 21 +++++++++++++++++++++ CHANGELOG.md | 4 ++++ dist/index.js | 9 +++++++++ packages/setup-ocaml/src/installer.ts | 12 ++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 .github/ocaml.json diff --git a/.github/ocaml.json b/.github/ocaml.json new file mode 100644 index 00000000..8b0e4f06 --- /dev/null +++ b/.github/ocaml.json @@ -0,0 +1,21 @@ +{ + "problemMatcher": [ + { + "owner": "ocaml", + "pattern": [ + { + "regexp": "^File\\s\"(.+)\",\\sline\\s(\\d+),\\scharacters\\s(\\d+)-(\\d+):\\n((.|\\n)+?)(Error|Warning)\\s*(.*):\\s((.|\\n)+)$", + "kind": "location", + "file": 1, + "line": 2, + "column": 3, + "endLine": 2, + "endColumn": 4, + "severity": 7, + "code": 5, + "message": 10 + } + ] + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 58941fa5..6d44b8d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [unreleased] +### Added + +- Add the OCaml problem matcher. + ## [2.0.20] ### Changed diff --git a/dist/index.js b/dist/index.js index 829e39ec..600f3a6e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -102565,6 +102565,8 @@ const external_node_os_namespaceObject = require("node:os"); const external_node_path_namespaceObject = require("node:path"); ;// CONCATENATED MODULE: external "node:process" const external_node_process_namespaceObject = require("node:process"); +// EXTERNAL MODULE: ../../node_modules/@actions/core/lib/command.js +var command = __nccwpck_require__(29548); // EXTERNAL MODULE: ../../node_modules/@actions/exec/lib/exec.js var lib_exec = __nccwpck_require__(66473); // EXTERNAL MODULE: ../../node_modules/@actions/cache/lib/cache.js @@ -120781,6 +120783,7 @@ async function getOpamLocalPackages() { + async function installer() { const platform = getPlatform(); const numberOfProcessors = external_node_os_namespaceObject.cpus().length; @@ -120859,6 +120862,12 @@ async function installer() { } } } + lib_core.startGroup("Add the OCaml problem matcher"); + const ocamlMatcherPath = external_node_path_namespaceObject.join( + // eslint-disable-next-line unicorn/prefer-module + __dirname, "..", "..", ".github", "ocaml.json"); + (0,command.issueCommand)("add-matcher", {}, ocamlMatcherPath); + lib_core.endGroup(); await (0,lib_exec.exec)("opam", ["--version"]); if (OPAM_DEPEXT) { await (0,lib_exec.exec)("opam", ["depext", "--version"]); diff --git a/packages/setup-ocaml/src/installer.ts b/packages/setup-ocaml/src/installer.ts index 446f2007..c7ef2691 100644 --- a/packages/setup-ocaml/src/installer.ts +++ b/packages/setup-ocaml/src/installer.ts @@ -3,6 +3,7 @@ import * as path from "node:path"; import * as process from "node:process"; import * as core from "@actions/core"; +import { issueCommand } from "@actions/core/lib/command"; import { exec } from "@actions/exec"; import { @@ -112,6 +113,17 @@ export async function installer() { } } } + core.startGroup("Add the OCaml problem matcher"); + const ocamlMatcherPath = path.join( + // eslint-disable-next-line unicorn/prefer-module + __dirname, + "..", + "..", + ".github", + "ocaml.json", + ); + issueCommand("add-matcher", {}, ocamlMatcherPath); + core.endGroup(); await exec("opam", ["--version"]); if (OPAM_DEPEXT) { await exec("opam", ["depext", "--version"]);