diff --git a/.gitattributes b/.gitattributes index a4bee5f1..c2f9d60b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ -/.dependabot/ export-ignore /.github/ export-ignore /bin/ export-ignore /phar/ export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 269540b2..c6ab3be5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,7 +19,7 @@ We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce co If you do not have `yamllint` installed yet, run -``` +```sh $ brew install yamllint ``` @@ -29,7 +29,7 @@ We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-C Run -``` +```sh $ make coding-standards ``` @@ -41,7 +41,7 @@ We are using [`maglnet/composer-require-checker`](https://github.com/maglnet/Com Run -``` +```sh $ make dependency-analysis ``` @@ -53,7 +53,7 @@ We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo Run -``` +```sh $ make static-code-analysis ``` @@ -63,7 +63,7 @@ We are also using the baseline features of [`phpstan/phpstan`](https://medium.co Run -``` +```sh $ make static-code-analysis-baseline ``` @@ -77,7 +77,7 @@ We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) t Run -``` +```sh $ make tests ``` @@ -87,7 +87,7 @@ to run all the tests. Run -``` +```sh $ make ``` @@ -97,7 +97,7 @@ to enforce coding standards, run a static code analysis, and run tests! :bulb: Run -``` +```sh $ make help ``` 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/dependabot.yml b/.github/dependabot.yml index bbc50e10..309faef3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,4 +1,4 @@ -# https://help.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates +# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 diff --git a/.github/settings.yml b/.github/settings.yml index e6ebf500..c48a972b 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -3,8 +3,8 @@ branches: - name: "main" - # https://developer.github.com/v3/repos/branches/#remove-branch-protection - # https://developer.github.com/v3/repos/branches/#update-branch-protection + # https://docs.github.com/en/rest/reference/repos#delete-branch-protection + # https://docs.github.com/en/rest/reference/repos#update-branch-protection protection: enforce_admins: false @@ -50,7 +50,7 @@ branches: strict: false restrictions: - # https://developer.github.com/v3/repos/branches/#parameters-1 + # https://docs.github.com/en/rest/reference/repos#list-branches--parameters # 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. @@ -60,8 +60,8 @@ branches: users: - "ergebnis-bot" -# https://developer.github.com/v3/issues/labels/#create-a-label -# https://developer.github.com/v3/issues/labels/#update-a-label +# https://docs.github.com/en/rest/reference/issues#create-a-label +# https://docs.github.com/en/rest/reference/issues#update-a-label labels: - name: "bug" @@ -92,7 +92,7 @@ labels: color: "eeeeee" description: "" -# https://developer.github.com/v3/repos/#edit +# https://docs.github.com/en/rest/reference/repos#update-a-repository repository: allow_merge_commit: true @@ -110,6 +110,6 @@ repository: name: "composer-normalize" private: false - # https://developer.github.com/v3/repos/branches/#remove-branch-protection + # https://docs.github.com/en/rest/reference/repos#replace-all-repository-topics topics: "composer, composer-plugin, json, normalizer" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 36f056cd..c041f424 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -1,4 +1,4 @@ -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://docs.github.com/en/actions name: "Integrate" @@ -10,6 +10,7 @@ on: # yamllint disable-line rule:truthy env: COMPOSER_VERSION: "1.10.8" + ERGEBNIS_BOT_NAME: "ergebnis-bot" PHP_EXTENSIONS: "mbstring" PHP_INI_VALUES: "memory_limit=-1, phar.readonly=0" @@ -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 }}" @@ -50,27 +51,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: "Install lowest dependencies from composer.json in tools/" if: "matrix.dependencies == 'lowest'" @@ -94,7 +87,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') }}" @@ -121,40 +114,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 }}" - ini-values: "${{ env.PHP_INI_VALUES }}" 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" - uses: "docker://webfactory/composer-require-checker:2.1.0" - with: - args: "check --config-file=composer-require-checker.json" + run: "tools/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" static-code-analysis: name: "Static Code Analysis" @@ -174,7 +156,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 }}" @@ -182,27 +164,19 @@ jobs: 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: "Install lowest dependencies from composer.json in tools/" if: "matrix.dependencies == 'lowest'" @@ -223,20 +197,20 @@ jobs: 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 }}" @@ -286,13 +260,16 @@ 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 }}" ini-values: "${{ env.PHP_INI_VALUES }}" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Install composer:^1" if: "matrix.composer-version == '1'" run: "composer self-update ${{ env.COMPOSER_VERSION }}" @@ -305,27 +282,19 @@ jobs: run: "composer --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 auto-review tests with phpunit/phpunit" run: "vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml" @@ -354,35 +323,30 @@ 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" extensions: "${{ env.PHP_EXTENSIONS }}" ini-values: "${{ env.PHP_INI_VALUES }}" 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: "Dump Xdebug filter with phpunit/phpunit" run: "vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php" @@ -416,7 +380,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 }}" @@ -424,23 +388,19 @@ jobs: 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 ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Install highest dependencies from composer.json" if: "matrix.dependencies == 'highest'" @@ -497,7 +457,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 }}" @@ -506,7 +466,7 @@ jobs: const repository = context.repo const reviewers = [ - "ergebnis-bot", + "${{ env.ERGEBNIS_BOT_NAME }}", ] await github.pulls.requestReviewers({ @@ -516,7 +476,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 }}" @@ -524,12 +484,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, @@ -537,7 +497,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 99a34217..180b7229 100644 --- a/.github/workflows/prune.yaml +++ b/.github/workflows/prune.yaml @@ -1,4 +1,4 @@ -# https://github.com/actions/stale +# https://docs.github.com/en/actions name: "Prune" @@ -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/release.yaml b/.github/workflows/release.yaml index ba71549a..a9426524 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://docs.github.com/en/actions name: "Release" @@ -37,7 +37,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 }}" @@ -45,27 +45,19 @@ jobs: 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@v1" + 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') }}-phar" - restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-phar" + 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: "Remove composer/composer" run: "composer remove composer/composer --no-interaction --no-progress" diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 2df688da..1d30ce4e 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -1,4 +1,4 @@ -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://docs.github.com/en/actions name: "Renew" @@ -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" PHP_INI_VALUES: "memory_limit=-1, phar.readonly=0" @@ -29,7 +31,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 }}" @@ -40,36 +42,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" @@ -78,7 +72,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 5091493b..f86c120a 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -1,7 +1,9 @@ +# https://docs.github.com/en/actions + name: "Triage" on: # yamllint disable-line rule:truthy - pull_request: + pull_request_target: types: - "opened" diff --git a/Makefile b/Makefile index 70aab634..80383bb6 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 - docker run --interactive --rm --tty --volume ${PWD}:/app webfactory/composer-require-checker:2.1.0 check --config-file=composer-require-checker.json + tools/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json .PHONY: help help: ## Displays this list of targets with descriptions @@ -42,14 +42,14 @@ schema: vendor ## Updates the schema .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 tools/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 - vendor/bin/phpstan analyze --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon + vendor/bin/phpstan analyze --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon --memory-limit=-1 mkdir -p .build/psalm tools/vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml diff --git a/composer-require-checker.json b/composer-require-checker.json index 8a984abd..a11ecf3b 100644 --- a/composer-require-checker.json +++ b/composer-require-checker.json @@ -1,5 +1,5 @@ { - "symbol-whitelist" : [ + "symbol-whitelist": [ "array", "bool", "callable", diff --git a/phive.xml b/phive.xml index 5c04f1fa..d3797a55 100644 --- a/phive.xml +++ b/phive.xml @@ -1,4 +1,5 @@ - + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 32f7d009..f0769632 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + Application @@ -12,17 +12,16 @@ $formatter $differ - + $composerFile $composerFile $composerFile $composerFile $composerFile - $formatted->encoded() + $diff $composerFile $composerFile $composerFile - $diff $composerFile @@ -40,9 +39,9 @@ normalize format encoded + diff encoded isLocked - diff $composerFile @@ -56,7 +55,7 @@ - + $decoded['plugin-api-version'] @@ -68,6 +67,11 @@ \Generator<array{0: CommandInvocation, 1: string}> \Generator<array{0: CommandInvocation, 1: int, 2: string}> + + string + string + int + 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" > diff --git a/tools/composer-require-checker b/tools/composer-require-checker new file mode 100755 index 00000000..5b513986 Binary files /dev/null and b/tools/composer-require-checker differ