Skip to content

Commit 793494e

Browse files
committed
GH Actions: split XML code style check off from "Basic QA"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 31ef149 commit 793494e

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

.github/workflows/basics.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
env:
23-
XMLLINT_INDENT: ' '
2423
# - COMPOSER_ROOT_VERSION is needed to get round the recursive dependency when using CI.
2524
COMPOSER_ROOT_VERSION: '1.99.99'
2625

@@ -73,13 +72,6 @@ jobs:
7372
- name: Validate rulesets against schema
7473
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
7574

76-
# Check the code-style consistency of the XML ruleset files.
77-
- name: Check XML code style
78-
run: |
79-
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
80-
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
81-
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
82-
8375
# Validate the Documentation XML files.
8476
- name: Validate documentation against schema
8577
run: xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./*/Docs/*/*Standard.xml
@@ -99,6 +91,38 @@ jobs:
9991
- name: Check sniff feature completeness
10092
run: composer check-complete
10193

94+
xml-cs:
95+
name: 'XML Code style'
96+
runs-on: ubuntu-latest
97+
98+
env:
99+
XMLLINT_INDENT: ' '
100+
101+
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
105+
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
106+
# This should not be blocking for this job, so ignore any errors from this step.
107+
# Ref: https://github.com/dotnet/core/issues/4167
108+
- name: Update the available packages list
109+
continue-on-error: true
110+
run: sudo apt-get update
111+
112+
- name: Install xmllint
113+
run: sudo apt-get install --no-install-recommends -y libxml2-utils
114+
115+
# Show XML violations inline in the file diff.
116+
- name: Enable showing XML issues inline
117+
uses: korelstar/xmllint-problem-matcher@v1
118+
119+
# Check the code-style consistency of the XML ruleset files.
120+
- name: Check XML code style
121+
run: |
122+
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
123+
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
124+
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
125+
102126
phpstan:
103127
name: "PHPStan"
104128
uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main

0 commit comments

Comments
 (0)