-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
143 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: intl, mbstring | ||
- name: Run PHP CS Fixer | ||
run: | | ||
mkdir -p tools/php-cs-fixer | ||
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer:3.57.1 kubawerlos/php-cs-fixer-custom-fixers | ||
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run -vvv --config=.php-cs-fixer.dist.php --show-progress=none | ||
tests: | ||
name: Test project | ||
needs: [php-cs-fixer] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-version: ['5.6', '7.0', '7.4', '8.1', '8.2'] | ||
dependency: [lowest, highest] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
extensions: intl, mbstring | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
run: | | ||
if [ "${{ matrix.dependency }}" == "lowest" ]; then | ||
composer update --prefer-lowest --prefer-stable --no-progress --no-suggest | ||
else | ||
composer install --prefer-dist --no-progress --no-suggest | ||
fi | ||
- name: Run PHPUnit | ||
run: vendor/bin/phpunit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ vendor/ | |
composer.lock | ||
.php_cs.cache | ||
.php_cs | ||
tools/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Antal Áron <antalaron@antalaron.hu> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
$header = <<<'EOF' | ||
(c) Antal Áron <antalaron@antalaron.hu> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setUsingCache(false) | ||
->setRules([ | ||
'@DoctrineAnnotation' => true, | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'phpdoc', 'return', 'throw', 'yield', 'yield_from']], | ||
'header_comment' => ['header' => $header], | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'modernize_strpos' => true, | ||
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'], | ||
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'phpdoc_to_comment' => ['ignored_tags' => ['var']], | ||
'no_useless_return' => true, | ||
'nullable_type_declaration_for_default_null_value' => true, | ||
'ordered_class_elements' => ['order' => ['use_trait', 'constant_public', 'constant_protected', 'constant_private', 'property_public', 'property_protected', 'property_private', 'construct', 'destruct']], | ||
'ordered_imports' => true, | ||
'ordered_interfaces' => true, | ||
'psr_autoloading' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'trailing_comma_in_multiline' => ['after_heredoc' => false, 'elements' => ['arguments', 'arrays']], | ||
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => true, 'always_move_variable' => true], | ||
]) | ||
->setFinder( | ||
(new PhpCsFixer\Finder()) | ||
->in(__DIR__) | ||
->append([ | ||
__FILE__, | ||
]) | ||
->exclude([ | ||
'vendor', | ||
]), | ||
) | ||
; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.