Ocular on PHP v8 #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: run-tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.1, 8.2, 8.3] | |
laravel: [^10.0, ^11.0] | |
include: | |
- laravel: ^11.0 | |
testbench: 9.0.2 | |
- laravel: ^10.0 | |
testbench: ^8.0 | |
exclude: | |
- laravel: ^11.0 | |
php: 8.1 | |
name: P ${{ matrix.php }} L ${{ matrix.laravel }} T ${{ matrix.testbench }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, pcov | |
tools: composer:v2 | |
coverage: pcov | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache/files | |
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
- name: Install dependencies | |
run: | | |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-progress --no-update | |
composer update --prefer-dist --no-interaction --no-progress | |
- name: Create tests database | |
run: | | |
mkdir -p database | |
touch database/database.sqlite | |
- name: Execute tests, generate code coverage report | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: database/database.sqlite | |
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | |
- name: Save code coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage.clover | |
overwrite: true | |
coverage: | |
needs: tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.2] | |
name: Coverage P${{ matrix.php }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Retrieve code coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
- name: Upload code coverage report | |
run: | | |
composer global require scrutinizer/ocular | |
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage-clover.xml |