From 95609e65340d8ed2b944820aea1ade8d76b841ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 29 Nov 2019 17:58:15 +0100 Subject: [PATCH] Enhancement: Synchronize project tooling configuration with ergebnis/php-cs-fixer-config-template --- .github/settings.yml | 25 ++-- .github/workflows/continuous-integration.yml | 144 +++++++++++++------ Makefile | 2 +- 3 files changed, 115 insertions(+), 56 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index 83f269b9..c4d47ab6 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -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 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a533db6c..3305bbde 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 @@ -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" @@ -113,9 +140,10 @@ jobs: strategy: matrix: - php-binary: - - php7.2 - - php7.3 + php-version: + - 7.2 + - 7.3 + - 7.4 dependencies: - lowest @@ -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: @@ -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 diff --git a/Makefile b/Makefile index 206d1a68..21fbad8b 100644 --- a/Makefile +++ b/Makefile @@ -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