Skip to content

Commit ec3cc04

Browse files
committed
GH Actions: use the xmllint-validate action runner
Instead of doing all the installation steps for xmllint validation in the workflow, use the ✨ new dedicated `phpcsstandards/xmllint-validate` action runner instead. Notes: * This does mean that the `bin/xml-lint` script is now no longer used in CI. I've left the script in place as there may be contributors who want to run these checks locally and the script can help them with that, though happy to remove the script if nobody uses it. Ref: https://github.com/marketplace/actions/xmllint-validate
1 parent 7ed6c5d commit ec3cc04

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

.github/workflows/basics.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
name: 'Basic CS and QA checks'
2323
runs-on: ubuntu-latest
2424

25+
env:
26+
XMLLINT_INDENT: ' ' # This is a tab character.
27+
2528
steps:
2629
- name: Checkout code
2730
uses: actions/checkout@v4
@@ -33,21 +36,6 @@ jobs:
3336
coverage: none
3437
tools: cs2pr
3538

36-
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
37-
# This should not be blocking for this job, so ignore any errors from this step.
38-
# Ref: https://github.com/dotnet/core/issues/4167
39-
- name: Update the available packages list
40-
continue-on-error: true
41-
run: sudo apt-get update
42-
43-
- name: Install xmllint
44-
run: sudo apt-get install --no-install-recommends -y libxml2-utils
45-
46-
# Show XML violations inline in the file diff.
47-
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
48-
- name: Enable showing XML issues inline
49-
uses: korelstar/xmllint-problem-matcher@v1
50-
5139
# Validate the composer.json file.
5240
# @link https://getcomposer.org/doc/03-cli.md#validate
5341
- name: Validate Composer installation
@@ -65,8 +53,19 @@ jobs:
6553
# Bust the cache at least once a month - output format: YYYY-MM.
6654
custom-cache-suffix: $(date -u "+%Y-%m")
6755

68-
- name: 'Validate XML against schema and check code style'
69-
run: ./bin/xml-lint
56+
# Validate the XML file.
57+
- name: Validate rulesets against schema
58+
uses: phpcsstandards/xmllint-validate@v1
59+
with:
60+
pattern: "./*/ruleset.xml"
61+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
62+
63+
# Check the code-style consistency of the XML file.
64+
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner in the previous step.
65+
- name: Check XML code style
66+
run: |
67+
diff -B --tabsize=4 ./WordPressVIPMinimum/ruleset.xml <(xmllint --format "./WordPressVIPMinimum/ruleset.xml")
68+
diff -B --tabsize=4 ./WordPress-VIP-Go/ruleset.xml <(xmllint --format "./WordPress-VIP-Go/ruleset.xml")
7069
7170
# Check the code-style consistency of the PHP files.
7271
- name: Check PHP code style

0 commit comments

Comments
 (0)