|
22 | 22 | name: 'Basic CS and QA checks'
|
23 | 23 | runs-on: ubuntu-latest
|
24 | 24 |
|
| 25 | + env: |
| 26 | + XMLLINT_INDENT: ' ' # This is a tab character. |
| 27 | + |
25 | 28 | steps:
|
26 | 29 | - name: Checkout code
|
27 | 30 | uses: actions/checkout@v4
|
|
33 | 36 | coverage: none
|
34 | 37 | tools: cs2pr
|
35 | 38 |
|
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 |
| - |
51 | 39 | # Validate the composer.json file.
|
52 | 40 | # @link https://getcomposer.org/doc/03-cli.md#validate
|
53 | 41 | - name: Validate Composer installation
|
|
65 | 53 | # Bust the cache at least once a month - output format: YYYY-MM.
|
66 | 54 | custom-cache-suffix: $(date -u "+%Y-%m")
|
67 | 55 |
|
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") |
| 69 | +
|
| 70 | + # Validate dev tool related XML files. |
| 71 | + - name: Validate Project PHPCS ruleset against schema |
| 72 | + uses: phpcsstandards/xmllint-validate@v1 |
| 73 | + with: |
| 74 | + pattern: ".phpcs.xml.dist" |
| 75 | + xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd" |
| 76 | + |
| 77 | + # Notes: |
| 78 | + # - PHPUnit 9.5 (which will be installed in this job) doesn't ship XSD files further back than 8.5. |
| 79 | + # - PHPUnit 9.3 introduced some new configuration options and deprecated the old versions of those. |
| 80 | + # For cross-version compatibility with older PHPUnit versions, those new config options cannot be used yet, |
| 81 | + # which is why the PHPUnit 9 validation is done against the PHPUnit 9.2 schema. |
| 82 | + - name: "Validate PHPUnit config for use with PHPUnit 8" |
| 83 | + uses: phpcsstandards/xmllint-validate@v1 |
| 84 | + with: |
| 85 | + pattern: "phpunit.xml.dist" |
| 86 | + xsd-file: "vendor/phpunit/phpunit/schema/8.5.xsd" |
| 87 | + |
| 88 | + - name: "Validate PHPUnit config for use with PHPUnit 9" |
| 89 | + uses: phpcsstandards/xmllint-validate@v1 |
| 90 | + with: |
| 91 | + pattern: "phpunit.xml.dist" |
| 92 | + xsd-file: "vendor/phpunit/phpunit/schema/9.2.xsd" |
70 | 93 |
|
71 | 94 | # Check the code-style consistency of the PHP files.
|
72 | 95 | - name: Check PHP code style
|
|
0 commit comments