Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 33 additions & 15 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,54 @@ on:
branches: [master]

jobs:

phpunit:
name: PHPUnit
name: PHPUnit - PHP ${{ matrix.php-version }} - ${{ matrix.dependency-versions }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
dependency-versions:
- "lowest"
- "highest"
php-version: ["8.1", "8.2", "8.3"]
dependency-versions: ["lowest", "highest"]

steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
coverage: ${{ (matrix.php-version == '8.3' && matrix.dependency-versions == 'highest') && 'xdebug' || 'none' }}

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ matrix.dependency-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ matrix.dependency-versions }}-

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}

- name: Install composer dependencies
run: composer install --prefer-dist --no-progress
- name: Run static analysis (PHPStan)
run: vendor/bin/phpstan analyse --level=5 src/
continue-on-error: true

- name: Run PHPUnit
if: matrix.php-version != '8.3' || matrix.dependency-versions != 'highest'
run: vendor/bin/phpunit

- name: Run PHPUnit with Coverage
if: matrix.php-version == '8.3' && matrix.dependency-versions == 'highest'
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage to Codecov
if: matrix.php-version == '8.3' && matrix.dependency-versions == 'highest'
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10"
"phpunit/phpunit": "^9.5.10",
"phpstan/phpstan": "^2.1"
},
"scripts": {
"test": "vendor/bin/phpunit"
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 5
paths:
- src
- tests