Coverage v2 workflow #8397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Coverage v2 workflow | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: '30 2/5 * * *' | |
jobs: | |
run: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-24.04, windows-latest, macos-latest] | |
php-versions: ['5.3', '5.5', '5.6', '7.2', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
coverage: [xdebug, pcov, none] | |
include: | |
- operating-system: ubuntu-24.04 | |
php-versions: '7.4' | |
coverage: xdebug2 | |
- operating-system: windows-latest | |
php-versions: '7.4' | |
coverage: xdebug2 | |
- operating-system: macos-latest | |
php-versions: '7.4' | |
coverage: xdebug2 | |
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} with ${{ matrix.coverage }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@verbose | |
with: | |
php-version: ${{ matrix.php-versions }} | |
ini-values: "post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata" | |
coverage: ${{ matrix.coverage }} | |
- name: Add Problem Matcher | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Test action side effects | |
run: php -r "if(strpos(@exec('git status'), 'nothing to commit') === false) {throw new Exception('Action has side effects');}" | |
- name: Testing PHP version | |
run: | | |
php -v | |
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}" | |
- name: Testing Composer version | |
run: php -r "if(preg_match('/.*Composer.* 2.*/', @exec('composer -V')) == 0) {throw new Exception('Wrong composer version');}" | |
- name: Testing Xdebug | |
if: matrix.coverage == 'xdebug3' || matrix.php-version == '8.0' | |
run: php -r "if(strpos(phpversion('xdebug'), '3.') === false) {throw new Exception('Wrong Xdebug version Installed');}" | |
- name: Testing ini values | |
run: | | |
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}" | |
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}" | |
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}" | |
- name: Testing Coverage if PCOV | |
if: matrix.coverage == 'pcov' | |
run: | | |
php -r "if(phpversion()>=7.1 && ini_get('pcov.enabled')!=1) {throw new Exception('PCOV not enabled');}" | |
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}" | |
php -v | |
- name: Testing Coverage if Xdebug | |
if: matrix.coverage == 'xdebug' | |
run: | | |
php -r "if(! extension_loaded('xdebug')) {throw new Exception('Xdebug not found');}" | |
php -v | |
- name: Testing Coverage if Xdebug2 | |
if: matrix.coverage == 'xdebug2' | |
run: | | |
php -r "if(! extension_loaded('xdebug')) {throw new Exception('Xdebug not found');}" | |
php -r "if(phpversion('xdebug') != '2.9.8') {throw new Exception('Xdebug version wrong');}" | |
php -v | |
- name: Testing disabling coverage | |
if: matrix.coverage == 'none' | |
run: | | |
php -r "if(extension_loaded('xdebug')) {throw new Exception('Xdebug found');}" | |
php -r "if(extension_loaded('pcov')) {throw new Exception('PCOV found');}" | |
php -v |