forked from PHPCSStandards/PHP_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (65 loc) · 2.94 KB
/
validate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Validate
on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checkxml:
name: Check XML files
runs-on: ubuntu-latest
env:
XMLLINT_INDENT: ' '
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install xmllint
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libxml2-utils
- name: Retrieve XML Schema
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd
# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- name: Enable showing XML issues inline
uses: korelstar/xmllint-problem-matcher@v1
# Validate the XML ruleset files.
# @link http://xmlsoft.org/xmllint.html
- name: Validate rulesets against schema
run: xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml
# Validate the XSD file.
# @link http://xmlsoft.org/xmllint.html
- name: Validate XSD against schema
run: xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd
# Check the code-style consistency of the XML files.
- name: Check XML code style
run: |
diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist")
diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml")
diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml")
diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml")
diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml")
diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml")
diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml")
diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml")
diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml")
yamllint:
name: 'Lint Yaml'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Yamllint on all yaml files in repo
run: yamllint . --format colored --strict
- name: Pipe Yamllint results on to GH for inline display
if: ${{ failure() }}
run: yamllint . --format github --strict