Skip to content

Commit

Permalink
Enhancement: Synchronize with ergebnis/php-library-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 11, 2019
1 parent 64c644c commit 6b5b400
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 28 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- master
- "1.x"
tags:
- "**"

Expand All @@ -30,7 +29,7 @@ jobs:
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"
Expand Down Expand Up @@ -58,7 +57,7 @@ jobs:
- name: "Cache cache directory for friendsofphp/php-cs-fixer"
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 @@ -84,7 +83,7 @@ jobs:
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
Expand All @@ -99,7 +98,7 @@ jobs:
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
with:
args: --config-file=composer-require-checker.json

Expand All @@ -121,7 +120,7 @@ jobs:
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
Expand Down Expand Up @@ -162,7 +161,7 @@ jobs:
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "mbstring"
extensions: "mbstring"
php-version: ${{ matrix.php-version }}

- name: "Cache dependencies installed with composer"
Expand All @@ -185,6 +184,12 @@ jobs:
if: matrix.dependencies == 'highest'
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

- name: "Run unit tests with phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml

- name: "Run integration tests with phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Integration/phpunit.xml

Expand All @@ -205,8 +210,8 @@ jobs:
- name: "Install PHP with extensions"
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"
Expand All @@ -220,11 +225,8 @@ jobs:
- name: "Install locked dependencies with composer"
run: composer install --no-interaction --no-progress --no-suggest

- name: "Dump Xdebug filter with phpunit/phpunit"
run: vendor/bin/phpunit --configuration=test/Integration/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/Integration/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 Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
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 integration tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --coverage-text --prepend=.build/phpunit/xdebug-filter.php
vendor/bin/phpunit --configuration=test/Integration/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 --config-file=composer-require-checker.json
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.1 --config-file=composer-require-checker.json

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand All @@ -37,8 +35,10 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
vendor/bin/phpstan analyze --configuration=phpstan.neon --error-format=baselineNeon > phpstan-baseline.neon || true

.PHONY: tests
tests: vendor ## Runs integration tests with phpunit/phpunit
tests: vendor ## Runs auto-review, unit, and integration tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml

vendor: composer.json composer.lock
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# composer-normalize

[![CI Status](https://github.com/localheinz/composer-normalize/workflows/Continuous%20Integration/badge.svg)](https://github.com/localheinz/composer-normalize/actions)
[![codecov](https://codecov.io/gh/localheinz/composer-normalize/branch/master/graph/badge.svg)](https://codecov.io/gh/localheinz/composer-normalize)
[![Continuous Integration](https://github.com/localheinz/composer-normalize/workflows/Continuous%20Integration/badge.svg)](https://github.com/localheinz/composer-normalize/actions)
[![Code Coverage](https://codecov.io/gh/localheinz/composer-normalize/branch/master/graph/badge.svg)](https://codecov.io/gh/localheinz/composer-normalize)
[![Latest Stable Version](https://poser.pugx.org/localheinz/composer-normalize/v/stable)](https://packagist.org/packages/localheinz/composer-normalize)
[![Total Downloads](https://poser.pugx.org/localheinz/composer-normalize/downloads)](https://packagist.org/packages/localheinz/composer-normalize)

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ergebnis/phpstan-rules": "~0.14.0",
"ergebnis/test-util": "~0.9.0",
"jangregor/phpstan-prophecy": "~0.4.2",
"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
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
includes:
- phpstan-baseline.neon
- vendor/ergebnis/phpstan-rules/rules.neon
- vendor/jangregor/phpstan-prophecy/src/extension.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:
ergebnis:
classesAllowedToBeExtended:
- Composer\Command\BaseCommand
inferPrivatePropertyTypeFromConstructor: true
level: max
paths:
- src
- test
Expand Down
30 changes: 30 additions & 0 deletions test/AutoReview/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="../../vendor/autoload.php"
cacheResult="true"
cacheResultFile="../../.build/phpunit/auto-review.cache"
colors="true"
columns="max"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true"
>
<testsuites>
<testsuite name="Auto Review Tests">
<directory>.</directory>
</testsuite>
</testsuites>
</phpunit>
35 changes: 35 additions & 0 deletions test/Unit/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="../../vendor/autoload.php"
cacheResult="true"
cacheResultFile="../../.build/phpunit/unit.cache"
colors="true"
columns="max"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true"
>
<testsuites>
<testsuite name="Unit Tests">
<directory>.</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../src</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit 6b5b400

Please sign in to comment.