Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb3b327c51 | ||
|
|
60e141d668 | ||
|
|
08515e67e1 | ||
|
|
8509223bc7 | ||
|
|
ae82e15273 | ||
|
|
dd72791927 | ||
|
|
0de4817981 | ||
|
|
b651f721c4 | ||
|
|
d87815601a | ||
|
|
6bc12485dd | ||
|
|
fb9ac95d1a | ||
|
|
c312ae7971 | ||
|
|
15a0ef1a78 | ||
|
|
bb243c024a | ||
|
|
850281ad51 | ||
|
|
9a4355f8e1 | ||
|
|
52b5d16c14 |
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Apply problem matcher
|
- name: Apply problem matcher
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
build-directory: ""
|
build-directory: build/
|
||||||
|
|
||||||
- name: Test problem matcher
|
- name: Test problem matcher
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -1,21 +1,25 @@
|
|||||||
# GCC problem matcher
|
# GCC problem matcher
|
||||||
|
|
||||||
# DO NOT COMMIT THIS LINE
|
|
||||||
|
|
||||||
Creates annotations for warnings and errors in gcc builds.
|
Creates annotations for warnings and errors in gcc builds.
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
### root
|
### build-directory
|
||||||
|
|
||||||
**Optional** Base directory for build. For builds done in a subdirectory, this should match that directory, otherwise the pattern match will not be able to point to the correct file.
|
**Optional** Base directory for build. For builds done in a subdirectory, this should match that directory, otherwise the pattern match will not be able to point to the correct file.
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
Just add this line anywhere before running the build step.
|
Create annotations for builds done in the root directory
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: olemorud/gcc-problem-matcher@v1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Create annotations for builds done in directory `/workspace/build/`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: olemorud/gcc-problem-matcher@master
|
- uses: olemorud/gcc-problem-matcher@master
|
||||||
with:
|
with:
|
||||||
root: /workspace/build
|
build-directory: /workspace/build/
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: GCC Problem Matcher
|
name: GCC Problem Matcher Improved
|
||||||
|
|
||||||
description: Get annotations for warnings and errors on builds using gcc
|
description: Get annotations for warnings and errors on builds using gcc
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ branding:
|
|||||||
inputs:
|
inputs:
|
||||||
build-directory:
|
build-directory:
|
||||||
description: 'base directory for build, e.g. /workdir/build'
|
description: 'base directory for build, e.g. /workdir/build'
|
||||||
required: true
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
2
dist/gcc_matcher.jsontemplate
vendored
2
dist/gcc_matcher.jsontemplate
vendored
@@ -4,7 +4,7 @@
|
|||||||
"owner": "gcc-problem-matcher",
|
"owner": "gcc-problem-matcher",
|
||||||
"pattern": [
|
"pattern": [
|
||||||
{
|
{
|
||||||
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
|
"regexp": "^${{ BASE }}\\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
"file": 1,
|
"file": 1,
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 3,
|
"column": 3,
|
||||||
|
|||||||
6
dist/index.js
vendored
6
dist/index.js
vendored
@@ -2848,7 +2848,7 @@ const core = __nccwpck_require__(127);
|
|||||||
// escapeRegExp :: string => string
|
// escapeRegExp :: string => string
|
||||||
// escape all characters with special meanings in regexp
|
// escape all characters with special meanings in regexp
|
||||||
const escapeRegExp = (s) =>
|
const escapeRegExp = (s) =>
|
||||||
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\$&");
|
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\\\$&");
|
||||||
|
|
||||||
// variable :: string => RegExp
|
// variable :: string => RegExp
|
||||||
// create regex to match ${{ key }}
|
// create regex to match ${{ key }}
|
||||||
@@ -2859,12 +2859,12 @@ const variable = (key) =>
|
|||||||
const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
|
const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
|
||||||
|
|
||||||
// matcherPath :: string
|
// matcherPath :: string
|
||||||
const matcherPath = __nccwpck_require__.ab + "gcc_matcher.json";
|
const outputPath = __nccwpck_require__.ab + "gcc_matcher.json";
|
||||||
|
|
||||||
// rootdir :: string
|
// rootdir :: string
|
||||||
const rootdir = core.getInput('build-directory', {required: false});
|
const rootdir = core.getInput('build-directory', {required: false});
|
||||||
|
|
||||||
// parse :: IO() => IO() => Error | null
|
// parse :: string => string => Error | null
|
||||||
const parse = (templatePath) => (matcherPath) => {
|
const parse = (templatePath) => (matcherPath) => {
|
||||||
const content = fs.readFileSync(templatePath, 'utf-8');
|
const content = fs.readFileSync(templatePath, 'utf-8');
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"owner": "gcc-problem-matcher",
|
"owner": "gcc-problem-matcher",
|
||||||
"pattern": [
|
"pattern": [
|
||||||
{
|
{
|
||||||
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
|
"regexp": "^${{ BASE }}\\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
"file": 1,
|
"file": 1,
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 3,
|
"column": 3,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const core = require('@actions/core');
|
|||||||
// escapeRegExp :: string => string
|
// escapeRegExp :: string => string
|
||||||
// escape all characters with special meanings in regexp
|
// escape all characters with special meanings in regexp
|
||||||
const escapeRegExp = (s) =>
|
const escapeRegExp = (s) =>
|
||||||
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\$&");
|
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\\\$&");
|
||||||
|
|
||||||
// variable :: string => RegExp
|
// variable :: string => RegExp
|
||||||
// create regex to match ${{ key }}
|
// create regex to match ${{ key }}
|
||||||
@@ -16,12 +16,12 @@ const variable = (key) =>
|
|||||||
const templatePath = path.join(__dirname, "gcc_matcher.jsontemplate");
|
const templatePath = path.join(__dirname, "gcc_matcher.jsontemplate");
|
||||||
|
|
||||||
// matcherPath :: string
|
// matcherPath :: string
|
||||||
const matcherPath = path.join(__dirname, "gcc_matcher.json");
|
const outputPath = path.join(__dirname, "gcc_matcher.json");
|
||||||
|
|
||||||
// rootdir :: string
|
// rootdir :: string
|
||||||
const rootdir = core.getInput('build-directory', {required: false});
|
const rootdir = core.getInput('build-directory', {required: false});
|
||||||
|
|
||||||
// parse :: IO() => IO() => Error | null
|
// parse :: string => string => Error | null
|
||||||
const parse = (templatePath) => (matcherPath) => {
|
const parse = (templatePath) => (matcherPath) => {
|
||||||
const content = fs.readFileSync(templatePath, 'utf-8');
|
const content = fs.readFileSync(templatePath, 'utf-8');
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ const parse = (templatePath) => (matcherPath) => {
|
|||||||
|
|
||||||
// main:
|
// main:
|
||||||
try {
|
try {
|
||||||
parse(templatePath)(matcherPath);
|
parse(templatePath)(outputPath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(`Action failed with error ${err}`)
|
core.setFailed(`Action failed with error ${err}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user