From a5829f25b9f59c319feb0d3ae9c08701dd2dcf13 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 8 Dec 2022 17:06:55 +0100 Subject: [PATCH 1/3] GH Actions/Securitycheck: update the security checker download The security checker binary has had a new release, so let's take advantage of it. Refs: * https://github.com/fabpot/local-php-security-checker/releases * https://github.com/fabpot/local-php-security-checker/blob/v2.0.6/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 85b7f36b..36636d96 100644 --- a/.github/workflows/securitycheck.yml +++ b/.github/workflows/securitycheck.yml @@ -42,10 +42,10 @@ jobs: - name: Download security checker # yamllint disable-line rule:line-length - run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.5/local-php-security-checker_2.0.5_linux_amd64 + run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.6/local-php-security-checker_2.0.6_linux_amd64 - name: Make security checker executable - run: chmod +x ./local-php-security-checker_2.0.5_linux_amd64 + run: chmod +x ./local-php-security-checker_2.0.6_linux_amd64 - name: Check against insecure dependencies - run: ./local-php-security-checker_2.0.5_linux_amd64 --path=composer.lock + run: ./local-php-security-checker_2.0.6_linux_amd64 --path=composer.lock From 427ff57c5ae3c032d14da7cd772ee5b2667e56a7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 8 Dec 2022 17:07:38 +0100 Subject: [PATCH 2/3] GH Actions: update PHP versions in workflows PHP 8.2 has been released today :tada: and the `setup-php` action has announced support for PHP 8.3, so adding PHP 8.3 to the matrix and no longer allowing PHP 8.2 to fail the build. Builds against PHP 8.3 are still allowed to fail for now. Includes updating the `PHPCSVersions` class for the test suite to contain a PHP `8.3` block and updating the PHPCS table to include the latest releases. (we should automate that) --- .github/workflows/integrationtest.yml | 13 ++++++++++--- tests/PHPCSVersions.php | 12 ++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 49bca52d..325fd487 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -34,6 +34,7 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' composer: - 'v1' - 'v2' @@ -70,6 +71,9 @@ jobs: - php: '8.2' composer: '2.2' os: 'ubuntu-latest' + - php: '8.3' + composer: '2.2' + os: 'ubuntu-latest' - php: '7.2' composer: '2.2' @@ -89,6 +93,9 @@ jobs: - php: '8.2' composer: '2.2' os: 'windows-latest' + - php: '8.3' + composer: '2.2' + os: 'windows-latest' # Also test against the dev version of Composer for early warning about upcoming changes. - php: 'latest' @@ -101,7 +108,7 @@ jobs: name: "Integration test" - continue-on-error: ${{ matrix.php == '8.2' || matrix.composer == 'snapshot' }} + continue-on-error: ${{ matrix.php == '8.3' || matrix.composer == 'snapshot' }} steps: - name: Checkout code @@ -123,7 +130,7 @@ jobs: # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies - name: Install Composer dependencies - if: ${{ matrix.php != '8.2' }} + if: ${{ matrix.php != '8.3' }} uses: "ramsey/composer-install@v2" with: composer-options: '--optimize-autoloader' @@ -131,7 +138,7 @@ jobs: custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") - name: Install Composer dependencies - if: ${{ matrix.php == '8.2' }} + if: ${{ matrix.php == '8.3' }} uses: "ramsey/composer-install@v2" with: composer-options: '--ignore-platform-reqs --optimize-autoloader' diff --git a/tests/PHPCSVersions.php b/tests/PHPCSVersions.php index a3705973..7e64c72a 100644 --- a/tests/PHPCSVersions.php +++ b/tests/PHPCSVersions.php @@ -84,6 +84,8 @@ final class PHPCSVersions '3.6.0' => '3.6.0', '3.6.1' => '3.6.1', '3.6.2' => '3.6.2', + '3.7.0' => '3.7.0', + '3.7.1' => '3.7.1', ); /** @@ -342,6 +344,16 @@ function ($version) { break; case '8.2': + $versions = array_filter( + self::$allPhpcsVersions, + function ($version) { + // PHPCS 3.6.1 is the first PHPCS version with runtime support for PHP 8.2. + return version_compare($version, '3.6.1', '>='); + } + ); + break; + + case '8.3': /* * At this point in time, it is unclear as of which PHPCS version PHP 8.2 will be supported. * In other words: tests should only use dev-master/4.x when on PHP 8.2 for the time being. From b290f87d188b60747c01c7f334e2b8eae1a79bc1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 8 Dec 2022 17:08:37 +0100 Subject: [PATCH 3/3] GH Actions: minor simplification ... of the bash `date` command in the earlier pulled cache busting. --- .github/workflows/integrationtest.yml | 6 +++--- .github/workflows/phplint.yml | 4 ++-- .github/workflows/quicktest.yml | 4 ++-- .github/workflows/securitycheck.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 325fd487..20b0ff88 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -134,15 +134,15 @@ jobs: uses: "ramsey/composer-install@v2" with: composer-options: '--optimize-autoloader' - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Install Composer dependencies if: ${{ matrix.php == '8.3' }} uses: "ramsey/composer-install@v2" with: composer-options: '--ignore-platform-reqs --optimize-autoloader' - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + custom-cache-suffix: $(date -u "+%Y-%m") - name: Run integration tests run: vendor/bin/phpunit --no-coverage diff --git a/.github/workflows/phplint.yml b/.github/workflows/phplint.yml index c79bf34d..53d6c61e 100644 --- a/.github/workflows/phplint.yml +++ b/.github/workflows/phplint.yml @@ -39,8 +39,8 @@ jobs: - name: Install Composer dependencies uses: "ramsey/composer-install@v2" with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Lint against parse errors run: composer lint -- --checkstyle | cs2pr diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 5427a48f..24205abd 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -60,8 +60,8 @@ jobs: uses: "ramsey/composer-install@v2" with: composer-options: '--optimize-autoloader' - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Run integration tests run: vendor/bin/phpunit --no-coverage diff --git a/.github/workflows/securitycheck.yml b/.github/workflows/securitycheck.yml index 36636d96..4c4e445b 100644 --- a/.github/workflows/securitycheck.yml +++ b/.github/workflows/securitycheck.yml @@ -37,8 +37,8 @@ jobs: - name: Install Composer dependencies uses: "ramsey/composer-install@v2" with: - # Bust the cache at least once a month - output format: YYYY-MM-DD. - custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") + # Bust the cache at least once a month - output format: YYYY-MM. + custom-cache-suffix: $(date -u "+%Y-%m") - name: Download security checker # yamllint disable-line rule:line-length