Skip to content

Commit

Permalink
Merge pull request #11 from ergebnis/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize with ergebnis/php-library-template
  • Loading branch information
localheinz committed Dec 9, 2019
2 parents 55a05e9 + 7ef74af commit 72ee58c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -68,7 +68,7 @@ to run all the tests.

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `Xdebug` and run
Enable `pcov` or `Xdebug` and run

```
$ make mutation-tests
Expand Down
87 changes: 42 additions & 45 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -23,39 +23,39 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Validate composer.json and composer.lock"
run: $(which composer) validate --strict
run: composer validate --strict

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php${{ matrix.php-version }}-composer-locked-
- name: "Install locked dependencies with composer"
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Run localheinz/composer-normalize"
run: $(which composer) normalize --dry-run
run: composer normalize --dry-run

- name: "Create cache directory for friendsofphp/php-cs-fixer"
run: mkdir -p .build/php-cs-fixer

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.build/php-cs-fixer
path: .build/php-cs-fixer
key: php${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php${{ matrix.php-version }}-php-cs-fixer-
Expand All @@ -75,28 +75,28 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php${{ matrix.php-version }}-composer-locked-
- name: "Install locked dependencies with composer"
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Run maglnet/composer-require-checker"
uses: docker://localheinz/composer-require-checker-action:1.1.0
uses: docker://localheinz/composer-require-checker-action:1.1.1

static-code-analysis:
name: "Static Code Analysis"
Expand All @@ -110,25 +110,25 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: ${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ matrix.php-version }}-composer-locked-
- name: "Install locked dependencies with composer"
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Run phpstan/phpstan"
run: vendor/bin/phpstan analyse --configuration=phpstan.neon
Expand All @@ -152,17 +152,17 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -171,15 +171,15 @@ jobs:
- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
run: $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest
run: composer update --no-interaction --no-progress --no-suggest --prefer-lowest

- name: "Install locked dependencies with composer"
if: matrix.dependencies == 'locked'
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Install highest dependencies with composer"
if: matrix.dependencies == 'highest'
run: $(which composer) update --no-interaction --no-progress --no-suggest
run: composer update --no-interaction --no-progress --no-suggest

- name: "Run auto-review tests with phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml
Expand All @@ -202,31 +202,28 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: xdebug
extension-csv: "mbstring"
coverage: pcov
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php${{ matrix.php-version }}-composer-locked-
- name: "Install locked dependencies with composer"
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Dump Xdebug filter with phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php

- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php
- name: "Collect code coverage with pcov and phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml

- name: "Send code coverage report to Codecov.io"
env:
Expand All @@ -245,25 +242,25 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v1.1.0
uses: actions/checkout@v1

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
uses: shivammathur/setup-php@v1
with:
coverage: xdebug
extension-csv: "mbstring"
coverage: pcov
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.2
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php${{ matrix.php-version }}-composer-locked-
- name: "Install locked dependencies with composer"
run: $(which composer) install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress --no-suggest

- name: "Run mutation tests with infection/infection"
- name: "Run mutation tests with pcov and infection/infection"
run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100
6 changes: 2 additions & 4 deletions Makefile
Expand Up @@ -3,9 +3,7 @@ it: coding-standards dependency-analysis static-code-analysis tests ## Runs the

.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text --prepend=.build/phpunit/xdebug-filter.php
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text

.PHONY: coding-standards
coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
Expand All @@ -14,7 +12,7 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix

.PHONY: dependency-analysis
dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.0
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.1

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -23,6 +23,7 @@
"jangregor/phpstan-prophecy": "~0.4.2",
"localheinz/composer-normalize": "^1.3.1",
"localheinz/phpstan-rules": "~0.13.0",
"phpstan/extension-installer": "^1.0.3",
"phpstan/phpstan": "~0.11.19",
"phpstan/phpstan-deprecation-rules": "~0.11.2",
"phpstan/phpstan-strict-rules": "~0.11.1",
Expand Down
46 changes: 45 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions phpstan.neon
@@ -1,17 +1,12 @@
includes:
- phpstan-baseline.neon
- vendor/jangregor/phpstan-prophecy/src/extension.neon
- vendor/localheinz/phpstan-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan/conf/config.levelmax.neon

parameters:
classesAllowedToBeExtended:
- Ergebnis\PhpCsFixer\Config\RuleSet\AbstractRuleSet
- Ergebnis\PhpCsFixer\Config\Test\Unit\RuleSet\AbstractRuleSetTestCase
inferPrivatePropertyTypeFromConstructor: true
level: max
paths:
- src
- test
Expand Down

0 comments on commit 72ee58c

Please sign in to comment.