Skip to content

Commit

Permalink
Merge pull request #9 from ergebnis/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize project tooling configuration with ergebnis/php-cs-fixer-config-template
  • Loading branch information
localheinz committed Nov 29, 2019
2 parents cc07f7a + c428951 commit a941255
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 56 deletions.
25 changes: 14 additions & 11 deletions .github/settings.yml
Expand Up @@ -10,17 +10,20 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "Coding Standards"
- "Dependency Analysis"
- "Static Code Analysis"
- "Tests (php7.2, lowest)"
- "Tests (php7.2, locked)"
- "Tests (php7.2, highest)"
- "Tests (php7.3, lowest)"
- "Tests (php7.3, locked)"
- "Tests (php7.3, highest)"
- "Code Coverage"
- "Mutation Tests"
- "Coding Standards (7.2)"
- "Dependency Analysis (7.4)"
- "Static Code Analysis (7.4)"
- "Tests (7.2, lowest)"
- "Tests (7.2, locked)"
- "Tests (7.2, highest)"
- "Tests (7.3, lowest)"
- "Tests (7.3, locked)"
- "Tests (7.3, highest)"
- "Tests (7.4, lowest)"
- "Tests (7.4, locked)"
- "Tests (7.4, highest)"
- "Code Coverage (7.4)"
- "Mutation Tests (7.4)"
- "codecov/patch"
- "codecov/project"
strict: false
Expand Down
144 changes: 100 additions & 44 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -16,29 +16,38 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.2

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

- name: "Disable Xdebug"
run: php7.2 --ini | grep xdebug | sed 's/,$//' | xargs sudo rm
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
with:
coverage: none
extension-csv: "mbstring"
php-version: ${{ matrix.php-version }}

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

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

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

- name: "Create cache directory for friendsofphp/php-cs-fixer"
run: mkdir -p .build/php-cs-fixer
Expand All @@ -47,64 +56,82 @@ jobs:
uses: actions/cache@v1.0.2
with:
path: ~/.build/php-cs-fixer
key: php7.2-php-cs-fixer-${{ hashFiles('**/composer.lock') }}
key: php${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php7.2-php-cs-fixer-
php${{ matrix.php-version }}-php-cs-fixer-
- name: "Run friendsofphp/php-cs-fixer"
run: php7.2 vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose
run: vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose

dependency-analysis:
name: "Dependency Analysis"

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.4

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

- name: "Disable Xdebug"
run: php7.3 --ini | grep xdebug | sed 's/,$//' | xargs sudo rm
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
with:
coverage: none
extension-csv: "mbstring"
php-version: ${{ matrix.php-version }}

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

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

static-code-analysis:
name: "Static Code Analysis"

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.4

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

- name: "Disable Xdebug"
run: php7.3 --ini | grep xdebug | sed 's/,$//' | xargs sudo rm
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
with:
coverage: none
extension-csv: "mbstring"
php-version: ${{ matrix.php-version }}

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

- name: "Run phpstan/phpstan"
run: php7.3 vendor/bin/phpstan analyse --configuration=phpstan.neon
run: vendor/bin/phpstan analyse --configuration=phpstan.neon

tests:
name: "Tests"
Expand All @@ -113,9 +140,10 @@ jobs:

strategy:
matrix:
php-binary:
- php7.2
- php7.3
php-version:
- 7.2
- 7.3
- 7.4

dependencies:
- lowest
Expand All @@ -126,63 +154,79 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v1.1.0

- name: "Disable Xdebug"
run: ${{ matrix.php-binary }} --ini | grep xdebug | sed 's/,$//' | xargs sudo rm
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@master
with:
coverage: none
extension-csv: "mbstring"
php-version: ${{ matrix.php-version }}

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

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

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

- name: "Run auto-review tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml
run: vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml

- name: "Run unit tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml

- name: "Run integration tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/Integration/phpunit.xml
run: vendor/bin/phpunit --configuration=test/Integration/phpunit.xml

code-coverage:
name: "Code Coverage"

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.4

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

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

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

- name: "Dump Xdebug filter with phpunit/phpunit"
run: php7.3 vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
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: php7.3 vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php
run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php

- name: "Send code coverage report to Codecov.io"
env:
Expand All @@ -194,20 +238,32 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.4

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

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

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

- name: "Run mutation tests with infection/infection"
run: php7.3 vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100
run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -14,7 +14,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.0.0
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.0

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand Down

0 comments on commit a941255

Please sign in to comment.