@@ -69,33 +69,25 @@ jobs:
6969 # Keys:
7070 # - custom_ini: Whether to run with specific custom ini settings to hit very specific
7171 # code conditions.
72- # - coverage: Whether to run the tests with code coverage.
7372 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']
7574 custom_ini : [false]
76- coverage : [false]
7775
7876 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.
8085 - php : ' 5.5'
8186 custom_ini : true
82- coverage : false
8387 - php : ' 7.0'
8488 custom_ini : true
85- coverage : false
8689
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' || '' }}"
9991
10092 continue-on-error : ${{ matrix.php == '8.4' }}
10193
@@ -121,10 +113,9 @@ jobs:
121113 with :
122114 php-version : ${{ matrix.php }}
123115 ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
124- coverage : ${{ matrix.coverage == true && 'xdebug' || ' none' }}
116+ coverage : ' none'
125117 tools : cs2pr
126118
127- # This action also handles the caching of the dependencies.
128119 - name : Set up node and enable caching of dependencies
129120 uses : actions/setup-node@v4
130121 with :
@@ -140,18 +131,9 @@ jobs:
140131 # Install dependencies and handle caching in one go.
141132 # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
142133 - name : Install Composer dependencies
143- if : ${{ matrix.php != '8.4' }}
144134 uses : " ramsey/composer-install@v2"
145135 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' || '' }}
155137 custom-cache-suffix : $(date -u "+%Y-%m")
156138
157139 # Note: The code style check is run multiple times against every PHP version
@@ -160,13 +142,9 @@ jobs:
160142 run : php bin/phpcs --config-set php_path php
161143
162144 - name : ' PHPUnit: run the tests without code coverage'
163- if : ${{ matrix.coverage == false }}
145+ if : ${{ matrix.skip_tests != true }}
164146 run : vendor/bin/phpunit tests/AllTests.php --no-coverage
165147
166- - name : ' PHPUnit: run the tests with code coverage'
167- if : ${{ matrix.coverage == true }}
168- run : vendor/bin/phpunit tests/AllTests.php
169-
170148 - name : ' PHPCS: check code style without cache, no parallel'
171149 if : ${{ matrix.custom_ini == false && matrix.php != '7.4' }}
172150 run : php bin/phpcs --no-cache --parallel=1
@@ -181,6 +159,7 @@ jobs:
181159 run : cs2pr ./phpcs-report.xml
182160
183161 - name : Download the PHPCS phar
162+ if : ${{ matrix.custom_ini == false }}
184163 uses : actions/download-artifact@v3
185164 with :
186165 name : phpcs-phar
@@ -190,8 +169,74 @@ jobs:
190169 if : ${{ matrix.custom_ini == false }}
191170 run : php phpcs.phar
192171
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+
193238 - name : Upload coverage results to Coveralls
194- if : ${{ success() && matrix.coverage == true }}
239+ if : ${{ success() }}
195240 uses : coverallsapp/github-action@v2
196241 with :
197242 format : clover
@@ -200,8 +245,8 @@ jobs:
200245 parallel : true
201246
202247 coveralls-finish :
203- needs : test
204- if : always() && needs.test .result == 'success'
248+ needs : coverage
249+ if : always() && needs.coverage .result == 'success'
205250
206251 runs-on : ubuntu-latest
207252
0 commit comments