Skip to content

Commit

Permalink
create xmllint-problem-matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
korelstar committed Feb 13, 2020
1 parent 694f78c commit 059d630
Show file tree
Hide file tree
Showing 8 changed files with 801 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test
on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup xmllint
run: sudo apt-get install --no-install-recommends -y libxml2-utils
- name: add problem matcher for xmllint
run: ./index.js
- name: lint XML file with syntax error
run: xmllint test/error.xml --schema test/info.xsd --noout || true
- name: lint XML file with schema error
run: xmllint test/info.xml --schema test/info.xsd --noout || true

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# xmllint-problem-matcher

This problem matcher lets you show errors from `xmllint` as annotation in GitHub Actions.

## Usage

Add the step to your workflow, before PHPUnit is called.

```yaml
- uses: korelstar/xmllint-problem-matcher@v1
```
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'xmllint problem matcher'
author: 'Kristof Hamann'
description: 'Shows xmllint errors as annotation (with file and code line) in GitHub Actions'
runs:
using: 'node12'
main: 'index.js'
branding:
icon: 'check-square'
color: 'green'
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
console.log(`::add-matcher::${__dirname}/xmllint-matcher.json`);
12 changes: 12 additions & 0 deletions test/error.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="info.xsd">
<idi>uniqueid</id>
<name attribut="test">App name</name>
</summary>This is for test</summary>
<description><![CDATA[
Let's describe something
]]></description>
<licence>agpl</licence>
<version>1.4</version>
</info>
12 changes: 12 additions & 0 deletions test/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="info.xsd">
<id>testid</id>
<name attribut="test">App</name>
<summary>This is a summary</summary>
<description><![CDATA[
Let's describe something.
]]></description>
<licence>agpl</licence>
<version>1.4</version>
</info>
Loading

0 comments on commit 059d630

Please sign in to comment.