Skip to content

Commit f6393d8

Browse files
smorimotonzws
andcommitted
Add the OCaml problem matcher
Signed-off-by: Sora Morimoto <[email protected]> Co-authored-by: Yuzuki Aida <[email protected]>
1 parent 53b4999 commit f6393d8

File tree

11 files changed

+297
-10
lines changed

11 files changed

+297
-10
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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)+?(?=(File\\s\".+\",\\sline\\s\\d+,\\scharacters\\s\\d+-\\d+:))|(.|\\n)+)",
8+
"file": 1,
9+
"line": 2,
10+
"endLine": 2,
11+
"column": 3,
12+
"endColumn": 4,
13+
"code": 5,
14+
"severity": 7,
15+
"message": 9
16+
}
17+
]
18+
}
19+
]
20+
}

packages/lint-doc/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@ocaml/lint-doc",
33
"scripts": {
4+
"clean": "shx rm -rf ../../lint-doc/dist",
45
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-doc/dist",
56
"format": "prettier . --write",
67
"format:check": "prettier . --check",
@@ -19,6 +20,7 @@
1920
"@vercel/ncc": "0.38.0",
2021
"eslint": "8.49.0",
2122
"prettier": "3.0.3",
23+
"shx": "0.3.4",
2224
"typescript": "5.2.2"
2325
},
2426
"private": true

packages/lint-fmt/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@ocaml/lint-fmt",
33
"scripts": {
4+
"clean": "shx rm -rf ../../lint-fmt/dist",
45
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-fmt/dist",
56
"format": "prettier . --write",
67
"format:check": "prettier . --check",
@@ -19,6 +20,7 @@
1920
"@vercel/ncc": "0.38.0",
2021
"eslint": "8.49.0",
2122
"prettier": "3.0.3",
23+
"shx": "0.3.4",
2224
"typescript": "5.2.2"
2325
},
2426
"private": true

packages/lint-opam/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@ocaml/lint-opam",
33
"scripts": {
4+
"clean": "shx rm -rf ../../lint-opam/dist",
45
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-opam/dist",
56
"format": "prettier . --write",
67
"format:check": "prettier . --check",
@@ -19,6 +20,7 @@
1920
"@vercel/ncc": "0.38.0",
2021
"eslint": "8.49.0",
2122
"prettier": "3.0.3",
23+
"shx": "0.3.4",
2224
"typescript": "5.2.2"
2325
},
2426
"private": true

packages/setup-ocaml/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"name": "@ocaml/setup-ocaml",
33
"scripts": {
4+
"clean": "shx rm -rf ../../dist",
5+
"copy:matchers": "shx mkdir -p ../../dist/matchers && shx cp -r src/matchers ../../dist",
46
"build:main": "ncc build src/index.ts --license=LICENSE.txt --out ../../dist",
57
"build:post": "ncc build src/post.ts --license=LICENSE.txt --out ../../dist/post",
6-
"build": "yarn build:main & yarn build:post",
8+
"build": "npm-run-all -p copy:matchers build:main build:post",
79
"format": "prettier . --write",
810
"format:check": "prettier . --check",
911
"lint": "TIMING=1 eslint .",
@@ -31,7 +33,9 @@
3133
"@types/semver": "7.5.1",
3234
"@vercel/ncc": "0.38.0",
3335
"eslint": "8.49.0",
36+
"npm-run-all": "4.1.5",
3437
"prettier": "3.0.3",
38+
"shx": "0.3.4",
3539
"typescript": "5.2.2"
3640
},
3741
"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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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)+?(?=(File\\s\".+\",\\sline\\s\\d+,\\scharacters\\s\\d+-\\d+:))|(.|\\n)+)",
8+
"file": 1,
9+
"line": 2,
10+
"endLine": 2,
11+
"column": 3,
12+
"endColumn": 4,
13+
"code": 5,
14+
"severity": 7,
15+
"message": 9
16+
}
17+
]
18+
}
19+
]
20+
}

turbo.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"$schema": "https://turborepo.org/schema.json",
33
"pipeline": {
44
"build": {
5-
"dependsOn": ["^build"]
5+
"dependsOn": ["clean", "^build"]
6+
},
7+
"clean": {
8+
"cache": false
69
},
710
"format": {},
811
"format:check": {},

0 commit comments

Comments
 (0)