Tests #68
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: '20 16 * * SUN' | |
jobs: | |
tests: | |
name: PHPUnit (PHP ${{ matrix.php-version }}) ${{ matrix.lowest-dependencies && '(lowest deps)' || '' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
lowest-dependencies: [true, false] | |
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] | |
include: | |
- php-version: '7.4' | |
lowest-dependencies: false | |
coverage: true | |
env: | |
COMPOSER_FLAGS: ${{ matrix.lowest-dependencies && '--prefer-lowest' || '' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
coverage: ${{ matrix.coverage && 'pcov' || 'none' }} | |
- name: Determine Composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Load Composer cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: | | |
composer update --no-interaction --prefer-dist ${{ env.COMPOSER_FLAGS }} | |
composer update --no-interaction --prefer-dist --with-all-dependencies phpunit/phpunit | |
- name: Run PHPUnit | |
run: vendor/bin/phpunit --testdox ${{ !matrix.coverage && '--no-coverage' || '--coverage-clover coverage.xml' }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
if: ${{ matrix.coverage }} | |
with: | |
file: ./coverage.xml |