-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: CI, CS, add infection, add .gitattributes
- Loading branch information
Showing
22 changed files
with
418 additions
and
261 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,21 @@ | ||
# Exclude build/test files from archive | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.github export-ignore | ||
/.gitignore export-ignore | ||
/.php_cs export-ignore | ||
/.php_cs.dist export-ignore | ||
/.psalm export-ignore | ||
/docs export-ignore | ||
/examples export-ignore | ||
/infection.json export-ignore | ||
/infection.json.dist export-ignore | ||
/phpstan.neon export-ignore | ||
/phpunit.xml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/psalm.xml export-ignore | ||
/tests export-ignore | ||
|
||
# Configure diff output for .php and .phar files. | ||
*.php diff=php | ||
*.phar -diff |
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,191 @@ | ||
name: CI | ||
|
||
on: | ||
- pull_request | ||
- push | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
php: | ||
- '7.4' | ||
- '8.0' | ||
dependencies: | ||
- lowest | ||
- highest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: pcov | ||
env: | ||
update: true | ||
|
||
- name: Setup Problem Matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- 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: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependencies }}-composer- | ||
|
||
- name: Install highest dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
|
||
- name: Install lowest dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
|
||
- name: Run tests | ||
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml | ||
|
||
- name: Upload code coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: build/coverage-report.xml | ||
|
||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
env: | ||
update: true | ||
|
||
- 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-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist | ||
|
||
- name: Run script | ||
run: composer cs-check | ||
|
||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
env: | ||
update: true | ||
|
||
- 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-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist | ||
|
||
- name: Run script | ||
run: composer phpstan | ||
|
||
psalm: | ||
name: Psalm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
env: | ||
update: true | ||
|
||
- 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-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist | ||
|
||
- name: Run script | ||
run: vendor/bin/psalm --output-format=github | ||
|
||
infection: | ||
name: Infection | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
coverage: pcov | ||
env: | ||
update: true | ||
|
||
- 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-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist | ||
|
||
- name: Run script | ||
env: | ||
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | ||
run: | | ||
git fetch --depth=1 origin $GITHUB_BASE_REF | ||
php vendor/bin/infection -j2 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PhpCsFixer' => true, | ||
'@PhpCsFixer:risky' => true, | ||
'@PSR12' => true, | ||
'@PSR12:risky' => true, | ||
'blank_line_before_statement' => [ | ||
'statements' => ['continue', 'do', 'die', 'exit', 'goto', 'if', 'return', 'switch', 'throw', 'try'], | ||
], | ||
'declare_strict_types' => true, | ||
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], | ||
'native_function_invocation' => ['strict' => true], | ||
'php_unit_internal_class' => false, | ||
'php_unit_test_case_static_method_calls'=> ['call_type' => 'self'], | ||
'php_unit_test_class_requires_covers' => false, | ||
'phpdoc_to_comment' => false, | ||
'yoda_style' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
); |
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.