|
19 | 19 | name: 'Basic CS and QA checks'
|
20 | 20 | runs-on: ubuntu-latest
|
21 | 21 |
|
22 |
| - env: |
23 |
| - XMLLINT_INDENT: ' ' |
24 |
| - |
25 | 22 | steps:
|
26 | 23 | - name: Checkout code
|
27 | 24 | uses: actions/checkout@v4
|
@@ -53,50 +50,95 @@ jobs:
|
53 | 50 | # Bust the cache at least once a month - output format: YYYY-MM.
|
54 | 51 | custom-cache-suffix: $(date -u "+%Y-%m")
|
55 | 52 |
|
| 53 | + # Validate the XSD and XML files against schema. |
| 54 | + - name: Validate Docs XSD against schema |
| 55 | + uses: phpcsstandards/xmllint-validate@v1 |
| 56 | + with: |
| 57 | + pattern: "DocsXsd/phpcsdocs.xsd" |
| 58 | + xsd-url: "https://www.w3.org/2012/04/XMLSchema.xsd" |
| 59 | + |
| 60 | + - name: Validate PHPCSDebug ruleset against schema |
| 61 | + uses: phpcsstandards/xmllint-validate@v1 |
| 62 | + with: |
| 63 | + pattern: "PHPCSDebug/ruleset.xml" |
| 64 | + xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd" |
| 65 | + |
| 66 | + - name: Validate docs against schema |
| 67 | + uses: phpcsstandards/xmllint-validate@v1 |
| 68 | + with: |
| 69 | + pattern: "PHPCSDebug/Docs/*/*Standard.xml" |
| 70 | + xsd-file: "DocsXsd/phpcsdocs.xsd" |
| 71 | + |
| 72 | + - name: Validate Project PHPCS ruleset against schema |
| 73 | + uses: phpcsstandards/xmllint-validate@v1 |
| 74 | + with: |
| 75 | + pattern: "phpcs.xml.dist" |
| 76 | + xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd" |
| 77 | + |
| 78 | + - name: "Validate PHPUnit < 10 config for use with PHPUnit 8" |
| 79 | + uses: phpcsstandards/xmllint-validate@v1 |
| 80 | + with: |
| 81 | + pattern: "phpunitlte9.xml.dist" |
| 82 | + xsd-file: "vendor/phpunit/phpunit/schema/8.5.xsd" |
| 83 | + |
| 84 | + - name: "Validate PHPUnit < 10 config for use with PHPUnit 9" |
| 85 | + uses: phpcsstandards/xmllint-validate@v1 |
| 86 | + with: |
| 87 | + pattern: "phpunitlte9.xml.dist" |
| 88 | + xsd-file: "vendor/phpunit/phpunit/schema/9.5.xsd" |
| 89 | + |
| 90 | + - name: "Validate PHPUnit 10+ config for use with PHPUnit 10" |
| 91 | + uses: phpcsstandards/xmllint-validate@v1 |
| 92 | + with: |
| 93 | + pattern: "phpunit.xml.dist" |
| 94 | + xsd-file: "vendor/phpunit/phpunit/schema/10.5.xsd" |
| 95 | + |
| 96 | + - name: "Validate PHPUnit 10+ config for use with PHPUnit 11" |
| 97 | + uses: phpcsstandards/xmllint-validate@v1 |
| 98 | + with: |
| 99 | + pattern: "phpunit.xml.dist" |
| 100 | + xsd-file: "vendor/phpunit/phpunit/phpunit.xsd" |
| 101 | + |
| 102 | + # Check the code-style consistency of the PHP files. |
| 103 | + - name: Check PHP code style |
| 104 | + id: phpcs |
| 105 | + run: composer checkcs -- --report-full --report-checkstyle=./phpcs-report.xml |
| 106 | + |
| 107 | + - name: Show PHPCS results in PR |
| 108 | + if: ${{ always() && steps.phpcs.outcome == 'failure' }} |
| 109 | + run: cs2pr ./phpcs-report.xml |
| 110 | + |
| 111 | + xml-cs: |
| 112 | + name: 'XML Code style' |
| 113 | + runs-on: ubuntu-latest |
| 114 | + |
| 115 | + env: |
| 116 | + XMLLINT_INDENT: ' ' |
| 117 | + |
| 118 | + steps: |
| 119 | + - name: Checkout code |
| 120 | + uses: actions/checkout@v4 |
| 121 | + |
56 | 122 | # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
|
57 | 123 | # This should not be blocking for this job, so ignore any errors from this step.
|
58 | 124 | # Ref: https://github.com/dotnet/core/issues/4167
|
59 | 125 | - name: Update the available packages list
|
60 | 126 | continue-on-error: true
|
61 | 127 | run: sudo apt-get update
|
62 | 128 |
|
63 |
| - # @link http://xmlsoft.org/xmllint.html |
64 | 129 | - name: Install xmllint
|
65 | 130 | run: sudo apt-get install --no-install-recommends -y libxml2-utils
|
66 | 131 |
|
67 |
| - - name: Download the XSD schema |
68 |
| - run: curl http://www.w3.org/2001/XMLSchema.xsd --output XMLSchema.xsd |
69 |
| - |
70 | 132 | # Show XML violations inline in the file diff.
|
71 |
| - # @link https://github.com/marketplace/actions/xmllint-problem-matcher |
72 | 133 | - name: Enable showing XML issues inline
|
73 | 134 | uses: korelstar/xmllint-problem-matcher@v1
|
74 | 135 |
|
75 |
| - # Validate the XSD and XML files against schema. |
76 |
| - - name: Validate Docs XSD against schema |
77 |
| - run: xmllint --noout --schema XMLSchema.xsd DocsXsd/phpcsdocs.xsd |
78 |
| - |
79 |
| - - name: Validate PHPCSDebug ruleset against schema |
80 |
| - run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd PHPCSDebug/ruleset.xml |
81 |
| - |
82 |
| - - name: Validate docs against schema |
83 |
| - run: xmllint --noout --schema DocsXsd/phpcsdocs.xsd ./PHPCSDebug/Docs/*/*Standard.xml |
84 |
| - |
85 | 136 | # Check code-style consistency of the XSD and XML files.
|
86 | 137 | - name: Check XSD code style
|
87 | 138 | run: diff -B ./DocsXsd/phpcsdocs.xsd <(xmllint --format "./DocsXsd/phpcsdocs.xsd")
|
88 | 139 |
|
89 | 140 | - name: Check Ruleset XML code style
|
90 | 141 | run: diff -B ./PHPCSDebug/ruleset.xml <(xmllint --format "./PHPCSDebug/ruleset.xml")
|
91 | 142 |
|
92 |
| - # Check the code-style consistency of the PHP files. |
93 |
| - - name: Check PHP code style |
94 |
| - id: phpcs |
95 |
| - run: composer checkcs -- --report-full --report-checkstyle=./phpcs-report.xml |
96 |
| - |
97 |
| - - name: Show PHPCS results in PR |
98 |
| - if: ${{ always() && steps.phpcs.outcome == 'failure' }} |
99 |
| - run: cs2pr ./phpcs-report.xml |
100 |
| - |
101 | 143 | phpstan:
|
102 | 144 | uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
|
0 commit comments