From 30ad14e8833e54340db4995a0de0c6d34e4c89b2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 23 Dec 2021 04:26:41 +0100 Subject: [PATCH 1/7] CS: minor cleanup PHPCS 3.6.2 added a sniff for a PSR-12 rule which was previously not strictly checked: "No blank line after the opening brace of a class". This fixes the newly flagged issues. --- src/Plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Plugin.php b/src/Plugin.php index 93ea7290..5ae09d03 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -34,7 +34,6 @@ */ class Plugin implements PluginInterface, EventSubscriberInterface { - const KEY_MAX_DEPTH = 'phpcodesniffer-search-depth'; const MESSAGE_ERROR_WRONG_MAX_DEPTH = From b45ff19b567dcb601cb295570819f93e23370f54 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 23 Dec 2021 04:39:02 +0100 Subject: [PATCH 2/7] GH Actions: auto-cancel previous builds for same branch Previously, in Travis, when the same branch was pushed again and the "Auto cancellation" option on the "Settings" page had been turned on (as it was for most repos), any still running builds for the same branch would be stopped in favour of starting the build for the newly pushed version of the branch. To enable this behaviour in GH Actions, a `concurrency` configuration needs to be added to each workflow for which this should applied to. More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free. Refs: * https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ * https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency --- .github/workflows/integrationtest.yml | 6 ++++++ .github/workflows/linting.yaml | 6 ++++++ .github/workflows/phplint.yml | 6 ++++++ .github/workflows/quicktest.yml | 6 ++++++ .github/workflows/securitycheck.yml | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 1f55a3b3..9bf3bbc6 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -10,6 +10,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index 2f5c3fda..0e7bd9f1 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -7,6 +7,12 @@ on: - pull_request - workflow_dispatch +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: validate-composer: runs-on: ubuntu-18.04 diff --git a/.github/workflows/phplint.yml b/.github/workflows/phplint.yml index 12c8f850..4cfe63ec 100644 --- a/.github/workflows/phplint.yml +++ b/.github/workflows/phplint.yml @@ -8,6 +8,12 @@ on: # Allow manually triggering the workflow. - workflow_dispatch +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: phplint: runs-on: ubuntu-latest diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index f6155942..c6375e48 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -9,6 +9,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: #### QUICK TEST STAGE #### # This is a much quicker test which only runs the integration tests against a limited set of diff --git a/.github/workflows/securitycheck.yml b/.github/workflows/securitycheck.yml index 3800428e..eebf3b5f 100644 --- a/.github/workflows/securitycheck.yml +++ b/.github/workflows/securitycheck.yml @@ -8,6 +8,12 @@ on: # Allow manually triggering the workflow. - workflow_dispatch +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: security-check: runs-on: ubuntu-latest From 46253b78c2e97872271c6b703f4766464b339171 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 23 Dec 2021 04:39:49 +0100 Subject: [PATCH 3/7] GH Actions: use `error_reporting=-1` ... as `E_ALL` does not always contain _all_ errors across PHP versions. --- .github/workflows/integrationtest.yml | 2 +- .github/workflows/quicktest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 9bf3bbc6..74680145 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -151,7 +151,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - ini-values: error_reporting=E_ALL, display_errors=On + ini-values: error_reporting=-1, display_errors=On coverage: none - name: 'Composer: set PHPCS version for tests' diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index c6375e48..a1950b58 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -51,7 +51,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - ini-values: error_reporting=E_ALL, display_errors=On + ini-values: error_reporting=-1, display_errors=On coverage: none - name: 'Composer: set PHPCS version for tests' From 4bf33a95ec77cc8456f179dd175b61fb3d028bd5 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 23 Dec 2021 04:40:19 +0100 Subject: [PATCH 4/7] GH Actions: update the security checker Ref: https://github.com/fabpot/local-php-security-checker/blob/main/CHANGELOG.md --- .github/workflows/securitycheck.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/securitycheck.yml b/.github/workflows/securitycheck.yml index eebf3b5f..9f2b7d1c 100644 --- a/.github/workflows/securitycheck.yml +++ b/.github/workflows/securitycheck.yml @@ -39,10 +39,10 @@ jobs: uses: "ramsey/composer-install@v1" - name: Download security checker - run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64 + run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v1.2.0/local-php-security-checker_1.2.0_linux_amd64 - name: Make security checker executable - run: chmod +x ./local-php-security-checker_1.0.0_linux_amd64 + run: chmod +x ./local-php-security-checker_1.2.0_linux_amd64 - name: Check against insecure dependencies - run: ./local-php-security-checker_1.0.0_linux_amd64 --path=composer.lock + run: ./local-php-security-checker_1.2.0_linux_amd64 --path=composer.lock From 32892d6a61aefe2d22c95fe86ec0bcc1cb10e4a9 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 24 Dec 2021 06:04:54 +0100 Subject: [PATCH 5/7] GH Actions: version update for `ramsey/composer-install` The action used to install Composer packages and handle the caching has released a new major (and some follow-up patch releases), which means, the action reference needs to be updated to benefit from it. Refs: * https://github.com/ramsey/composer-install/releases/tag/2.0.0 * https://github.com/ramsey/composer-install/releases/tag/2.0.1 * https://github.com/ramsey/composer-install/releases/tag/2.0.2 --- .github/workflows/integrationtest.yml | 2 +- .github/workflows/phplint.yml | 2 +- .github/workflows/quicktest.yml | 2 +- .github/workflows/securitycheck.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 74680145..39ad2dea 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -165,7 +165,7 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies - name: 'Install Composer dependencies' - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" with: composer-options: --no-scripts --optimize-autoloader diff --git a/.github/workflows/phplint.yml b/.github/workflows/phplint.yml index 4cfe63ec..3f2d6642 100644 --- a/.github/workflows/phplint.yml +++ b/.github/workflows/phplint.yml @@ -38,7 +38,7 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" - name: Lint against parse errors run: composer lint -- --checkstyle | cs2pr diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index a1950b58..f041129c 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -65,7 +65,7 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies - name: 'Install Composer dependencies' - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" with: composer-options: --no-scripts --optimize-autoloader diff --git a/.github/workflows/securitycheck.yml b/.github/workflows/securitycheck.yml index 9f2b7d1c..79a56e3e 100644 --- a/.github/workflows/securitycheck.yml +++ b/.github/workflows/securitycheck.yml @@ -36,7 +36,7 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" - name: Download security checker run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v1.2.0/local-php-security-checker_1.2.0_linux_amd64 From 33f29ddf7777b7882d8cbc73fcc152d98a3c5329 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 24 Dec 2021 06:05:28 +0100 Subject: [PATCH 6/7] GH Actions: always use --no-interaction for Composer Adding `--no-interaction` to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future. --- .github/workflows/integrationtest.yml | 4 ++-- .github/workflows/quicktest.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 39ad2dea..e82d4e48 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -155,12 +155,12 @@ jobs: coverage: none - name: 'Composer: set PHPCS version for tests' - run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" + run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction # Install PHPCompatibility 7.x/8.x for PHPCS < 2.3. - name: 'Composer: set PHPCompatibility version for tests (PHPCS < 2.3)' if: ${{ matrix.phpcompat != 'composer' }} - run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" + run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index f041129c..c27e5592 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -55,12 +55,12 @@ jobs: coverage: none - name: 'Composer: set PHPCS version for tests' - run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" + run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction # Install PHPCompatibility 7.x/8.x for PHPCS < 2.3. - name: 'Composer: set PHPCompatibility version for tests (PHPCS < 2.3)' if: ${{ matrix.phpcompat != 'composer' }} - run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" + run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies From 1a4405e056c30b4deb67944aca231e420c9ad47a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 26 Dec 2021 00:35:18 +0100 Subject: [PATCH 7/7] GH Actions: version update for `actions/checkout` Ref: https://github.com/actions/checkout/releases --- .github/workflows/linting.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index 0e7bd9f1..ab6595e3 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -17,7 +17,7 @@ jobs: validate-composer: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Validate composer.json and composer.lock uses: "docker://composer" with: @@ -26,7 +26,7 @@ jobs: lint-json: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Lint json uses: "docker://pipelinecomponents/jsonlint:latest" with: @@ -35,20 +35,20 @@ jobs: yamllint: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Check yaml for issues uses: pipeline-components/yamllint@master php-codesniffer: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Check php for code style and php cross-version compatibility issues uses: pipeline-components/php-codesniffer@master lint-remark: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Check markdown uses: pipeline-components/remark-lint@master