Skip to content
Merged
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
46 changes: 33 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: tests

on: [ 'push', 'pull_request' ]
on: pull_request

jobs:
test:
Expand All @@ -9,20 +9,13 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
dependency-version: [ prefer-lowest, prefer-stable ]
php: [ 8.1, 8.2, 8.3, 8.4 ]

name: Tests on PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
name: Tests on PHP ${{ matrix.php }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -32,7 +25,34 @@ jobs:
coverage: none

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist
uses: "ramsey/composer-install@v3"

- name: Run tests
run: composer test
run: composer test

qa:
runs-on: ubuntu-latest
name: Code Quality

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, mbstring, zip
coverage: none

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"

- name: Check code style
run: vendor/bin/php-cs-fixer fix --dry-run --diff --verbose

- name: Check code quality
run: vendor/bin/phpstan analyze
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
vendor
.idea
.idea
.claude
.php-cs-fixer.cache
composer.lock
20 changes: 20 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests');

$config = new PhpCsFixer\Config();

$parallelConfig = PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect();

return $config
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'explicit_string_variable' => true,
])
->setParallelConfig($parallelConfig)
->setFinder($finder);
18 changes: 16 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
},
"require-dev": {
"symfony/var-dumper": "^6.3|^7.0",
"pestphp/pest": "^2.34"
"pestphp/pest": "^2.36.0|^3.5.0",
"friendsofphp/php-cs-fixer": "^3.89",
"phpstan/phpstan": "^2.1"
},
"license": "MIT",
"autoload": {
Expand All @@ -31,6 +33,18 @@
},
"scripts": {
"test": "vendor/bin/pest",
"test:coverage": "XDEBUG_MODE=coverage ./vendor/bin/pest --coverage"
"test:coverage": "XDEBUG_MODE=coverage ./vendor/bin/pest --coverage",
"cs-fix": "vendor/bin/php-cs-fixer fix",
"cs-check": "vendor/bin/php-cs-fixer fix --dry-run --diff --verbose",
"phpstan": "vendor/bin/phpstan analyze",
"phpstan-baseline": "vendor/bin/phpstan analyze --generate-baseline",
"qa": [
"@cs-check",
"@phpstan"
],
"qa-fix": [
"@cs-fix",
"@phpstan"
]
}
}
Loading