89
89
# - custom_ini: Whether to run with specific custom ini settings to hit very specific
90
90
# code conditions.
91
91
matrix :
92
+ os : ['ubuntu-latest', 'windows-latest']
92
93
php : ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
93
94
custom_ini : [false]
94
95
@@ -102,9 +103,11 @@ jobs:
102
103
103
104
# Extra builds running only the unit tests with different PHP ini settings.
104
105
- php : ' 7.4'
106
+ os : ' ubuntu-latest'
105
107
custom_ini : true
106
108
107
- name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
109
+ # yamllint disable-line rule:line-length
110
+ name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
108
111
109
112
continue-on-error : ${{ matrix.php == '8.5' }}
110
113
@@ -114,6 +117,7 @@ jobs:
114
117
115
118
- name : Setup ini config
116
119
id : set_ini
120
+ shell : bash
117
121
run : |
118
122
# Set the "short_open_tag" ini to make sure specific conditions are tested.
119
123
# Also turn on error_reporting to ensure all notices are shown.
@@ -142,20 +146,20 @@ jobs:
142
146
# Note: The code style check is run multiple times against every PHP version
143
147
# as it also acts as an integration test.
144
148
- name : ' PHPCS: set the path to PHP'
145
- run : php bin/phpcs --config-set php_path php
149
+ run : php " bin/phpcs" --config-set php_path php
146
150
147
- - name : ' PHPUnit: run the tests without code coverage'
151
+ - name : ' PHPUnit: run the full test suite without code coverage'
148
152
if : ${{ matrix.skip_tests != true }}
149
- run : vendor/bin/phpunit --no-coverage
153
+ run : php " vendor/bin/phpunit" --no-coverage
150
154
151
155
- name : ' PHPCS: check code style without cache, no parallel'
152
156
if : ${{ matrix.custom_ini == false && matrix.php != '7.4' }}
153
- run : php bin/phpcs --no-cache --parallel=1
157
+ run : php " bin/phpcs" --no-cache --parallel=1
154
158
155
159
- name : ' PHPCS: check code style to show results in PR'
156
160
if : ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
157
161
id : phpcs
158
- run : php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
162
+ run : php " bin/phpcs" --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
159
163
160
164
- name : Show PHPCS results in PR
161
165
if : ${{ always() && steps.phpcs.outcome == 'failure' && matrix.php == '7.4' }}
@@ -173,40 +177,42 @@ jobs:
173
177
run : php phpcs.phar
174
178
175
179
coverage :
176
- runs-on : ubuntu-latest
180
+ runs-on : ${{ matrix.os }}
177
181
178
182
strategy :
179
183
matrix :
184
+ os : ['ubuntu-latest', 'windows-latest']
185
+ php : ['7.2', '8.4']
186
+ custom_ini : [false]
187
+
180
188
include :
181
- - php : ' 7.2 '
182
- custom_ini : false
189
+
190
+ # Also run one coverage build with custom ini settings.
183
191
- php : ' 8.1'
184
192
custom_ini : true
185
- - php : ' 8.4'
186
- custom_ini : false
187
193
188
- name : " Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
194
+ # yamllint disable-line rule:line-length
195
+ name : " Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
189
196
190
197
steps :
191
198
- name : Checkout code
192
199
uses : actions/checkout@v4
193
200
194
201
- name : Setup ini config
202
+ if : ${{ matrix.os != 'windows-latest' }}
195
203
id : set_ini
204
+ shell : bash
196
205
run : |
197
206
# Set the "short_open_tag" ini to make sure specific conditions are tested.
198
- # Also turn on error_reporting to ensure all notices are shown.
199
207
if [[ ${{ matrix.custom_ini }} == true ]]; then
200
- echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On' >> "$GITHUB_OUTPUT"
201
- else
202
- echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
208
+ echo 'PHP_INI=, date.timezone=Australia/Sydney, short_open_tag=On' >> "$GITHUB_OUTPUT"
203
209
fi
204
210
205
211
- name : Install PHP
206
212
uses : shivammathur/setup-php@v2
207
213
with :
208
214
php-version : ${{ matrix.php }}
209
- ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
215
+ ini-values : error_reporting=-1, display_errors=On ${{ steps.set_ini.outputs.PHP_INI }}
210
216
coverage : xdebug
211
217
212
218
# Install dependencies and handle caching in one go.
@@ -219,38 +225,47 @@ jobs:
219
225
220
226
- name : Grab PHPUnit version
221
227
id : phpunit_version
228
+ shell : bash
222
229
# yamllint disable-line rule:line-length
223
- run : echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
230
+ run : echo "VERSION=$(php " vendor/bin/phpunit" --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
224
231
225
232
- name : " DEBUG: Show grabbed version"
226
233
run : echo ${{ steps.phpunit_version.outputs.VERSION }}
227
234
228
235
- name : ' PHPCS: set the path to PHP'
229
- run : php bin/phpcs --config-set php_path php
236
+ run : php " bin/phpcs" --config-set php_path php
230
237
231
238
# PHPUnit 9.3 started using PHP-Parser for code coverage, which can cause issues due to Parser
232
239
# also polyfilling PHP tokens.
233
240
# As of PHPUnit 9.3.4, a cache warming option is available.
234
241
# Using that option prevents issues with PHP-Parser backfilling PHP tokens during our test runs.
235
242
- name : " Warm the PHPUnit cache (PHPUnit 9.3+)"
236
243
if : ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
237
- run : vendor/bin/phpunit --coverage-cache ./build/phpunit-cache --warm-coverage-cache
244
+ run : php " vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache --warm-coverage-cache
238
245
239
246
- name : " Run the unit tests with code coverage (PHPUnit < 9.3)"
240
- if : ${{ steps.phpunit_version.outputs.VERSION < '9.3' }}
241
- run : vendor/bin/phpunit
247
+ if : ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
248
+ run : php " vendor/bin/phpunit"
242
249
243
250
- name : " Run the unit tests with code coverage (PHPUnit 9.3+)"
244
- if : ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
245
- run : vendor/bin/phpunit --coverage-cache ./build/phpunit-cache
251
+ if : ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
252
+ run : php "vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache
253
+
254
+ - name : " Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
255
+ if : ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
256
+ run : php "vendor/bin/phpunit" --group Windows
257
+
258
+ - name : " Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
259
+ if : ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
260
+ run : php "vendor/bin/phpunit" --group Windows --coverage-cache ./build/phpunit-cache
246
261
247
262
- name : Upload coverage results to Coveralls
248
263
if : ${{ success() }}
249
264
uses : coverallsapp/github-action@v2
250
265
with :
251
266
format : clover
252
267
file : build/logs/clover.xml
253
- flag-name : php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
268
+ flag-name : os-${{ matrix.os }}- php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
254
269
parallel : true
255
270
256
271
coveralls-finish :
0 commit comments