From 5dfea8ab39887548e290c80c6893f0dbb41d70fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 30 Aug 2020 14:09:53 +0200 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-library-template --- .gitattributes | 29 +-- .../determine-cache-directory/action.yaml | 16 ++ .../composer/composer/install/action.yaml | 22 ++ .../actions/composer/composer/install/run.sh | 25 +++ .github/workflows/integrate.yaml | 190 +++++++----------- .github/workflows/prune.yaml | 18 +- .github/workflows/renew.yaml | 34 ++-- .github/workflows/triage.yaml | 2 +- Makefile | 6 +- composer-require-checker.json | 19 ++ psalm.xml | 2 + 11 files changed, 201 insertions(+), 162 deletions(-) create mode 100644 .github/actions/composer/composer/determine-cache-directory/action.yaml create mode 100644 .github/actions/composer/composer/install/action.yaml create mode 100755 .github/actions/composer/composer/install/run.sh create mode 100644 composer-require-checker.json diff --git a/.gitattributes b/.gitattributes index 99692297..79ecf3ae 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,15 @@ -/.github/ export-ignore -/test/ export-ignore -/tools/ export-ignore -/.editorconfig export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.php_cs export-ignore -/infection.json export-ignore -/Makefile export-ignore -/phive.xml export-ignore -/phpstan-baseline.neon export-ignore -/phpstan.neon export-ignore -/psalm-baseline.xml export-ignore -/psalm.xml export-ignore +/.github/ export-ignore +/test/ export-ignore +/tools/ export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/composer-require-checker.json export-ignore +/infection.json export-ignore +/Makefile export-ignore +/phive.xml export-ignore +/phpstan-baseline.neon export-ignore +/phpstan.neon export-ignore +/psalm-baseline.xml export-ignore +/psalm.xml export-ignore diff --git a/.github/actions/composer/composer/determine-cache-directory/action.yaml b/.github/actions/composer/composer/determine-cache-directory/action.yaml new file mode 100644 index 00000000..a898fdaa --- /dev/null +++ b/.github/actions/composer/composer/determine-cache-directory/action.yaml @@ -0,0 +1,16 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions +# https://getcomposer.org/doc/03-cli.md#composer-cache-dir + +name: "Determine composer cache directory" + +description: "Determines the composer cache directory and exports it as COMPOSER_CACHE_DIR environment variable" + +runs: + using: "composite" + + steps: + - name: "Determine composer cache directory" + shell: "bash" + run: "echo \"::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)\"" diff --git a/.github/actions/composer/composer/install/action.yaml b/.github/actions/composer/composer/install/action.yaml new file mode 100644 index 00000000..bab262e5 --- /dev/null +++ b/.github/actions/composer/composer/install/action.yaml @@ -0,0 +1,22 @@ +# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs +# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions + +name: "Install dependencies with composer" + +description: "Installs dependencies with composer" + +inputs: + dependencies: + description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\"" + required: true + +runs: + using: "composite" + + steps: + - name: "Install ${{ inputs.dependencies }} dependencies with composer" + shell: "bash" + run: "${{ github.action_path }}/run.sh" + env: + COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}" diff --git a/.github/actions/composer/composer/install/run.sh b/.github/actions/composer/composer/install/run.sh new file mode 100755 index 00000000..dddf3039 --- /dev/null +++ b/.github/actions/composer/composer/install/run.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +dependencies="${COMPOSER_INSTALL_DEPENDENCIES}" + +if [[ ${dependencies} == "lowest" ]]; then + composer update --no-interaction --no-progress --no-suggest --prefer-lowest + + exit 0 +fi + +if [[ ${dependencies} == "locked" ]]; then + composer install --no-interaction --no-progress --no-suggest + + exit 0 +fi + +if [[ ${dependencies} == "highest" ]]; then + composer update --no-interaction --no-progress --no-suggest + + exit 0 +fi + +echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead." + +exit 1 diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index fdfca412..3f75488d 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -9,6 +9,7 @@ on: # yamllint disable-line rule:truthy - "main" env: + ERGEBNIS_BOT_NAME: "ergebnis-bot" MIN_COVERED_MSI: 92 MIN_MSI: 92 PHP_EXTENSIONS: "mbstring" @@ -32,14 +33,14 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v1" + uses: "ibiqlik/action-yamllint@v1.0.0" with: config_file: ".yamllint.yaml" file_or_dir: "." strict: true - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" @@ -49,27 +50,19 @@ jobs: run: "composer validate --strict" - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Run ergebnis/composer-normalize" run: "tools/composer-normalize --dry-run" @@ -78,7 +71,7 @@ jobs: run: "mkdir -p .build/php-cs-fixer" - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: path: ".build/php-cs-fixer" key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('composer.lock') }}" @@ -105,37 +98,29 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Run maglnet/composer-require-checker" - run: "tools/composer-require-checker check" + run: "tools/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" static-code-analysis: name: "Static Code Analysis" @@ -155,53 +140,45 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Create cache directory for phpstan/phpstan" run: "mkdir -p .build/phpstan" - name: "Cache cache directory for phpstan/phpstan" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: path: ".build/phpstan" key: "php-${{ matrix.php-version }}-phpstan-${{ github.sha }}" restore-keys: "php-${{ matrix.php-version }}-phpstan-" - name: "Run phpstan/phpstan" - run: "vendor/bin/phpstan analyse --configuration=phpstan.neon" + run: "vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1" - name: "Create cache directory for vimeo/psalm" run: "mkdir -p .build/psalm" - name: "Cache cache directory for vimeo/psalm" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: path: ".build/psalm" key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}" @@ -233,34 +210,29 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Run auto-review tests with phpunit/phpunit" run: "vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml" @@ -289,40 +261,32 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: - coverage: "xdebug" + coverage: "pcov" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --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: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - - 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: @@ -347,36 +311,28 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: - coverage: "xdebug" + coverage: "pcov" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - - name: "Run mutation tests with Xdebug and infection/infection" + - name: "Run mutation tests with pcov and infection/infection" run: "vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=${{ env.MIN_COVERED_MSI }} --min-msi=${{ env.MIN_MSI }}" merge: @@ -406,7 +362,7 @@ jobs: ) steps: - - name: "Request review from @ergebnis-bot" + - name: "Request review from @${{ env.ERGEBNIS_BOT_NAME }}" uses: "actions/github-script@v3.0.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" @@ -415,7 +371,7 @@ jobs: const repository = context.repo const reviewers = [ - "ergebnis-bot", + "${{ env.ERGEBNIS_BOT_NAME }}", ] await github.pulls.requestReviewers({ @@ -425,7 +381,7 @@ jobs: reviewers: reviewers, }) - - name: "Assign @ergebnis-bot" + - name: "Assign @${{ env.ERGEBNIS_BOT_NAME }}" uses: "actions/github-script@v3.0.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" @@ -433,12 +389,12 @@ jobs: const pullRequest = context.payload.pull_request const repository = context.repo - const reviewers = [ - "ergebnis-bot", + const assignees = [ + "${{ env.ERGEBNIS_BOT_NAME }}", ] await github.issues.addAssignees({ - assignees: reviewers, + assignees: assignees, issue_number: pullRequest.number, owner: repository.owner, repo: repository.repo, @@ -446,7 +402,7 @@ jobs: - name: "Approve pull request" uses: "actions/github-script@v3.0.0" - if: "github.actor != 'ergebnis-bot'" + if: "github.actor != '${{ env.ERGEBNIS_BOT_NAME }}'" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" script: | diff --git a/.github/workflows/prune.yaml b/.github/workflows/prune.yaml index 6c923bc1..180b7229 100644 --- a/.github/workflows/prune.yaml +++ b/.github/workflows/prune.yaml @@ -6,6 +6,10 @@ on: # yamllint disable-line rule:truthy schedule: - cron: "0 12 * * *" +env: + DAYS_BEFORE_CLOSE: 14 + DAYS_BEFORE_STALE: 180 + jobs: prune: name: "Issues" @@ -14,18 +18,18 @@ jobs: steps: - name: "Prune issues and pull requests" - uses: "actions/stale@v3" + uses: "actions/stale@v3.0.10" with: - days-before-close: 5 - days-before-stale: 60 + days-before-close: "${{ env.DAYS_BEFORE_CLOSE }}" + days-before-stale: "${{ env.DAYS_BEFORE_STALE }}" repo-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" stale-issue-label: "stale" stale-issue-message: | - Since this issue has not had any activity within the last sixty days, I have marked it as stale. + Since this issue has not had any activity within the last ${{ env.DAYS_BEFORE_STALE }} days, I have marked it as stale. - I will close it if no further activity occurs within the next five days. + I will close it if no further activity occurs within the next ${{ env.DAYS_BEFORE_CLOSE }} days. stale-pr-label: "stale" stale-pr-message: | - Since this pull request has not had any activity within the last sixty days, I have marked it as stale. + Since this pull request has not had any activity within the last ${{ env.DAYS_BEFORE_STALE }} days, I have marked it as stale. - I will close it if no further activity occurs within the next five days. + I will close it if no further activity occurs within the next ${{ env.DAYS_BEFORE_CLOSE }} days. diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 69fd280e..0fdb3842 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -7,6 +7,8 @@ on: # yamllint disable-line rule:truthy - cron: "1 0 1 1 *" env: + ERGEBNIS_BOT_EMAIL: "bot@ergebn.is" + ERGEBNIS_BOT_NAME: "ergebnis-bot" PHP_EXTENSIONS: "mbstring" jobs: @@ -28,7 +30,7 @@ jobs: uses: "actions/checkout@v2.3.2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + uses: "shivammathur/setup-php@2.4.3" with: coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" @@ -38,36 +40,28 @@ jobs: run: "composer validate --strict" - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "./.github/actions/composer/composer/determine-cache-directory" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v2.1.1" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - 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@v2" + uses: "actions/cache@v2.1.1" with: path: ".build/php-cs-fixer" - key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}" + key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" - name: "Run friendsofphp/php-cs-fixer" @@ -76,7 +70,7 @@ jobs: - name: "Open pull request updating license year" uses: "gr2m/create-or-update-pull-request-action@v1.2.10" with: - author: "ergebnis-bot " + author: "${{ env.ERGEBNIS_BOT_NAME }} <${{ env.ERGEBNIS_BOT_EMAIL }}>" branch: "feature/license-year" body: | This PR diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml index e6fcde61..f86c120a 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -3,7 +3,7 @@ name: "Triage" on: # yamllint disable-line rule:truthy - pull_request: + pull_request_target: types: - "opened" diff --git a/Makefile b/Makefile index 34cd0f03..66f8289b 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-norm .PHONY: dependency-analysis dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker - tools/composer-require-checker check + tools/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json .PHONY: help help: ## Displays this list of targets with descriptions @@ -32,7 +32,7 @@ mutation-tests: vendor ## Runs mutation tests with infection/infection .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm mkdir -p .build/phpstan - vendor/bin/phpstan analyse --configuration=phpstan.neon + vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1 mkdir -p .build/psalm vendor/bin/psalm --config=psalm.xml --diff --diff-methods --show-info=false --stats --threads=4 @@ -40,7 +40,7 @@ static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan and vimeo/psalm mkdir -p .build/phpstan echo '' > phpstan-baseline.neon - vendor/bin/phpstan analyze --configuration=phpstan.neon --error-format=baselineNeon > phpstan-baseline.neon || true + vendor/bin/phpstan analyze --configuration=phpstan.neon --error-format=baselineNeon --memory-limit=-1 > phpstan-baseline.neon || true mkdir -p .build/psalm vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml diff --git a/composer-require-checker.json b/composer-require-checker.json new file mode 100644 index 00000000..67d0aa16 --- /dev/null +++ b/composer-require-checker.json @@ -0,0 +1,19 @@ +{ + "symbol-whitelist": [ + "array", + "bool", + "callable", + "false", + "float", + "int", + "iterable", + "null", + "object", + "parent", + "self", + "static", + "string", + "true", + "void" + ] +} diff --git a/psalm.xml b/psalm.xml index d645df4b..8b86e67b 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,7 +6,9 @@ cacheDirectory=".build/psalm" errorBaseline="psalm-baseline.xml" errorLevel="1" + findUnusedVariablesAndParams="true" resolveFromConfigFile="true" + strictBinaryOperands="true" >