name: run-tests
on:
push:
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
php: [8.3, 8.4]
laravel: [11, 12, 13]
stability: [prefer-lowest, prefer-stable]
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} (w/ ${{ matrix.stability }})
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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, intl, fileinfo
coverage: none
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Set Laravel version
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "illuminate/support:^${{ matrix.laravel }}" --no-interaction --no-update
- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List installed dependencies
run: composer show -D
- name: Execute tests
run: vendor/bin/pest --ci
coverage:
runs-on: ubuntu-latest
timeout-minutes: 5
name: Code Coverage
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo
coverage: pcov
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction
- name: Execute tests with coverage
run: vendor/bin/pest --coverage --coverage-clover=coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: false
|