Skip to content

Commit 097b407

Browse files
authored
Merge pull request #852 from PHPCSStandards/feature/ghactions-change-xmllint-validation
GH Actions: use the xmllint-validate action runner and enhance checks
2 parents be74da1 + 5bc86ce commit 097b407

File tree

1 file changed

+44
-18
lines changed

1 file changed

+44
-18
lines changed

.github/workflows/validate.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,50 @@ jobs:
2424
# Don't run the cronjob in this workflow on forks.
2525
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
2626

27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
# Validate the XSD file.
32+
- name: Validate XSD against schema
33+
uses: phpcsstandards/xmllint-validate@v1
34+
with:
35+
pattern: "phpcs.xsd"
36+
xsd-url: "https://www.w3.org/2012/04/XMLSchema.xsd"
37+
38+
# Validate the XML ruleset files.
39+
- name: Validate rulesets against schema
40+
uses: phpcsstandards/xmllint-validate@v1
41+
with:
42+
pattern: "./src/Standards/*/ruleset.xml"
43+
xsd-file: "phpcs.xsd"
44+
45+
# Validate the Documentation XML files.
46+
- name: Validate documentation XML
47+
uses: phpcsstandards/xmllint-validate@v1
48+
with:
49+
pattern: "./src/Standards/*/Docs/*/*Standard.xml"
50+
xsd-url: "https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
51+
52+
# Validate dev tool related XML files.
53+
- name: Validate Project PHPCS ruleset against schema
54+
uses: phpcsstandards/xmllint-validate@v1
55+
with:
56+
pattern: "phpcs.xml.dist"
57+
xsd-file: "phpcs.xsd"
58+
59+
- name: "Validate PHPUnit config for well-formedness"
60+
uses: phpcsstandards/xmllint-validate@v1
61+
with:
62+
pattern: "phpunit.xml.dist"
63+
64+
xml-cs:
65+
name: 'XML Code style'
66+
runs-on: ubuntu-latest
67+
68+
# Don't run the cronjob in this workflow on forks.
69+
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
70+
2771
env:
2872
XMLLINT_INDENT: ' '
2973

@@ -41,24 +85,10 @@ jobs:
4185
- name: Install xmllint
4286
run: sudo apt-get install --no-install-recommends -y libxml2-utils
4387

44-
- name: Retrieve XML Schema
45-
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd
46-
4788
# Show XML violations inline in the file diff.
48-
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
4989
- name: Enable showing XML issues inline
5090
uses: korelstar/xmllint-problem-matcher@v1
5191

52-
# Validate the XML ruleset files.
53-
# @link http://xmlsoft.org/xmllint.html
54-
- name: Validate rulesets against schema
55-
run: xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml
56-
57-
# Validate the XSD file.
58-
# @link http://xmlsoft.org/xmllint.html
59-
- name: Validate XSD against schema
60-
run: xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd
61-
6292
# Check the code-style consistency of the XML files.
6393
- name: Check XML code style
6494
run: |
@@ -72,10 +102,6 @@ jobs:
72102
diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml")
73103
diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml")
74104
75-
# Validate the basic well-formedness of the Documentation XML files.
76-
- name: Validate documentation XML
77-
run: xmllint --noout ./src/Standards/*/Docs/*/*Standard.xml
78-
79105
yamllint:
80106
name: 'Lint Yaml'
81107
# Don't run the cronjob in this workflow on forks.

0 commit comments

Comments
 (0)