@@ -69,33 +69,25 @@ jobs:
69
69
# Keys:
70
70
# - custom_ini: Whether to run with specific custom ini settings to hit very specific
71
71
# code conditions.
72
- # - coverage: Whether to run the tests with code coverage.
73
72
matrix :
74
- php : ['5.5 ', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4']
73
+ php : ['5.4', '5.5 ', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3 ', '8.4']
75
74
custom_ini : [false]
76
- coverage : [false]
77
75
78
76
include :
79
- # Builds running the basic tests with different PHP ini settings.
77
+ # Skip test runs on builds which are also run for in the coverage job.
78
+ # Note: the tests on PHP 7.2 will still be run as the coverage build is uses custom_ini for that version.
79
+ - php : ' 5.4'
80
+ skip_tests : true
81
+ - php : ' 8.3'
82
+ skip_tests : true
83
+
84
+ # Extra builds running only the unit tests with different PHP ini settings.
80
85
- php : ' 5.5'
81
86
custom_ini : true
82
- coverage : false
83
87
- php : ' 7.0'
84
88
custom_ini : true
85
- coverage : false
86
89
87
- # Builds running the tests with code coverage.
88
- - php : ' 5.4'
89
- custom_ini : false
90
- coverage : true
91
- - php : ' 7.2'
92
- custom_ini : true
93
- coverage : true
94
- - php : ' 8.3'
95
- custom_ini : false
96
- coverage : true
97
-
98
- name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} ${{ matrix.coverage && '(cov)' || '' }}"
90
+ name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
99
91
100
92
continue-on-error : ${{ matrix.php == '8.4' }}
101
93
@@ -121,10 +113,9 @@ jobs:
121
113
with :
122
114
php-version : ${{ matrix.php }}
123
115
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
124
- coverage : ${{ matrix.coverage == true && 'xdebug' || ' none' }}
116
+ coverage : ' none'
125
117
tools : cs2pr
126
118
127
- # This action also handles the caching of the dependencies.
128
119
- name : Set up node and enable caching of dependencies
129
120
uses : actions/setup-node@v4
130
121
with :
@@ -140,18 +131,9 @@ jobs:
140
131
# Install dependencies and handle caching in one go.
141
132
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
142
133
- name : Install Composer dependencies
143
- if : ${{ matrix.php != '8.4' }}
144
134
uses : " ramsey/composer-install@v2"
145
135
with :
146
- # Bust the cache at least once a month - output format: YYYY-MM.
147
- custom-cache-suffix : $(date -u "+%Y-%m")
148
-
149
- # For PHP "nightly", we install with ignore platform reqs.
150
- - name : Install Composer dependencies - with ignore platform
151
- if : ${{ matrix.php == '8.4' }}
152
- uses : " ramsey/composer-install@v2"
153
- with :
154
- composer-options : --ignore-platform-req=php
136
+ composer-options : ${{ matrix.php == '8.4' && '--ignore-platform-req=php' || '' }}
155
137
custom-cache-suffix : $(date -u "+%Y-%m")
156
138
157
139
# Note: The code style check is run multiple times against every PHP version
@@ -160,13 +142,9 @@ jobs:
160
142
run : php bin/phpcs --config-set php_path php
161
143
162
144
- name : ' PHPUnit: run the tests without code coverage'
163
- if : ${{ matrix.coverage == false }}
145
+ if : ${{ matrix.skip_tests != true }}
164
146
run : vendor/bin/phpunit tests/AllTests.php --no-coverage
165
147
166
- - name : ' PHPUnit: run the tests with code coverage'
167
- if : ${{ matrix.coverage == true }}
168
- run : vendor/bin/phpunit tests/AllTests.php
169
-
170
148
- name : ' PHPCS: check code style without cache, no parallel'
171
149
if : ${{ matrix.custom_ini == false && matrix.php != '7.4' }}
172
150
run : php bin/phpcs --no-cache --parallel=1
@@ -181,6 +159,7 @@ jobs:
181
159
run : cs2pr ./phpcs-report.xml
182
160
183
161
- name : Download the PHPCS phar
162
+ if : ${{ matrix.custom_ini == false }}
184
163
uses : actions/download-artifact@v3
185
164
with :
186
165
name : phpcs-phar
@@ -190,8 +169,74 @@ jobs:
190
169
if : ${{ matrix.custom_ini == false }}
191
170
run : php phpcs.phar
192
171
172
+ coverage :
173
+ runs-on : ubuntu-latest
174
+
175
+ strategy :
176
+ matrix :
177
+ include :
178
+ - php : ' 5.4'
179
+ custom_ini : false
180
+ - php : ' 7.2'
181
+ custom_ini : true
182
+ - php : ' 8.3'
183
+ custom_ini : false
184
+
185
+ name : " Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
186
+
187
+ steps :
188
+ - name : Checkout code
189
+ uses : actions/checkout@v4
190
+
191
+ - name : Setup ini config
192
+ id : set_ini
193
+ run : |
194
+ # Set the "short_open_tag" ini to make sure specific conditions are tested.
195
+ # Also turn on error_reporting to ensure all notices are shown.
196
+ if [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '5.' ) }}" == true ]]; then
197
+ echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' >> $GITHUB_OUTPUT
198
+ elif [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '7.' ) }}" == true ]]; then
199
+ echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On' >> $GITHUB_OUTPUT
200
+ else
201
+ echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
202
+ fi
203
+
204
+ - name : Install PHP
205
+ uses : shivammathur/setup-php@v2
206
+ with :
207
+ php-version : ${{ matrix.php }}
208
+ ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
209
+ coverage : xdebug
210
+
211
+ # This action also handles the caching of the dependencies.
212
+ - name : Set up node
213
+ uses : actions/setup-node@v4
214
+ with :
215
+ node-version : ' 20'
216
+
217
+ - name : Install external tools used in tests
218
+ run : >
219
+ npm install -g --fund false
220
+ csslint
221
+ eslint
222
+ jshint
223
+
224
+ # Install dependencies and handle caching in one go.
225
+ # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
226
+ - name : Install Composer dependencies
227
+ uses : " ramsey/composer-install@v2"
228
+ with :
229
+ # Bust the cache at least once a month - output format: YYYY-MM.
230
+ custom-cache-suffix : $(date -u "+%Y-%m")
231
+
232
+ - name : ' PHPCS: set the path to PHP'
233
+ run : php bin/phpcs --config-set php_path php
234
+
235
+ - name : ' PHPUnit: run the tests with code coverage'
236
+ run : vendor/bin/phpunit tests/AllTests.php
237
+
193
238
- name : Upload coverage results to Coveralls
194
- if : ${{ success() && matrix.coverage == true }}
239
+ if : ${{ success() }}
195
240
uses : coverallsapp/github-action@v2
196
241
with :
197
242
format : clover
@@ -200,8 +245,8 @@ jobs:
200
245
parallel : true
201
246
202
247
coveralls-finish :
203
- needs : test
204
- if : always() && needs.test .result == 'success'
248
+ needs : coverage
249
+ if : always() && needs.coverage .result == 'success'
205
250
206
251
runs-on : ubuntu-latest
207
252
0 commit comments