Execute tests when we need no coverage #251
Workflow file for this run
This file contains hidden or 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: CI | |
on: [push, pull_request] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['8.0', '8.1', '8.3', '8.4'] | |
include: | |
- php: '8.2' | |
coverage: 'true' | |
name: PHP ${{ matrix.php }} tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: mbstring, json | |
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} | |
- name: Install dependencies | |
run: composer update --no-interaction | |
- name: Execute tests | |
if: ${{ ! matrix.coverage }} | |
run: | | |
./vendor/bin/phpunit --testdox | |
- name: Upload the reports to codeclimate | |
if: ${{ matrix.coverage }} | |
env: | |
XDEBUG_MODE: coverage | |
CC_TEST_REPORTER_ID: 5e32818628fac9eb11d34e2b35289f88169610cc4a98c6f170c74923342284f1 | |
uses: paambaati/codeclimate-action@v9 | |
with: | |
coverageCommand: | | |
./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --testdox | |
- name: Upload the reports to coveralls.io | |
if: ${{ matrix.coverage }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ github.token }} | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ env.COVERALLS_REPO_TOKEN }} | |
flag-name: Unit | |
allow-empty: false |