@@ -55,27 +55,45 @@ jobs:
5555 # Bust the cache at least once a month - output format: YYYY-MM.
5656 custom-cache-suffix : $(date -u "+%Y-%m")
5757
58- # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
59- # This should not be blocking for this job, so ignore any errors from this step.
60- # Ref: https://github.com/dotnet/core/issues/4167
61- - name : Update the available packages list
62- continue-on-error : true
63- run : sudo apt-get update
64-
65- - name : Install xmllint
66- run : sudo apt-get install --no-install-recommends -y libxml2-utils
67-
68- # Show XML violations inline in the file diff.
69- # @link https://github.com/marketplace/actions/xmllint-problem-matcher
70- - name : Enable showing XML issues inline
71- uses : korelstar/xmllint-problem-matcher@v1
72-
73- # Validate the XML file.
74- # @link http://xmlsoft.org/xmllint.html
75- - name : Validate rulesets against schema
76- run : xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
58+ # Validate the XML files.
59+ - name : Validate ruleset XML against schema
60+ uses : phpcsstandards/xmllint-validate@v1
61+ with :
62+ pattern : " ./*/ruleset.xml"
63+ xsd-file : " vendor/squizlabs/php_codesniffer/phpcs.xsd"
64+
65+ - name : Validate Project PHPCS ruleset against schema
66+ uses : phpcsstandards/xmllint-validate@v1
67+ with :
68+ pattern : " phpcs.xml.dist"
69+ xsd-file : " vendor/squizlabs/php_codesniffer/phpcs.xsd"
70+
71+ - name : " Validate PHPUnit < 10 config for use with PHPUnit 8"
72+ uses : phpcsstandards/xmllint-validate@v1
73+ with :
74+ pattern : " phpunit.xml.dist"
75+ xsd-file : " vendor/phpunit/phpunit/schema/8.5.xsd"
76+
77+ - name : " Validate PHPUnit < 10 config for use with PHPUnit 9"
78+ uses : phpcsstandards/xmllint-validate@v1
79+ with :
80+ pattern : " phpunit.xml.dist"
81+ xsd-file : " vendor/phpunit/phpunit/schema/9.2.xsd"
82+
83+ - name : " Validate PHPUnit 10+ config for use with PHPUnit 10"
84+ uses : phpcsstandards/xmllint-validate@v1
85+ with :
86+ pattern : " phpunit10.xml.dist"
87+ xsd-file : " vendor/phpunit/phpunit/schema/10.5.xsd"
88+
89+ - name : " Validate PHPUnit 10+ config for use with PHPUnit 11"
90+ uses : phpcsstandards/xmllint-validate@v1
91+ with :
92+ pattern : " phpunit10.xml.dist"
93+ xsd-file : " vendor/phpunit/phpunit/phpunit.xsd"
7794
7895 # Check the code-style consistency of the XML file.
96+ # Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
7997 - name : Check XML code style
8098 run : diff -B ./PHPCSUtils/ruleset.xml <(xmllint --format "./PHPCSUtils/ruleset.xml")
8199
@@ -90,120 +108,20 @@ jobs:
90108
91109 phpstan :
92110 name : " PHPStan"
93- runs-on : " ubuntu-latest"
94-
95- steps :
96- - name : Checkout code
97- uses : actions/checkout@v4
98-
99- - name : Install PHP
100- uses : shivammathur/setup-php@v2
101- with :
102- php-version : ' latest'
103- coverage : none
104- tools : phpstan
105-
106- # Install dependencies and handle caching in one go.
107- # Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
108- # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
109- - name : Install Composer dependencies
110- uses : " ramsey/composer-install@v3"
111- with :
112- # Bust the cache at least once a month - output format: YYYY-MM.
113- custom-cache-suffix : $(date -u "+%Y-%m")
114-
115- - name : Run PHPStan
116- run : phpstan analyse
111+ uses : PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main
112+ with :
113+ phpstanVersion : ' 2.x'
117114
118115 markdownlint :
119116 name : ' Lint Markdown'
120- runs-on : ubuntu-latest
121-
122- steps :
123- - name : Checkout code
124- uses : actions/checkout@v4
125-
126- # @link https://github.com/marketplace/actions/problem-matcher-for-markdownlint-cli
127- - name : Enable showing issue in PRs
128- uses : xt0rted/markdownlint-problem-matcher@v3
129-
130- # @link https://github.com/marketplace/actions/markdownlint-cli2-action
131- - name : Check markdown with CLI2
132- uses : DavidAnson/markdownlint-cli2-action@v16
117+ uses : PHPCSStandards/.github/.github/workflows/reusable-markdownlint.yml@main
133118
134119 remark :
135120 name : ' QA Markdown'
136- runs-on : ubuntu-latest
137-
138- steps :
139- - name : Checkout code
140- uses : actions/checkout@v4
141-
142- - name : Set up node and enable caching of dependencies
143- uses : actions/setup-node@v4
144- with :
145- node-version : ' 16'
146-
147- # To make the command available on CLI, it needs to be installed globally.
148- - name : Install Remark CLI globally
149- run : npm install --global remark-cli --foreground-scripts true --fund false
150-
151- # To allow for creating a custom config which references rules which are included
152- # in the presets, without having to install all rules individually, a local install
153- # works best (and installing the presets in the first place, of course).
154- #
155- # Note: the first group of packages are all part of the mono "Remark lint" repo.
156- # The second group of packages (heading-whitespace and down) are additional
157- # "external" rules/plugins.
158- - name : Install Remark rules locally
159- run : >
160- npm install --foreground-scripts true --fund false
161- remark-lint
162- remark-gfm
163- remark-preset-lint-consistent
164- remark-preset-lint-recommended
165- remark-preset-lint-markdown-style-guide
166- remark-lint-checkbox-content-indent
167- remark-lint-linebreak-style
168- remark-lint-no-dead-urls
169- remark-lint-no-duplicate-defined-urls
170- remark-lint-no-empty-url
171- remark-lint-no-heading-like-paragraph
172- remark-lint-no-reference-like-url
173- remark-lint-no-unneeded-full-reference-image
174- remark-lint-no-unneeded-full-reference-link
175- remark-lint-strikethrough-marker
176- remark-lint-heading-whitespace
177- remark-lint-list-item-punctuation
178- remark-lint-match-punctuation
179- remark-lint-no-hr-after-heading
180- remark-lint-are-links-valid-duplicate
181- remark-validate-links
182-
183- - name : Run Remark-lint
184- run : remark . --frail
185-
186- # @link https://github.com/reviewdog/action-remark-lint
187- - name : Show Remark-lint annotations in PR
188- if : ${{ failure() && github.event_name == 'pull_request' }}
189- uses : reviewdog/action-remark-lint@v5
190- with :
191- fail_on_error : true
192- install_deps : false
193- level : info
194- reporter : github-pr-check
121+ uses : PHPCSStandards/.github/.github/workflows/reusable-remark.yml@main
195122
196123 yamllint :
197124 name : ' Lint Yaml'
198- runs-on : ubuntu-latest
199-
200- steps :
201- - name : Checkout code
202- uses : actions/checkout@v4
203-
204- - name : Run Yamllint on all yaml files in repo
205- run : yamllint . --format colored --strict
206-
207- - name : Pipe Yamllint results on to GH for inline display
208- if : ${{ failure() }}
209- run : yamllint . --format github --strict
125+ uses : PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
126+ with :
127+ strict : true
0 commit comments