Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the OCaml problem matcher #695

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 7 additions & 2 deletions dist/index.js

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

17 changes: 17 additions & 0 deletions matchers/ocaml.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "ocaml",
"pattern": [
{
"regexp": "^(\\bFile\\b\\s\"(.+)\",\\s\\bline\\b\\s(\\d+),\\s\\bcharacters\\b\\s(\\d+)\\b-\\b(\\d+):)$",
"message": 1,
"file": 2,
"line": 3,
"column": 4,
"loop": true
}
]
}
]
}
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
11 changes: 9 additions & 2 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 @@ -36,7 +37,6 @@ import { resolveCompiler } from "./version";
export async function installer() {
const platform = getPlatform();
const numberOfProcessors = os.cpus().length;
const isDebug = core.isDebug();
core.exportVariable("OPAMCLI", "2.0");
core.exportVariable("OPAMCOLOR", "always");
core.exportVariable("OPAMERRLOGLEN", 0);
Expand All @@ -45,7 +45,6 @@ export async function installer() {
// [todo] remove this line once we unlock opam 2.2
// https://github.com/ocaml/opam/issues/3447
core.exportVariable("OPAMSOLVERTIMEOUT", 1000);
core.exportVariable("OPAMVERBOSE", isDebug);
core.exportVariable("OPAMYES", 1);
if (platform === Platform.Win32) {
const opamRoot = path.join("D:", ".opam");
Expand Down Expand Up @@ -112,6 +111,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
Loading