-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bearsunday/php8
Update QA tools
- Loading branch information
Showing
24 changed files
with
4,976 additions
and
273 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,19 @@ | ||
# Exclude build/test files from archive. | ||
/tests export-ignore | ||
/demo export-ignore | ||
/vendor-bin export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/php.ini export-ignore | ||
/codecov.yml export-ignore | ||
/phpcs.xml export-ignore | ||
/phpmd.xml export-ignore | ||
/phpstan.neon export-ignore | ||
/psalm.xml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/php-require-checker.config.json 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,34 @@ | ||
# CONTRIBUTING | ||
|
||
## Code Contributions | ||
|
||
## Installation | ||
|
||
Install project dependencies and test tools by running the following commands. | ||
|
||
```bash | ||
$ composer install | ||
``` | ||
|
||
## Running tests | ||
|
||
```bash | ||
$ composer test | ||
``` | ||
```bash | ||
$ composer coverage // xdebug | ||
$ composer pcov // pcov | ||
``` | ||
|
||
Add tests for your new code ensuring that you have 100% code coverage. | ||
In rare cases, code may be excluded from test coverage using `@codeCoverageIgnore`. | ||
|
||
## Sending a pull request | ||
|
||
To ensure your PHP code changes pass the CI checks, make sure to run all the same checks before submitting a PR. | ||
|
||
```bash | ||
$ composer tests | ||
``` | ||
|
||
When you make a pull request, the tests will automatically be run again by GH action on multiple php versions. |
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,14 @@ | ||
--- | ||
name: Bug Report | ||
about: Create a bug report | ||
labels: Bug | ||
--- | ||
|
||
### Bug Report | ||
|
||
<!-- Provide a summary describing the problem you are experiencing. --> | ||
|
||
### How to reproduce | ||
|
||
<!--- Describe exactly how to reproduce the problem, using a minimal test-case or working code sample. --> | ||
|
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,7 @@ | ||
--- | ||
name: Feature | ||
about: Suggest a new feature or enhancement | ||
labels: Feature | ||
--- | ||
|
||
<!-- Write your suggestion here. --> |
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,7 @@ | ||
--- | ||
name: Question | ||
about: Ask a question regarding software usage | ||
labels: Support | ||
--- | ||
|
||
<!-- Write your question here. --> |
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,6 @@ | ||
# Reporting a vulnerability | ||
|
||
If you have found any issues that might have security implications, | ||
please send a report privately to [email protected] | ||
|
||
Do not report security reports publicly. |
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,41 @@ | ||
name: Coding Standards | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
coding-standards: | ||
name: Coding Standards | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.0 | ||
tools: cs2pr | ||
coverage: none | ||
|
||
- 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.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress --prefer-dist | ||
|
||
- name: Validate composer.json | ||
run: composer validate --strict | ||
|
||
- name: Run PHP_CodeSniffer | ||
run: ./vendor/bin/phpcs -q --no-colors --report=checkstyle src tests | cs2pr |
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: Continuous Integration | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '42 15 * * *' | ||
|
||
jobs: | ||
phpunit: | ||
name: PHPUnit | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
operating-system: | ||
- ubuntu-latest | ||
php-version: | ||
- '7.3' | ||
- '7.4' | ||
- '8.0' | ||
dependencies: | ||
- lowest | ||
- highest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP ${{ matrix.php-version }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: pcov | ||
ini-values: zend.assertions=1 | ||
|
||
- 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.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install lowest dependencies | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest | ||
|
||
- name: Install highest dependencies | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: composer update --no-interaction --no-progress --no-suggest | ||
|
||
- name: Run test suite | ||
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml | ||
|
||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage.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 |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: Static Analysis | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
static-analysis-phpstan: | ||
name: Static Analysis with 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 | ||
tools: cs2pr | ||
coverage: none | ||
|
||
- 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.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress --prefer-dist | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr | ||
|
||
static-analysis-psalm: | ||
name: Static Analysis with 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 | ||
tools: cs2pr | ||
coverage: none | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress --prefer-dist | ||
|
||
- name: Run Psalm | ||
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr | ||
|
||
static-analysis-phpmd: | ||
name: Static Analysis with PHPMD | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
|
||
- 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.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress --prefer-dist | ||
|
||
- name: Run PHP Mess Detector | ||
run: ./vendor/bin/phpmd src text --exclude src/Annotation ./phpmd.xml | ||
|
||
static-analysis-php-metrics: | ||
name: Static Analysis with PhpMetrics | ||
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: none | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress --prefer-dist | ||
|
||
- name: Run PhpMetrics | ||
run: ./vendor/bin/phpmetrics --exclude=Exception src | ||
|
||
static-analysis-composer-require-checker: | ||
name: Static Analysis with ComposerRequireChecker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
coverage: none | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer install --no-interaction --no-progress --prefer-dist | ||
composer require --dev maglnet/composer-require-checker ^2.0 | ||
- name: Run composer-require-checker | ||
run: ./vendor/bin/composer-require-checker check --config-file=./php-require-checker.config.json ./composer.json |
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,7 +1,9 @@ | ||
.idea | ||
build | ||
vendor | ||
*.cache | ||
composer.lock | ||
|
||
.DS_Store | ||
/vendor/ | ||
/build/ | ||
/tests/tmp/ | ||
/.phpcs-cache | ||
/.phpunit.result.cache | ||
/composer.lock | ||
/coverage.xml | ||
/vendor-bin/**/vendor | ||
/demo/vendor |
Oops, something went wrong.