14 Commits

Author SHA1 Message Date
olemorud
8f0e275979 [refactor] Simplify regex 2023-03-16 14:46:36 +01:00
olemorud
4c3b4df0ad DO NOT SHIP THIS COMMIT 2023-03-14 17:25:50 +01:00
olemorud
8a8f3dcf06 update generate_warnings.c 2023-03-14 17:24:04 +01:00
olemorud
8354b13365 test 2023-03-14 17:21:50 +01:00
olemorud
70fa3137ae skip broken test 2023-03-14 17:21:50 +01:00
olemorud
c041f1a38d add CI 2023-03-14 17:21:50 +01:00
olemorud
90cf5ede8d .gitignore: add .vscode 2023-03-14 15:58:42 +01:00
olemorud
8b67cd9fb3 Update action.yml to use dist/ 2023-03-14 15:21:46 +01:00
olemorud
5938cacd96 Add npm build command 2023-03-14 15:21:03 +01:00
olemorud
389f0126c9 update index.js 2023-03-14 15:20:54 +01:00
olemorud
bbe92b8e4f ncc build 2023-03-14 15:00:33 +01:00
olemorud
6d3cafd749 .gitignore: add */gcc_matcher.json 2023-03-14 15:00:33 +01:00
olemorud
9a33ec6b8a Update README 2023-03-14 14:54:46 +01:00
olemorud
47a6b397d9 npm init 2023-03-14 14:54:46 +01:00
7 changed files with 21 additions and 42 deletions

View File

@@ -23,7 +23,7 @@ jobs:
- name: Apply problem matcher - name: Apply problem matcher
uses: ./ uses: ./
with: with:
build-directory: build/ build-directory: ""
- name: Test problem matcher - name: Test problem matcher
run: | run: |

View File

@@ -1,42 +1,21 @@
# GCC problem matcher (no longer maintained) # GCC problem matcher
> **Warning** # DO NOT COMMIT THIS LINE
> This repository is no longer maintained, the new upstream is: https://github.com/root-project/gcc-problem-matcher-improved
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Folemorud%2Fgcc-problem-matcher.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Folemorud%2Fgcc-problem-matcher?ref=badge_shield)
Creates annotations for warnings and errors in gcc builds. Creates annotations for warnings and errors in gcc builds.
![image](https://user-images.githubusercontent.com/82065181/225907856-336fa631-6520-44ce-bdf5-cf5780e45e40.png)
## Inputs ## Inputs
### build-directory ### root
**Optional** Directory the build is running in. Matched errors will not be able to point to the correct file or create warnings in the `Files changed` overview unless this is correct. **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
Create annotations for builds done in the default directory. Add this anywhere before starting the build. Just add this line anywhere before running the build step.
```yaml
- uses: olemorud/gcc-problem-matcher@v1.0
- name: Build
run: |
...
```
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:
build-directory: /workspace/build/ root: /workspace/build
```
- name: Build
run: |
...
```

View File

@@ -1,6 +1,6 @@
name: GCC Problem Matcher Improved (deprecated) name: GCC Problem Matcher
description: new upstream: https://github.com/root-project/gcc-problem-matcher-improved description: Get annotations for warnings and errors on builds using gcc
author: Ole Morud author: Ole Morud
@@ -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: false required: true
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher", "owner": "gcc-problem-matcher",
"pattern": [ "pattern": [
{ {
"regexp": "^${{ BASE }}\\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", "regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1, "file": 1,
"line": 2, "line": 2,
"column": 3, "column": 3,

6
dist/index.js vendored
View File

@@ -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 outputPath = __nccwpck_require__.ab + "gcc_matcher.json"; const matcherPath = __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 :: string => string => Error | null // parse :: IO() => IO() => Error | null
const parse = (templatePath) => (matcherPath) => { const parse = (templatePath) => (matcherPath) => {
const content = fs.readFileSync(templatePath, 'utf-8'); const content = fs.readFileSync(templatePath, 'utf-8');

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher", "owner": "gcc-problem-matcher",
"pattern": [ "pattern": [
{ {
"regexp": "^${{ BASE }}\\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", "regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1, "file": 1,
"line": 2, "line": 2,
"column": 3, "column": 3,

View File

@@ -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 outputPath = path.join(__dirname, "gcc_matcher.json"); const matcherPath = 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 :: string => string => Error | null // parse :: IO() => IO() => 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)(outputPath); parse(templatePath)(matcherPath);
} catch (err) { } catch (err) {
core.setFailed(`Action failed with error ${err}`) core.setFailed(`Action failed with error ${err}`)
} }