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
@@ -48,36 +47,41 @@ jobs:
4847 # Install dependencies and handle caching in one go.
4948 # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
5049 - name : Install Composer dependencies
51- uses : " ramsey/composer-install@v2 "
50+ uses : " ramsey/composer-install@v3 "
5251 with :
5352 # Bust the cache at least once a month - output format: YYYY-MM.
5453 custom-cache-suffix : $(date -u "+%Y-%m")
5554
56- - name : Install xmllint
57- run : |
58- sudo apt-get update
59- sudo apt-get install --no-install-recommends -y libxml2-utils
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"
6061
61- # Show XML violations inline in the file diff.
62- # @link https://github.com/marketplace/actions/xmllint-problem-matcher
63- - name : Enable showing XML issues inline
64- uses : korelstar/xmllint-problem-matcher@v1
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"
6567
66- # Validate the Ruleset XML file.
67- # @link http://xmlsoft.org/xmllint.html
68- - name : Validate rulesets against schema
69- run : xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
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"
7073
71- # Check the code-style consistency of the XML ruleset files.
72- - name : Check XML code style
73- run : |
74- diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
75- diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
76- diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
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"
7779
78- # Validate the Documentation XML files.
79- - name : Validate documentation against schema
80- run : xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./*/Docs/*/*Standard.xml
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"
8185
8286 # Check the code-style consistency of the PHP files.
8387 - name : Check PHP code style
@@ -94,107 +98,50 @@ jobs:
9498 - name : Check sniff feature completeness
9599 run : composer check-complete
96100
97- phpstan :
98- name : " PHPStan"
99- runs-on : " ubuntu-latest"
101+ xml-cs :
102+ name : ' XML Code style'
103+ runs-on : ubuntu-latest
104+
105+ env :
106+ XMLLINT_INDENT : ' '
100107
101108 steps :
102109 - name : Checkout code
103110 uses : actions/checkout@v4
104111
105- - name : Install PHP
106- uses : shivammathur/setup-php@v2
107- with :
108- php-version : ' latest '
109- coverage : none
110- tools : phpstan
112+ # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
113+ # This should not be blocking for this job, so ignore any errors from this step.
114+ # Ref: https://github.com/dotnet/core/issues/4167
115+ - name : Update the available packages list
116+ continue-on-error : true
117+ run : sudo apt-get update
111118
112- # Install dependencies and handle caching in one go.
113- # Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
114- # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
115- - name : Install Composer dependencies
116- uses : " ramsey/composer-install@v2"
117- with :
118- # Bust the cache at least once a month - output format: YYYY-MM.
119- custom-cache-suffix : $(date -u "+%Y-%m")
119+ - name : Install xmllint
120+ run : sudo apt-get install --no-install-recommends -y libxml2-utils
120121
121- - name : Run PHPStan
122- run : phpstan analyse
122+ # Show XML violations inline in the file diff.
123+ - name : Enable showing XML issues inline
124+ uses : korelstar/xmllint-problem-matcher@v1
123125
124- remark :
125- name : ' QA Markdown'
126- runs-on : ubuntu-latest
126+ # Check the code-style consistency of the XML ruleset files.
127+ - name : Check XML code style
128+ run : |
129+ diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
130+ diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
131+ diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
127132
128- steps :
129- - name : Checkout code
130- uses : actions/checkout@v4
133+ phpstan :
134+ name : " PHPStan"
135+ uses : PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
136+ with :
137+ phpstanVersion : ' 2.x'
131138
132- - name : Set up node and enable caching of dependencies
133- uses : actions/setup-node@v4
134- with :
135- node-version : ' 16'
136-
137- # To make the command available on CLI, it needs to be installed globally.
138- - name : Install Remark CLI globally
139- run : npm install --global remark-cli --foreground-scripts true --fund false
140-
141- # To allow for creating a custom config which references rules which are included
142- # in the presets, without having to install all rules individually, a local install
143- # works best (and installing the presets in the first place, of course).
144- #
145- # Note: the first group of packages are all part of the mono "Remark lint" repo.
146- # The second group of packages (heading-whitespace and down) are additional
147- # "external" rules/plugins.
148- - name : Install Remark rules locally
149- run : >
150- npm install --foreground-scripts true --fund false
151- remark-lint
152- remark-gfm
153- remark-preset-lint-consistent
154- remark-preset-lint-recommended
155- remark-preset-lint-markdown-style-guide
156- remark-lint-checkbox-content-indent
157- remark-lint-linebreak-style
158- remark-lint-no-duplicate-defined-urls
159- remark-lint-no-empty-url
160- remark-lint-no-heading-like-paragraph
161- remark-lint-no-reference-like-url
162- remark-lint-no-unneeded-full-reference-image
163- remark-lint-no-unneeded-full-reference-link
164- remark-lint-strikethrough-marker
165- remark-lint-heading-whitespace
166- remark-lint-list-item-punctuation
167- remark-lint-match-punctuation
168- remark-lint-no-dead-urls
169- remark-lint-no-hr-after-heading
170- remark-lint-are-links-valid-duplicate
171- remark-validate-links
172-
173- - name : Run Remark-lint
174- run : remark . --frail
175-
176- # @link https://github.com/reviewdog/action-remark-lint
177- - name : Show Remark-lint annotations in PR
178- if : ${{ failure() && github.event_name == 'pull_request' }}
179- uses : reviewdog/action-remark-lint@v5
180- with :
181- fail_on_error : true
182- install_deps : false
183- level : info
184- reporter : github-pr-check
139+ remark :
140+ name : ' QA Markdown'
141+ uses : PHPCSStandards/.github/.github/workflows/reusable-remark.yml@main
185142
186143 yamllint :
187144 name : ' Lint Yaml'
188- runs-on : ubuntu-latest
189-
190- steps :
191- - name : Checkout code
192- uses : actions/checkout@v4
193-
194- # Ref: https://yamllint.readthedocs.io/en/stable/
195- - name : Run Yamllint on all yaml files in repo
196- run : yamllint . --format colored
197-
198- - name : Pipe Yamllint results on to GH for inline display
199- if : ${{ failure() }}
200- run : yamllint . --format github
145+ uses : PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
146+ with :
147+ strict : true
0 commit comments