Skip to content

Commit b3492b9

Browse files
committed
Add the OCaml problem matcher
Signed-off-by: Sora Morimoto <[email protected]>
1 parent 53b4999 commit b3492b9

File tree

7 files changed

+114
-5
lines changed

7 files changed

+114
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to
88

99
## [unreleased]
1010

11+
### Added
12+
13+
- Add the OCaml problem matcher.
14+
1115
## [2.0.20]
1216

1317
### Changed

dist/index.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/matchers/ocaml.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "ocaml",
5+
"pattern": [
6+
{
7+
"regexp": "^File\\s\"(.+)\",\\sline\\s(\\d+),\\scharacters\\s(\\d+)-(\\d+):\\n((.|\\n)+?)(Error|Warning)\\s*(.*):\\s((.|\\n)+)$",
8+
"kind": "location",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"endLine": 2,
13+
"endColumn": 4,
14+
"severity": 7,
15+
"code": 5,
16+
"message": 10
17+
}
18+
]
19+
}
20+
]
21+
}

packages/setup-ocaml/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "@ocaml/setup-ocaml",
33
"scripts": {
4+
"copy:matchers": "shx cp -r src/matchers ../../dist",
45
"build:main": "ncc build src/index.ts --license=LICENSE.txt --out ../../dist",
56
"build:post": "ncc build src/post.ts --license=LICENSE.txt --out ../../dist/post",
6-
"build": "yarn build:main & yarn build:post",
7+
"build": "yarn copy:matchers && yarn build:main & yarn build:post",
78
"format": "prettier . --write",
89
"format:check": "prettier . --check",
910
"lint": "TIMING=1 eslint .",
@@ -32,6 +33,7 @@
3233
"@vercel/ncc": "0.38.0",
3334
"eslint": "8.49.0",
3435
"prettier": "3.0.3",
36+
"shx": "0.3.4",
3537
"typescript": "5.2.2"
3638
},
3739
"private": true

packages/setup-ocaml/src/installer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "node:path";
33
import * as process from "node:process";
44

55
import * as core from "@actions/core";
6+
import { issueCommand } from "@actions/core/lib/command";
67
import { exec } from "@actions/exec";
78

89
import {
@@ -112,6 +113,15 @@ export async function installer() {
112113
}
113114
}
114115
}
116+
core.startGroup("Add the OCaml problem matcher");
117+
const ocamlMatcherPath = path.join(
118+
// eslint-disable-next-line unicorn/prefer-module
119+
__dirname,
120+
"matchers",
121+
"ocaml.json",
122+
);
123+
issueCommand("add-matcher", {}, ocamlMatcherPath);
124+
core.endGroup();
115125
await exec("opam", ["--version"]);
116126
if (OPAM_DEPEXT) {
117127
await exec("opam", ["depext", "--version"]);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "ocaml",
5+
"pattern": [
6+
{
7+
"regexp": "^File\\s\"(.+)\",\\sline\\s(\\d+),\\scharacters\\s(\\d+)-(\\d+):\\n((.|\\n)+?)(Error|Warning)\\s*(.*):\\s((.|\\n)+)$",
8+
"kind": "location",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"endLine": 2,
13+
"endColumn": 4,
14+
"severity": 7,
15+
"code": 5,
16+
"message": 10
17+
}
18+
]
19+
}
20+
]
21+
}

yarn.lock

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ __metadata:
484484
eslint: 8.49.0
485485
prettier: 3.0.3
486486
semver: 7.5.4
487+
shx: 0.3.4
487488
typescript: 5.2.2
488489
yaml: 2.3.2
489490
languageName: unknown
@@ -2303,7 +2304,7 @@ __metadata:
23032304
languageName: node
23042305
linkType: hard
23052306

2306-
"glob@npm:^7.1.3, glob@npm:^7.1.4":
2307+
"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4":
23072308
version: 7.2.3
23082309
resolution: "glob@npm:7.2.3"
23092310
dependencies:
@@ -2579,6 +2580,13 @@ __metadata:
25792580
languageName: node
25802581
linkType: hard
25812582

