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 <sora@morimoto.io>
Co-authored-by: Yuzuki Aida <dev@nzws.me>
  • Loading branch information
smorimoto and nzws committed Sep 15, 2023
1 parent 53b4999 commit f6393d8
Show file tree
Hide file tree
Showing 11 changed files with 297 additions and 10 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.

20 changes: 20 additions & 0 deletions dist/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
}
]
}
]
}
2 changes: 2 additions & 0 deletions packages/lint-doc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@ocaml/lint-doc",
"scripts": {
"clean": "shx rm -rf ../../lint-doc/dist",
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-doc/dist",
"format": "prettier . --write",
"format:check": "prettier . --check",
Expand All @@ -19,6 +20,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
2 changes: 2 additions & 0 deletions packages/lint-fmt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@ocaml/lint-fmt",
"scripts": {
"clean": "shx rm -rf ../../lint-fmt/dist",
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-fmt/dist",
"format": "prettier . --write",
"format:check": "prettier . --check",
Expand All @@ -19,6 +20,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
2 changes: 2 additions & 0 deletions packages/lint-opam/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@ocaml/lint-opam",
"scripts": {
"clean": "shx rm -rf ../../lint-opam/dist",
"build": "ncc build src/index.ts --license=LICENSE.txt --out ../../lint-opam/dist",
"format": "prettier . --write",
"format:check": "prettier . --check",
Expand All @@ -19,6 +20,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
6 changes: 5 additions & 1 deletion packages/setup-ocaml/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "@ocaml/setup-ocaml",
"scripts": {
"clean": "shx rm -rf ../../dist",
"copy:matchers": "shx mkdir -p ../../dist/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": "npm-run-all -p copy:matchers build:main build:post",
"format": "prettier . --write",
"format:check": "prettier . --check",
"lint": "TIMING=1 eslint .",
Expand Down Expand Up @@ -31,7 +33,9 @@
"@types/semver": "7.5.1",
"@vercel/ncc": "0.38.0",
"eslint": "8.49.0",
"npm-run-all": "4.1.5",
"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
}
]
}
]
}
5 changes: 4 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"]
"dependsOn": ["clean", "^build"]
},
"clean": {
"cache": false
},
"format": {},
"format:check": {},
Expand Down
Loading

0 comments on commit f6393d8

Please sign in to comment.