Skip to content

Commit 0c1ea1d

Browse files
committed
GH Actions: split XML code style check off from "Validate XML"check
The intention is for there to be a dedicated action runner available at some point for XML code style checking, so let's move this to a separate job. Also see: PHPCSStandards/PHPCSDevTools#145
1 parent db884da commit 0c1ea1d

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

.github/workflows/validate.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ 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-
env:
28-
XMLLINT_INDENT: ' '
29-
3027
steps:
3128
- name: Checkout code
3229
uses: actions/checkout@v4
@@ -59,6 +56,38 @@ jobs:
5956
- name: Validate XSD against schema
6057
run: xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd
6158

59+
# Validate the basic well-formedness of the Documentation XML files.
60+
- name: Validate documentation XML
61+
run: xmllint --noout ./src/Standards/*/Docs/*/*Standard.xml
62+
63+
xml-cs:
64+
name: 'XML Code style'
65+
runs-on: ubuntu-latest
66+
67+
# Don't run the cronjob in this workflow on forks.
68+
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
69+
70+
env:
71+
XMLLINT_INDENT: ' '
72+
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
78+
# This should not be blocking for this job, so ignore any errors from this step.
79+
# Ref: https://github.com/dotnet/core/issues/4167
80+
- name: Update the available packages list
81+
continue-on-error: true
82+
run: sudo apt-get update
83+
84+
- name: Install xmllint
85+
run: sudo apt-get install --no-install-recommends -y libxml2-utils
86+
87+
# Show XML violations inline in the file diff.
88+
- name: Enable showing XML issues inline
89+
uses: korelstar/xmllint-problem-matcher@v1
90+
6291
# Check the code-style consistency of the XML files.
6392
- name: Check XML code style
6493
run: |
@@ -71,10 +100,6 @@ jobs:
71100
diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml")
72101
diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml")
73102
74-
# Validate the basic well-formedness of the Documentation XML files.
75-
- name: Validate documentation XML
76-
run: xmllint --noout ./src/Standards/*/Docs/*/*Standard.xml
77-
78103
yamllint:
79104
name: 'Lint Yaml'
80105
# Don't run the cronjob in this workflow on forks.

0 commit comments

Comments
 (0)