2583+
"interpret@npm:^1.0.0":
2584+
version: 1.4.0
2585+
resolution: "interpret@npm:1.4.0"
2586+
checksum: 2e5f51268b5941e4a17e4ef0575bc91ed0ab5f8515e3cf77486f7c14d13f3010df9c0959f37063dcc96e78d12dc6b0bb1b9e111cdfe69771f4656d2993d36155
2587+
languageName: node
2588+
linkType: hard
2589+
25822590
"ip@npm:^2.0.0":
25832591
version: 2.0.0
25842592
resolution: "ip@npm:2.0.0"
@@ -3114,7 +3122,7 @@ __metadata:
31143122
languageName: node
31153123
linkType: hard
31163124

3117-
"minimist@npm:^1.2.6":
3125+
"minimist@npm:^1.2.3, minimist@npm:^1.2.6":
31183126
version: 1.2.8
31193127
resolution: "minimist@npm:1.2.8"
31203128
checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0
@@ -3707,6 +3715,15 @@ __metadata:
37073715
languageName: node
37083716
linkType: hard
37093717

3718+
"rechoir@npm:^0.6.2":
3719+
version: 0.6.2
3720+
resolution: "rechoir@npm:0.6.2"
3721+
dependencies:
3722+
resolve: ^1.1.6
3723+
checksum: fe76bf9c21875ac16e235defedd7cbd34f333c02a92546142b7911a0f7c7059d2e16f441fe6fb9ae203f459c05a31b2bcf26202896d89e390eda7514d5d2702b
3724+
languageName: node
3725+
linkType: hard
3726+
37103727
"regenerator-runtime@npm:^0.14.0":
37113728
version: 0.14.0
37123729
resolution: "regenerator-runtime@npm:0.14.0"
@@ -3759,7 +3776,7 @@ __metadata:
37593776
languageName: node
37603777
linkType: hard
37613778

3762-
"resolve@npm:^1.10.0, resolve@npm:^1.22.4":
3779+
"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.22.4":
37633780
version: 1.22.4
37643781
resolution: "resolve@npm:1.22.4"
37653782
dependencies:
@@ -3772,7 +3789,7 @@ __metadata:
37723789
languageName: node
37733790
linkType: hard
37743791

3775-
"resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.4#~builtin<compat/resolve>":
3792+
"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>":
37763793
version: 1.22.4
37773794
resolution: "resolve@patch:resolve@npm%3A1.22.4#~builtin<compat/resolve>::version=1.22.4&hash=c3c19d"
37783795
dependencies:
@@ -3933,6 +3950,31 @@ __metadata:
39333950
languageName: node
39343951
linkType: hard
39353952

3953+
"shelljs@npm:^0.8.5":
3954+
version: 0.8.5
3955+
resolution: "shelljs@npm:0.8.5"
3956+
dependencies:
3957+
glob: ^7.0.0
3958+
interpret: ^1.0.0
3959+
rechoir: ^0.6.2
3960+
bin:
3961+
shjs: bin/shjs
3962+
checksum: 7babc46f732a98f4c054ec1f048b55b9149b98aa2da32f6cf9844c434b43c6251efebd6eec120937bd0999e13811ebd45efe17410edb3ca938f82f9381302748
3963+
languageName: node
3964+
linkType: hard
3965+
3966+
"shx@npm:0.3.4":
3967+
version: 0.3.4
3968+
resolution: "shx@npm:0.3.4"
3969+
dependencies:
3970+
minimist: ^1.2.3
3971+
shelljs: ^0.8.5
3972+
bin:
3973+
shx: lib/cli.js
3974+
checksum: 0aa168bfddc11e3fe8943cce2e0d2d8514a560bd58cf2b835b4351ba03f46068f7d88286c2627f4b85604e81952154c43746369fb3f0d60df0e3b511f465e5b8
3975+
languageName: node
3976+
linkType: hard
3977+
39363978
"side-channel@npm:^1.0.4":
39373979
version: 1.0.4
39383980
resolution: "side-channel@npm:1.0.4"

0 commit comments

Comments
 (0)