feat!: drop PHP 8.1 support (#217) #821
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: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
php: [8.2, 8.3] | |
laravel: [10.*] | |
stability: [prefer-lowest, prefer-stable] | |
include: | |
- laravel: 10.* | |
testbench: 8.* | |
services: | |
mysql: | |
image: mysql:9.1 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: test | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
name: Unit tests - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache Composer packages | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: php-${{ hashFiles('**/composer.lock') }} | |
- 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, fileinfo | |
coverage: pcov | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup problem matchers | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Install dependencies | |
run: | | |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --ignore-platform-reqs | |
composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
- name: Execute tests | |
run: | | |
mkdir build | |
composer test | |
env: | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
if: ${{ matrix.os != 'ubuntu-latest' || matrix.php != 8.2 || matrix.stability != 'prefer-stable' }} | |
- name: Execute tests with code coverage | |
run: | | |
composer test-coverage | |
env: | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.php == 8.2 && matrix.stability == 'prefer-stable' }} | |
- name: Save code coverage to artifact | |
uses: actions/upload-artifact@v4 | |
if: matrix.php == 8.2 | |
with: | |
name: code-coverage | |
path: "coverage.xml" | |
retention-days: 5 | |
upload-coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch code coverage artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |