20
20
runs-on : ubuntu-latest
21
21
22
22
env :
23
- XMLLINT_INDENT : ' '
24
23
# - COMPOSER_ROOT_VERSION is needed to get round the recursive dependency when using CI.
25
24
COMPOSER_ROOT_VERSION : ' 1.99.99'
26
25
53
52
# Bust the cache at least once a month - output format: YYYY-MM.
54
53
custom-cache-suffix : $(date -u "+%Y-%m")
55
54
55
+ # Validate XML files against schema.
56
+ - name : Validate XML rulesets against schema
57
+ uses : phpcsstandards/xmllint-validate@v1
58
+ with :
59
+ pattern : " ./*/ruleset.xml"
60
+ xsd-file : " vendor/squizlabs/php_codesniffer/phpcs.xsd"
61
+
62
+ - name : Validate documentation XML against schema
63
+ uses : phpcsstandards/xmllint-validate@v1
64
+ with :
65
+ pattern : " ./*/Docs/*/*Standard.xml"
66
+ xsd-file : " vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd"
67
+
68
+ - name : Validate Project PHPCS ruleset against schema
69
+ uses : phpcsstandards/xmllint-validate@v1
70
+ with :
71
+ pattern : " phpcs.xml.dist"
72
+ xsd-file : " vendor/squizlabs/php_codesniffer/phpcs.xsd"
73
+
74
+ - name : " Validate PHPUnit config for use with PHPUnit 8"
75
+ uses : phpcsstandards/xmllint-validate@v1
76
+ with :
77
+ pattern : " phpunit.xml.dist"
78
+ xsd-file : " vendor/phpunit/phpunit/schema/8.5.xsd"
79
+
80
+ - name : " Validate PHPUnit config for use with PHPUnit 9"
81
+ uses : phpcsstandards/xmllint-validate@v1
82
+ with :
83
+ pattern : " phpunit.xml.dist"
84
+ xsd-file : " vendor/phpunit/phpunit/schema/9.2.xsd"
85
+
86
+ # Check the code-style consistency of the PHP files.
87
+ - name : Check PHP code style
88
+ id : phpcs
89
+ run : vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
90
+
91
+ - name : Show PHPCS results in PR
92
+ if : ${{ always() && steps.phpcs.outcome == 'failure' }}
93
+ run : cs2pr ./phpcs-report.xml
94
+
95
+ # Check that the sniffs available are feature complete.
96
+ # For now, just check that all sniffs have unit tests.
97
+ # At a later stage the documentation check can be activated.
98
+ - name : Check sniff feature completeness
99
+ run : composer check-complete
100
+
101
+ xml-cs :
102
+ name : ' XML Code style'
103
+ runs-on : ubuntu-latest
104
+
105
+ env :
106
+ XMLLINT_INDENT : ' '
107
+
108
+ steps :
109
+ - name : Checkout code
110
+ uses : actions/checkout@v4
111
+
56
112
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
57
113
# This should not be blocking for this job, so ignore any errors from this step.
58
114
# Ref: https://github.com/dotnet/core/issues/4167
@@ -64,41 +120,16 @@ jobs:
64
120
run : sudo apt-get install --no-install-recommends -y libxml2-utils
65
121
66
122
# Show XML violations inline in the file diff.
67
- # @link https://github.com/marketplace/actions/xmllint-problem-matcher
68
123
- name : Enable showing XML issues inline
69
124
uses : korelstar/xmllint-problem-matcher@v1
70
125
71
- # Validate the Ruleset XML file.
72
- # @link http://xmlsoft.org/xmllint.html
73
- - name : Validate rulesets against schema
74
- run : xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
75
-
76
126
# Check the code-style consistency of the XML ruleset files.
77
127
- name : Check XML code style
78
128
run : |
79
129
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
80
130
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
81
131
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
82
132
83
- # Validate the Documentation XML files.
84
- - name : Validate documentation against schema
85
- run : xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./*/Docs/*/*Standard.xml
86
-
87
- # Check the code-style consistency of the PHP files.
88
- - name : Check PHP code style
89
- id : phpcs
90
- run : vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
91
-
92
- - name : Show PHPCS results in PR
93
- if : ${{ always() && steps.phpcs.outcome == 'failure' }}
94
- run : cs2pr ./phpcs-report.xml
95
-
96
- # Check that the sniffs available are feature complete.
97
- # For now, just check that all sniffs have unit tests.
98
- # At a later stage the documentation check can be activated.
99
- - name : Check sniff feature completeness
100
- run : composer check-complete
101
-
102
133
phpstan :
103
134
name : " PHPStan"
104
135
uses : PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
0 commit comments