diff --git a/.dependabot/config.yml b/.dependabot/config.yaml similarity index 74% rename from .dependabot/config.yml rename to .dependabot/config.yaml index 0ee7e919..7a12de73 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yaml @@ -3,10 +3,7 @@ version: 1 update_configs: - - automerged_updates: - - match: - dependency_type: "development" - commit_message: + - commit_message: include_scope: true prefix: "Build" default_labels: diff --git a/.editorconfig b/.editorconfig index 329611ca..3aaad722 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ indent_size = 2 [*.neon] indent_style = tab -[*.yml] +[*.{yaml,yml}] indent_size = 2 [Makefile] diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 285ab618..faab1b33 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,7 +2,12 @@ We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system. -For details, see [`workflows/continuous-integration.yml`](workflows/continuous-integration.yml). +For details, take a look at the following workflow configuration files: + +- [`workflows/integrate.yaml`](workflows/integrate.yaml) +- [`workflows/prune.yaml`](workflows/prune.yaml) +- [`workflows/release.yaml`](workflows/release.yaml) +- [`workflows/renew.yaml`](workflows/renew.yaml) ## Coding Standards @@ -40,7 +45,7 @@ $ make static-code-analysis to run a static code analysis. -We are also using the baseline features of [`phpstan/phpstan`(https://medium.com/@ondrejmirtes/phpstans-baseline-feature-lets-you-hold-new-code-to-a-higher-standard-e77d815a5dff) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file). +We are also using the baseline features of [`phpstan/phpstan`](https://medium.com/@ondrejmirtes/phpstans-baseline-feature-lets-you-hold-new-code-to-a-higher-standard-e77d815a5dff) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file). Run @@ -84,7 +89,7 @@ Run $ make ``` -to enforce coding standards, run a dependency analysis, run a static code analysis, and run tests! +to enforce coding standards, run a static code analysis, and run tests! ## Help diff --git a/.github/settings.yml b/.github/settings.yml index 8c4b07fe..3c8966a5 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -31,12 +31,15 @@ branches: - "Tests (7.4, highest)" - "Code Coverage (7.4, locked)" - "Mutation Tests (7.4, locked)" - - "codecov/patch" - - "codecov/project" strict: false restrictions: - apps: - - "dependabot-preview" + + # https://developer.github.com/v3/repos/branches/#parameters-1 + + # Note: User, app, and team restrictions are only available for organization-owned repositories. + # Set to null to disable when using this configuration for a repository on a personal account. + + apps: [] teams: [] users: - "ergebnis-bot" @@ -46,27 +49,31 @@ branches: labels: - name: "bug" - color: "#ee0701" + color: "ee0701" description: "" - name: "dependency" - color: "#0366d6" + color: "0366d6" description: "" - name: "enhancement" - color: "#0e8a16" + color: "0e8a16" + description: "" + + - name: "merge" + color: "6f42c1" description: "" - name: "question" - color: "#cc317c" + color: "cc317c" description: "" - name: "security" - color: "#ee0701" + color: "ee0701" description: "" - name: "stale" - color: "#eeeeee" + color: "eeeeee" description: "" # https://developer.github.com/v3/repos/#edit diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/integrate.yaml similarity index 54% rename from .github/workflows/continuous-integration.yml rename to .github/workflows/integrate.yaml index 9b33bd07..274cbfde 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/integrate.yaml @@ -1,9 +1,9 @@ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions -name: "Continuous Integration" +name: "Integrate" -on: - pull_request: +on: # yamllint disable-line rule:truthy + pull_request: null push: branches: - "master" @@ -29,10 +29,17 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" + + - name: "Lint YAML files" + uses: "ibiqlik/action-yamllint@v1" + with: + config_file: ".yamllint.yaml" + file_or_dir: "." + strict: true - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" @@ -41,22 +48,26 @@ jobs: - name: "Validate composer.json and composer.lock" run: "composer validate --strict" + - name: "Determine composer cache directory" + id: "determine-composer-cache-directory" + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" @@ -67,10 +78,10 @@ jobs: run: "mkdir -p .build/php-cs-fixer" - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" 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" @@ -91,36 +102,40 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "none" extensions: "${{ env.REQUIRED_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)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" - name: "Run maglnet/composer-require-checker" - uses: "docker://webfactory/composer-require-checker:2.0.0" + uses: "docker://webfactory/composer-require-checker:2.1.0" static-code-analysis: name: "Static Code Analysis" @@ -137,45 +152,63 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "none" extensions: "${{ env.REQUIRED_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)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" restore-keys: "${{ matrix.php-version }}-composer-locked-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" - name: "Create cache directory for phpstan/phpstan" run: "mkdir -p .build/phpstan" + - name: "Cache cache directory for phpstan/phpstan" + uses: "actions/cache@v1" + 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" - name: "Create cache directory for vimeo/psalm" run: "mkdir -p .build/psalm" + - name: "Cache cache directory for vimeo/psalm" + uses: "actions/cache@v1" + with: + path: ".build/psalm" + key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}" + restore-keys: "php-${{ matrix.php-version }}-psalm-" + - name: "Run vimeo/psalm" - run: "vendor/bin/psalm --config=psalm.xml --shepherd --show-info=false --stats" + run: "vendor/bin/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --threads=4" tests: name: "Tests" @@ -197,31 +230,35 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "none" extensions: "${{ env.REQUIRED_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)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" @@ -249,31 +286,35 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "xdebug" extensions: "${{ env.REQUIRED_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)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" @@ -303,39 +344,43 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "xdebug" extensions: "${{ env.REQUIRED_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)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" - name: "Run mutation tests with Xdebug and infection/infection" run: "vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=${{ env.MIN_COVERED_MSI }} --min-msi=${{ env.MIN_MSI }}" - review: - name: "Review" + merge: + name: "Merge" runs-on: "ubuntu-latest" @@ -347,15 +392,93 @@ jobs: - "static-code-analysis" - "tests" + if: > + github.event_name == 'pull_request' && + github.event.pull_request.draft == false && ( + github.event.action == 'opened' || + github.event.action == 'reopened' || + github.event.action == 'synchronize' + ) && ( + (github.actor == 'dependabot-preview[bot]' && startsWith(github.event.pull_request.title, 'Build(deps-dev)')) || + (github.actor == 'ergebnis-bot' && github.event.pull_request.title == 'Enhancement: Update license year') || + (github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge')) + ) + steps: - - name: "Approve pull requests created by dependabot that update development dependencies" - uses: "hmarr/auto-approve-action@v2.0.0" - if: "(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'Build(deps-dev)')" + - name: "Request review from @ergebnis-bot" + uses: "actions/github-script@0.8.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - - - name: "Approve pull requests created by @ergebnis-bot that update the license year" - uses: "hmarr/auto-approve-action@v2.0.0" - if: "github.actor == 'ergebnis-bot' && github.event_name == 'pull_request' && github.event.pull_request.title == 'Enhancement: Update license year'" + script: | + const pullRequest = context.payload.pull_request + const repository = context.repo + + const reviewers = [ + "ergebnis-bot", + ] + + await github.pulls.createReviewRequest({ + owner: repository.owner, + pull_number: pullRequest.number, + repo: repository.repo, + reviewers: reviewers, + }) + + - name: "Wait" + run: "sleep 3" + + - name: "Assign @ergebnis-bot" + uses: "actions/github-script@0.8.0" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + script: | + const pullRequest = context.payload.pull_request + const repository = context.repo + + const reviewers = [ + "ergebnis-bot", + ] + + await github.issues.addAssignees({ + assignees: reviewers, + issue_number: pullRequest.number, + owner: repository.owner, + repo: repository.repo, + }) + + - name: "Wait" + run: "sleep 3" + + - name: "Approve pull request" + uses: "actions/github-script@0.8.0" + if: "github.actor != 'ergebnis-bot'" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + script: | + const pullRequest = context.payload.pull_request + const repository = context.repo + + await github.pulls.createReview({ + event: "APPROVE", + owner: repository.owner, + pull_number: pullRequest.number, + repo: repository.repo, + }) + + - name: "Wait" + run: "sleep 3" + + - name: "Merge pull request" + uses: "actions/github-script@0.8.0" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + script: | + const pullRequest = context.payload.pull_request + const repository = context.repo + + await github.pulls.merge({ + merge_method: "merge", + owner: repository.owner, + pull_number: pullRequest.number, + repo: repository.repo, + }) diff --git a/.github/workflows/prune.yaml b/.github/workflows/prune.yaml new file mode 100644 index 00000000..449e4652 --- /dev/null +++ b/.github/workflows/prune.yaml @@ -0,0 +1,31 @@ +# https://github.com/actions/stale + +name: "Prune" + +on: # yamllint disable-line rule:truthy + schedule: + - cron: "0 12 * * *" + +jobs: + prune: + name: "Issues" + + runs-on: "ubuntu-latest" + + steps: + - name: "Prune issues and pull requests" + uses: "actions/stale@v1" + with: + days-before-close: 5 + days-before-stale: 60 + 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. + + I will close it if no further activity occurs within the next five 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. + + I will close it if no further activity occurs within the next five days. diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/release.yaml similarity index 86% rename from .github/workflows/continuous-deployment.yml rename to .github/workflows/release.yaml index c8b2a2e9..5cd6d94b 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/release.yaml @@ -1,8 +1,8 @@ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions -name: "Continuous Deployment" +name: "Release" -on: +on: # yamllint disable-line rule:truthy push: tags: - "**" @@ -19,7 +19,7 @@ jobs: run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" - name: "Create release" - uses: "actions/create-release@v1.0.0" + uses: "actions/create-release@v1" env: GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" with: diff --git a/.github/workflows/license.yml b/.github/workflows/renew.yaml similarity index 76% rename from .github/workflows/license.yml rename to .github/workflows/renew.yaml index 5786ef26..f82995d6 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/renew.yaml @@ -1,8 +1,8 @@ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions -name: "License" +name: "Renew" -on: +on: # yamllint disable-line rule:truthy schedule: - cron: "1 0 1 1 *" @@ -25,10 +25,10 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2.0.0" + uses: "actions/checkout@v2" - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@1.7.3" + uses: "shivammathur/setup-php@v2" with: coverage: "none" extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" @@ -37,22 +37,26 @@ jobs: - name: "Validate composer.json and composer.lock" run: "composer validate --strict" + - name: "Determine composer cache directory" + id: "determine-composer-cache-directory" + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + - name: "Cache dependencies installed with composer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: - path: "~/.composer/cache" + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Install lowest dependencies with composer" + - 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 with composer" + - name: "Install locked dependencies from composer.lock" if: "matrix.dependencies == 'locked'" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Install highest dependencies with composer" + - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" run: "composer update --no-interaction --no-progress --no-suggest" @@ -60,7 +64,7 @@ jobs: run: "mkdir -p .build/php-cs-fixer" - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v1.0.3" + uses: "actions/cache@v1" with: path: ".build/php-cs-fixer" key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}" @@ -70,7 +74,7 @@ jobs: run: "vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose" - name: "Open pull request updating license year" - uses: "gr2m/create-or-update-pull-request-action@v1.2.9" + uses: "gr2m/create-or-update-pull-request-action@v1.2.10" with: author: "ergebnis-bot " branch: "feature/license-year" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 0d6f48ef..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,29 +0,0 @@ -# https://github.com/actions/stale - -name: "Stale" - -on: - schedule: - - cron: "0 12 * * *" - -jobs: - stale: - runs-on: "ubuntu-latest" - - steps: - - name: "Close stale issues and pull requests" - uses: "actions/stale@v1.1.0" - with: - days-before-close: 5 - days-before-stale: 60 - repo-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - stale-issue-label: 'stale' - stale-issue-message: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - stale-pr-label: "stale" - stale-pr-message: > - This PR has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. diff --git a/.gitignore b/.gitignore index 2dc50e82..0d234cb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.build/ +/.notes/ /vendor/ diff --git a/.php_cs b/.php_cs index ad1ac3cf..ba7167b2 100644 --- a/.php_cs +++ b/.php_cs @@ -32,9 +32,10 @@ $config->getFinder() ->ignoreDotFiles(false) ->in(__DIR__) ->exclude([ - '.build', - '.dependabot', - '.github', + '.build/', + '.dependabot/', + '.github/', + '.notes/', ]) ->name('.php_cs'); diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..7c36ddbe --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,66 @@ +extends: "default" + +ignore: | + .build/ + .notes/ + vendor/ + +rules: + braces: + max-spaces-inside-empty: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + min-spaces-inside: 1 + brackets: + max-spaces-inside-empty: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 0 + min-spaces-inside: 0 + colons: + max-spaces-after: 1 + max-spaces-before: 0 + commas: + max-spaces-after: 1 + max-spaces-before: 0 + min-spaces-after: 1 + comments: + ignore-shebangs: true + min-spaces-from-content: 1 + require-starting-space: true + comments-indentation: "enable" + document-end: + present: false + document-start: + present: false + indentation: + check-multi-line-strings: false + indent-sequences: true + spaces: 2 + empty-lines: + max-end: 0 + max-start: 0 + max: 1 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + hyphens: + max-spaces-after: 2 + key-duplicates: "enable" + key-ordering: "disable" + line-length: "disable" + new-line-at-end-of-file: "enable" + new-lines: + type: "unix" + octal-values: + forbid-implicit-octal: true + quoted-strings: + quote-type: "double" + trailing-spaces: "enable" + truthy: + allowed-values: + - "false" + - "true" + +yaml-files: + - '*.yaml' + - '*.yml' diff --git a/Makefile b/Makefile index cee00c6d..37195136 100644 --- a/Makefile +++ b/Makefile @@ -2,21 +2,22 @@ MIN_COVERED_MSI:=100 MIN_MSI:=100 .PHONY: it -it: coding-standards dependency-analysis static-code-analysis tests ## Runs the coding-standards, dependency-analysis, static-code-analysis, and tests targets +it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets .PHONY: code-coverage code-coverage: vendor ## Collects coverage from running unit tests with phpunit/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 + mkdir -p .build/phpunit + 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 + yamllint -c .yamllint.yaml --strict . mkdir -p .build/php-cs-fixer vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose .PHONY: dependency-analysis dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker - docker run --interactive --rm --tty --volume ${PWD}:/app webfactory/composer-require-checker:2.0.0 + docker run --interactive --rm --tty --volume ${PWD}:/app webfactory/composer-require-checker:2.1.0 .PHONY: help help: ## Displays this list of targets with descriptions @@ -32,13 +33,12 @@ static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan mkdir -p .build/phpstan vendor/bin/phpstan analyse --configuration=phpstan.neon mkdir -p .build/psalm - vendor/bin/psalm --config=psalm.xml --show-info=false --stats + vendor/bin/psalm --config=psalm.xml --diff --diff-methods --show-info=false --stats --threads=4 .PHONY: static-code-analysis-baseline 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 --generate-baseline=phpstan-baseline.neon mkdir -p .build/psalm vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml diff --git a/README.md b/README.md index 5d515974..55da2028 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # php-cs-fixer-config -[![Continuous Deployment](https://github.com/ergebnis/php-cs-fixer-config/workflows/Continuous%20Deployment/badge.svg)](https://github.com/ergebnis/php-cs-fixer-config/actions) -[![Continuous Integration](https://github.com/ergebnis/php-cs-fixer-config/workflows/Continuous%20Integration/badge.svg)](https://github.com/ergebnis/php-cs-fixer-config/actions) +[![Integrate](https://github.com/ergebnis/php-cs-fixer-config/workflows/Integrate/badge.svg?branch=master)](https://github.com/ergebnis/php-cs-fixer-config/actions) +[![Prune](https://github.com/ergebnis/php-cs-fixer-config/workflows/Prune/badge.svg?branch=master)](https://github.com/ergebnis/php-cs-fixer-config/actions) +[![Release](https://github.com/ergebnis/php-cs-fixer-config/workflows/Release/badge.svg?branch=master)](https://github.com/ergebnis/php-cs-fixer-config/actions) +[![Renew](https://github.com/ergebnis/php-cs-fixer-config/workflows/Renew/badge.svg?branch=master)](https://github.com/ergebnis/php-cs-fixer-config/actions) [![Code Coverage](https://codecov.io/gh/ergebnis/php-cs-fixer-config/branch/master/graph/badge.svg)](https://codecov.io/gh/ergebnis/php-cs-fixer-config) [![Type Coverage](https://shepherd.dev/github/ergebnis/php-cs-fixer-config/coverage.svg)](https://shepherd.dev/github/ergebnis/php-cs-fixer-config) @@ -270,7 +272,9 @@ Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github ## License -This package is licensed using the [MIT License](LICENSE.md). +This package is licensed using the MIT License. + +Please have a look at [`LICENSE.md`](LICENSE.md). ## Credits diff --git a/phpstan.neon b/phpstan.neon index 3b41c322..a34b3d11 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,6 @@ parameters: inferPrivatePropertyTypeFromConstructor: true level: max paths: - - src - - test - tmpDir: %currentWorkingDirectory%/.build/phpstan + - src/ + - test/ + tmpDir: .build/phpstan/ diff --git a/psalm-baseline.xml b/psalm-baseline.xml index b0a8d767..560ae2df 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,10 @@ - + + + + \Generator + + FixerFactory::create() @@ -11,5 +16,19 @@ getFixers RuleSet::create($rules) + + RuleSet::create($rules)->getRules() + + + string[] + \Generator + \Generator + + + getRules + + + $builtInFixers + diff --git a/psalm.xml b/psalm.xml index 87dbffbd..d645df4b 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,7 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + cacheDirectory=".build/psalm" errorBaseline="psalm-baseline.xml" + errorLevel="1" resolveFromConfigFile="true" > @@ -15,10 +17,10 @@ - - + + - + diff --git a/test/Unit/phpunit.xml b/test/Unit/phpunit.xml index 07b9c636..5d606146 100644 --- a/test/Unit/phpunit.xml +++ b/test/Unit/phpunit.xml @@ -29,7 +29,7 @@ - ../../src + ../../src/