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 16, 2023
1 parent 53b4999 commit eb4dfe9
Show file tree
Hide file tree
Showing 11 changed files with 271 additions and 11 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
7 changes: 7 additions & 0 deletions dist/index.js

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

16 changes: 16 additions & 0 deletions matchers/ocaml.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "ocaml",
"pattern": [
{
"regexp": "^File\\s\"(.+)\",\\sline\\s(\\d+),\\scharacters\\s(\\d+)-(\\d+):$",
"message": -1,
"file": 1,
"line": 2,
"column": 3
}
]
}
]
}
3 changes: 2 additions & 1 deletion monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
{ "name": "lint-doc", "path": "lint-doc" },
{ "name": "lint-fmt", "path": "lint-fmt" },
{ "name": "lint-opam", "path": "lint-opam" },
{ "name": "matchers", "path": "matchers" },
{ "name": "eslint-config-ocaml", "path": "packages/eslint-config-ocaml" },
{ "name": "packages/lint-doc", "path": "packages/lint-doc" },
{ "name": "packages/lint-fmt", "path": "packages/lint-fmt" },
{ "name": "packages/lint-opam", "path": "packages/lint-opam" },
{ "name": "packages/setup-ocaml", "path": "packages/setup-ocaml" },
{ "name": "eslint-config-ocaml", "path": "packages/eslint-config-ocaml" },
{ "name": "root", "path": "." }
],
"settings": {
Expand Down
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
5 changes: 4 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": {
"clean": "shx rm -rf ../../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 build:main build:post",
"format": "prettier . --write",
"format:check": "prettier . --check",
"lint": "TIMING=1 eslint .",
Expand Down Expand Up @@ -31,7 +32,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
9 changes: 9 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,14 @@ export async function installer() {
}
}
}
const ocamlMatcherPath = path.join(
// eslint-disable-next-line unicorn/prefer-module
__dirname,
"..",
"matchers",
"ocaml.json",
);
issueCommand("add-matcher", {}, ocamlMatcherPath);
await exec("opam", ["--version"]);
if (OPAM_DEPEXT) {
await exec("opam", ["depext", "--version"]);
Expand Down
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 eb4dfe9

Please sign in to comment.