Skip to content

Commit

Permalink
Merge pull request #193 from PHPCSStandards/feature/ghactions-tweak-p…
Browse files Browse the repository at this point in the history
…hp-versions

GH Actions: various tweaks / PHP 8.2 not allowed to fail
  • Loading branch information
jrfnl committed Dec 10, 2022
2 parents cd79216 + b290f87 commit 77cfd99
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/integrationtest.yml
Expand Up @@ -34,6 +34,7 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
composer:
- 'v1'
- 'v2'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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
Expand All @@ -123,19 +130,19 @@ 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'
# 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.2' }}
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
4 changes: 2 additions & 2 deletions .github/workflows/phplint.yml
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/quicktest.yml
Expand Up @@ -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
10 changes: 5 additions & 5 deletions .github/workflows/securitycheck.yml
Expand Up @@ -37,15 +37,15 @@ 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
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
12 changes: 12 additions & 0 deletions tests/PHPCSVersions.php
Expand Up @@ -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',
);

/**
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 77cfd99

Please sign in to comment.