Skip to content

Commit

Permalink
Add the OCaml problem matcher
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
Co-authored-by: Yuzuki Aida <[email protected]>
  • Loading branch information
smorimoto and nzws committed Sep 15, 2023
1 parent 53b4999 commit b71f25c
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [unreleased]

### Added

- Add the OCaml problem matcher.

## [2.0.20]

### Changed
Expand Down
9 changes: 9 additions & 0 deletions dist/index.js

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

21 changes: 21 additions & 0 deletions dist/matchers/ocaml.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
4 changes: 3 additions & 1 deletion packages/setup-ocaml/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@ocaml/setup-ocaml",
"scripts": {
"copy:matchers": "shx cp -r src/matchers ../../dist",
"build:main": "ncc build src/index.ts --license=LICENSE.txt --out ../../dist",
"build:post": "ncc build src/post.ts --license=LICENSE.txt --out ../../dist/post",
"build": "yarn build:main & yarn build:post",
"build": "yarn copy:matchers & yarn build:main & yarn build:post",
"format": "prettier . --write",
"format:check": "prettier . --check",
"lint": "TIMING=1 eslint .",
Expand Down Expand Up @@ -32,6 +33,7 @@
"@vercel/ncc": "0.38.0",
"eslint": "8.49.0",
"prettier": "3.0.3",
"shx": "0.3.4",
"typescript": "5.2.2"
},
"private": true
Expand Down
10 changes: 10 additions & 0 deletions packages/setup-ocaml/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -112,6 +113,15 @@ export async function installer() {
}
}
}
core.startGroup("Add the OCaml problem matcher");
const ocamlMatcherPath = path.join(
// eslint-disable-next-line unicorn/prefer-module
__dirname,
"matchers",
"ocaml.json",
);
issueCommand("add-matcher", {}, ocamlMatcherPath);
core.endGroup();
await exec("opam", ["--version"]);
if (OPAM_DEPEXT) {
await exec("opam", ["depext", "--version"]);
Expand Down
20 changes: 20 additions & 0 deletions packages/setup-ocaml/src/matchers/ocaml.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"problemMatcher": [
{
"owner": "ocaml",
"pattern": [
{
"regexp": "^File\\s\"(.+)\",\\sline\\s(\\d+),\\scharacters\\s(\\d+)-(\\d+):\\n((.|\\n)+?)(Error|Warning)\\s*(.*):\\s((.|\\n)+?(?=(File\\s\".+\",\\sline\\s\\d+,\\scharacters\\s\\d+-\\d+:))|(.|\\n)+)",
"file": 1,
"line": 2,
"endLine": 2,
"column": 3,
"endColumn": 4,
"code": 5,
"severity": 7,
"message": 9
}
]
}
]
}
50 changes: 46 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ __metadata:
eslint: 8.49.0
prettier: 3.0.3
semver: 7.5.4
shx: 0.3.4
typescript: 5.2.2
yaml: 2.3.2
languageName: unknown
Expand Down Expand Up @@ -2303,7 +2304,7 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^7.1.3, glob@npm:^7.1.4":
"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4":
version: 7.2.3
resolution: "glob@npm:7.2.3"
dependencies:
Expand Down Expand Up @@ -2579,6 +2580,13 @@ __metadata:
languageName: node
linkType: hard

"interpret@npm:^1.0.0":
version: 1.4.0
resolution: "interpret@npm:1.4.0"
checksum: 2e5f51268b5941e4a17e4ef0575bc91ed0ab5f8515e3cf77486f7c14d13f3010df9c0959f37063dcc96e78d12dc6b0bb1b9e111cdfe69771f4656d2993d36155
languageName: node
linkType: hard

"ip@npm:^2.0.0":
version: 2.0.0
resolution: "ip@npm:2.0.0"
Expand Down Expand Up @@ -3114,7 +3122,7 @@ __metadata:
languageName: node
linkType: hard

"minimist@npm:^1.2.6":
"minimist@npm:^1.2.3, minimist@npm:^1.2.6":
version: 1.2.8
resolution: "minimist@npm:1.2.8"
checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0
Expand Down Expand Up @@ -3707,6 +3715,15 @@ __metadata:
languageName: node
linkType: hard

"rechoir@npm:^0.6.2":
version: 0.6.2
resolution: "rechoir@npm:0.6.2"
dependencies:
resolve: ^1.1.6
checksum: fe76bf9c21875ac16e235defedd7cbd34f333c02a92546142b7911a0f7c7059d2e16f441fe6fb9ae203f459c05a31b2bcf26202896d89e390eda7514d5d2702b
languageName: node
linkType: hard

"regenerator-runtime@npm:^0.14.0":
version: 0.14.0
resolution: "regenerator-runtime@npm:0.14.0"
Expand Down Expand Up @@ -3759,7 +3776,7 @@ __metadata:
languageName: node
linkType: hard

"resolve@npm:^1.10.0, resolve@npm:^1.22.4":
"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.22.4":
version: 1.22.4
resolution: "resolve@npm:1.22.4"
dependencies:
Expand All @@ -3772,7 +3789,7 @@ __metadata:
languageName: node
linkType: hard

"resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.4#~builtin<compat/resolve>":
"resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.4#~builtin<compat/resolve>":
version: 1.22.4
resolution: "resolve@patch:resolve@npm%3A1.22.4#~builtin<compat/resolve>::version=1.22.4&hash=c3c19d"
dependencies:
Expand Down Expand Up @@ -3933,6 +3950,31 @@ __metadata:
languageName: node
linkType: hard

"shelljs@npm:^0.8.5":
version: 0.8.5
resolution: "shelljs@npm:0.8.5"
dependencies:
glob: ^7.0.0
interpret: ^1.0.0
rechoir: ^0.6.2
bin:
shjs: bin/shjs
checksum: 7babc46f732a98f4c054ec1f048b55b9149b98aa2da32f6cf9844c434b43c6251efebd6eec120937bd0999e13811ebd45efe17410edb3ca938f82f9381302748
languageName: node
linkType: hard

"shx@npm:0.3.4":
version: 0.3.4
resolution: "shx@npm:0.3.4"
dependencies:
minimist: ^1.2.3
shelljs: ^0.8.5
bin:
shx: lib/cli.js
checksum: 0aa168bfddc11e3fe8943cce2e0d2d8514a560bd58cf2b835b4351ba03f46068f7d88286c2627f4b85604e81952154c43746369fb3f0d60df0e3b511f465e5b8
languageName: node
linkType: hard

"side-channel@npm:^1.0.4":
version: 1.0.4
resolution: "side-channel@npm:1.0.4"
Expand Down

0 comments on commit b71f25c

Please sign in to comment.