@@ -69,16 +69,31 @@ 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.
72
73
matrix :
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']
74
+ php : ['5.5 ', '5.6', '7.0', '7.1', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4']
74
75
custom_ini : [false]
76
+ coverage : [false]
75
77
76
78
include :
77
79
# Builds running the basic tests with different PHP ini settings.
78
80
- php : ' 5.5'
79
81
custom_ini : true
82
+ coverage : false
80
83
- php : ' 7.0'
81
84
custom_ini : true
85
+ coverage : false
86
+
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
82
97
83
98
name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
84
99
93
108
run : |
94
109
# Set the "short_open_tag" ini to make sure specific conditions are tested.
95
110
# Also turn on error_reporting to ensure all notices are shown.
96
- if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.5' ]]; then
111
+ if [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '5.' ) }}" == true ]]; then
97
112
echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' >> $GITHUB_OUTPUT
98
- elif [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.0' ]]; then
113
+ elif [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '7.' ) }}" == true ]]; then
99
114
echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On' >> $GITHUB_OUTPUT
100
115
else
101
116
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
@@ -106,7 +121,7 @@ jobs:
106
121
with :
107
122
php-version : ${{ matrix.php }}
108
123
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
109
- coverage : none
124
+ coverage : ${{ matrix.coverage == true && 'xdebug' || ' none' }}
110
125
tools : cs2pr
111
126
112
127
# This action also handles the caching of the dependencies.
@@ -144,7 +159,12 @@ jobs:
144
159
- name : ' PHPCS: set the path to PHP'
145
160
run : php bin/phpcs --config-set php_path php
146
161
147
- - name : ' PHPUnit: run the tests'
162
+ - name : ' PHPUnit: run the tests without code coverage'
163
+ if : ${{ matrix.coverage == false }}
164
+ run : vendor/bin/phpunit tests/AllTests.php --no-coverage
165
+
166
+ - name : ' PHPUnit: run the tests with code coverage'
167
+ if : ${{ matrix.coverage == true }}
148
168
run : vendor/bin/phpunit tests/AllTests.php
149
169
150
170
- name : ' PHPCS: check code style without cache, no parallel'
@@ -169,3 +189,24 @@ jobs:
169
189
- name : ' PHPCS: check code style using the Phar file'
170
190
if : ${{ matrix.custom_ini == false }}
171
191
run : php phpcs.phar
192
+
193
+ - name : Upload coverage results to Coveralls
194
+ if : ${{ success() && matrix.coverage == true }}
195
+ uses : coverallsapp/github-action@v2
196
+ with :
197
+ format : clover
198
+ file : build/logs/clover.xml
199
+ flag-name : php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
200
+ parallel : true
201
+
202
+ coveralls-finish :
203
+ needs : test
204
+ if : always() && needs.test.result == 'success'
205
+
206
+ runs-on : ubuntu-latest
207
+
208
+ steps :
209
+ - name : Coveralls Finished
210
+ uses : coverallsapp/github-action@v2
211
+ with :
212
+ parallel-finished : true
0 commit comments