-
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
209 additions
and
145 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 |
---|---|---|
@@ -1,115 +1,113 @@ | ||
name: 'CI' | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: ~ | ||
push: | ||
branches: | ||
- master | ||
pull_request: ~ | ||
|
||
jobs: | ||
|
||
lint: | ||
name: 'Lint' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: "none" | ||
extensions: "json" | ||
ini-values: "memory_limit=-1" | ||
php-version: "8.0" | ||
|
||
- name: 'Determine composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: 'Cache composer dependencies' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.directory }} | ||
key: 7.4-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: 7.4-composer- | ||
|
||
- name: 'Install dependencies' | ||
id: deps | ||
run: | | ||
echo "::group::composer update" | ||
composer update --no-progress --ansi | ||
echo "::endgroup::" | ||
echo "::group::install phpunit" | ||
# Required for PhpStan | ||
vendor/bin/simple-phpunit install | ||
echo "::endgroup::" | ||
- name: 'Composer validate' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: composer validate --strict | ||
|
||
- name: 'PHP CS Fixer' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: vendor/bin/php-cs-fixer fix --dry-run --diff | ||
|
||
- name: 'PhpStan' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: vendor/bin/phpstan analyse | ||
|
||
tests: | ||
name: 'Tests' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
strategy: | ||
fail-fast: false # don't cancel other matrix jobs on failure | ||
matrix: | ||
php: [ '7.4', '8.0' ] | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: "none" | ||
extensions: "json" | ||
ini-values: "memory_limit=-1" | ||
php-version: "${{ matrix.php }}" | ||
|
||
- name: 'Determine composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: 'Cache composer dependencies' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.directory }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
#- name: 'Fixup Composer' | ||
# if: matrix.php == 8.0 | ||
# run: | | ||
# echo "::group::Fixup Composer platform config for third-parties deps not PHP 8 ready yet" | ||
# composer config platform.php 7.4.99 | ||
# echo "::endgroup::" | ||
|
||
- name: 'Install dependencies' | ||
run: | | ||
echo "::group::composer update" | ||
composer update --no-progress --ansi | ||
echo "::endgroup::" | ||
echo "::group::install phpunit" | ||
vendor/bin/simple-phpunit install | ||
echo "::endgroup::" | ||
- name: 'Run tests' | ||
run: vendor/bin/simple-phpunit --testdox | ||
|
||
lint: | ||
name: Lint | ||
runs-on: 'ubuntu-latest' | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.3' | ||
|
||
- name: 'Install dependencies' | ||
run: | | ||
make install | ||
vendor/bin/simple-phpunit --version | ||
- name: 'Check style' | ||
run: make lint | ||
|
||
test: | ||
name: ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 8 | ||
continue-on-error: ${{ matrix.allow-failure == 1 }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# Lowest deps | ||
- name: 'Test lowest deps Symfony 5.4 [Linux, PHP 7.4]' | ||
os: 'ubuntu-latest' | ||
php: '7.4' | ||
symfony: '5.4.*@dev' | ||
composer-flags: '--prefer-lowest' | ||
allow-unstable: true | ||
|
||
# Most recent versions | ||
- name: 'Test Symfony 5.4 [Linux, PHP 8.0]' | ||
os: 'ubuntu-latest' | ||
php: '8.0' | ||
symfony: '5.4.*@dev' | ||
allow-unstable: true | ||
|
||
- name: 'Test Symfony 6.0 [Linux, PHP 8.1]' | ||
os: 'ubuntu-latest' | ||
php: '8.1' | ||
symfony: '6.0.*@dev' | ||
allow-unstable: true | ||
|
||
- name: 'Test next Symfony 6.4 [Linux, PHP 8.2]' | ||
os: 'ubuntu-latest' | ||
php: '8.2' | ||
symfony: '6.4.*@dev' | ||
allow-unstable: true | ||
|
||
# Bleeding edge (unreleased dev versions where failures are allowed) | ||
- name: 'Test next Symfony [Linux, PHP 8.3] (allowed failure)' | ||
os: 'ubuntu-latest' | ||
php: '8.3' | ||
symfony: '7.0.*@dev' | ||
composer-flags: '--ignore-platform-req php' | ||
allow-unstable: true | ||
allow-failure: true | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: pdo_sqlite | ||
coverage: pcov | ||
tools: 'composer:v2,flex' | ||
|
||
- name: 'Get composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: 'Cache dependencies' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ hashFiles('**/composer.json') }}-flags-${{ matrix.composer-flags }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: 'Allow unstable packages' | ||
run: composer config minimum-stability dev | ||
if: ${{ matrix.allow-unstable }} | ||
|
||
- name: 'Install dependencies' | ||
run: composer update --prefer-dist ${{ matrix.composer-flags }} --ansi | ||
env: | ||
SYMFONY_REQUIRE: "${{ matrix.symfony }}" | ||
|
||
- name: 'Run PHPUnit tests' | ||
run: vendor/bin/simple-phpunit --testdox --verbose ${{ matrix.code-coverage && '--coverage-text --coverage-clover build/logs/clover.xml' }} |
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 |
---|---|---|
@@ -1,29 +1,38 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder())->in([ | ||
__DIR__ | ||
]); | ||
$header = <<<'EOF' | ||
This file is part of the ElaoJsonForm bundle. | ||
Copyright (C) Elao | ||
@author Elao <[email protected]> | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in([__DIR__]) | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setFinder($finder) | ||
->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line | ||
->setRiskyAllowed(true) | ||
->setUsingCache(true) | ||
->setFinder($finder) | ||
->setRules([ | ||
'@PSR12' => true, | ||
'@Symfony' => true, | ||
'strict_param' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'concat_space' => ['spacing' => 'one'], | ||
'declare_strict_types' => true, | ||
//'header_comment' => ['header' => $header], | ||
'native_function_invocation' => ['include' => ['@compiler_optimized']], | ||
'no_superfluous_phpdoc_tags' => true, | ||
'ordered_imports' => true, | ||
'php_unit_namespaced' => true, | ||
'php_unit_method_casing' => false, | ||
'phpdoc_annotation_without_dot' => false, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'simplified_null_return' => false, | ||
'phpdoc_order' => true, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'psr_autoloading' => true, | ||
'single_line_throw' => false, | ||
'simplified_null_return' => false, | ||
'void_return' => true, | ||
'yoda_style' => false, | ||
'yoda_style' => [], | ||
]) | ||
; |
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
Oops, something went wrong.