Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 033d01b

Browse files
authored
feat: add problem matcher (#3)
1 parent 8c57a7c commit 033d01b

File tree

9 files changed

+84
-3
lines changed

9 files changed

+84
-3
lines changed

.github/deno-matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "deno-lint-compact",
5+
"pattern": [
6+
{
7+
"regexp": "^((\\w:)?[\\\\/\\w-_\\.]+): line (\\d+), col (\\d+) - (.+) (\\(.+\\))",
8+
"file": 1,
9+
"line": 3,
10+
"column": 4,
11+
"message": 5,
12+
"code": 6
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/test.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v4
2121

22-
- name: Use basic action
22+
- name: Setup Deno
2323
uses: ./
2424

2525
- name: Test basic usage
@@ -46,4 +46,31 @@ jobs:
4646
directory: "test/customized"
4747

4848
- name: Test customized usage
49-
run: deno run -A --config=./test/customized/deno.json ./test/customized/main.ts
49+
working-directory: test/customized
50+
run: deno run -A main.ts
51+
52+
problem-matcher:
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
# we just need to check two different path separators
57+
os: [ubuntu-latest, windows-latest]
58+
59+
name: Problem matcher on ${{ matrix.os }}
60+
61+
runs-on: ${{ matrix.os }}
62+
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Setup Deno
68+
uses: ./
69+
70+
- name: Problem matcher
71+
working-directory: test/problem-matcher
72+
run: |
73+
deno lint || true
74+
deno lint --compact || true
75+
deno test || true
76+
deno check *.ts || true

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ runs:
4242
shell: bash
4343
run: echo "DENO_DIR=$RUNNER_TEMP${{ runner.os == 'Windows' && '\\' || '/' }}deno_cache" >> $GITHUB_ENV
4444

45+
- name: Register Deno problem matchers
46+
shell: bash
47+
run: echo "::add-matcher::.github/deno-matcher.json"
48+
4549
- name: Cache Deno dependencies
4650
id: cache-deno
4751
uses: actions/cache@v3.3.2

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"imports": {
33
"std/": "https://deno.land/std@0.207.0/",
44
"cliffy/": "https://deno.land/x/cliffy@v1.0.0-rc.3/"
5-
}
5+
},
6+
"exclude": ["test/problem-matcher"]
67
}

test/problem-matcher/deno.json

Whitespace-only changes.

test/problem-matcher/deno.lock

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

test/problem-matcher/foo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const add = (a: number, b: number) => a + b;

test/problem-matcher/foo_test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { assert } from "https://deno.land/std@0.196.0/assert/assert.ts";
2+
import { add } from "./foo.ts";
3+
4+
Deno.test("add test 1", () => {
5+
assert(add(2, 2) === 5);
6+
});
7+
8+
Deno.test("add test 2", () => {
9+
assert(add(2, 2) !== 4);
10+
});

test/problem-matcher/main.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// intentionally broken snytax and formatting to check the problem matcher
2+
import * as
3+
color from "https://deno.land/std@0.207.0/fmt/colors.ts";
4+
5+
console.log(green("Hello world!"));
6+
7+
for (const [name, value] of Object.entries()) {
8+
console.log(name, value);
9+
}
10+
11+
let x
12+
= 42;
13+
14+
let y: any = {};

0 commit comments

Comments
 (0)