From 4d483b4e06d5f0194a86cf49bf99632430d5edf4 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 22 Oct 2026 18:38:11 +0200 Subject: [PATCH 1/3] #347 - CI: Tests passed / Quality passed jobs to require, weekly build, matrix without duplicates, concurrency, fail-fast and timeouts, composer validate, PHPUnit ^11.5, actions pinned by SHA Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/quality.yml | 57 +++++++++++++++--- .github/workflows/test.yml | 110 ++++++++++++---------------------- composer.json | 2 +- phpunit.xml.dist | 2 +- 4 files changed, 88 insertions(+), 83 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 1521e2c9..48d69e10 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -5,58 +5,97 @@ on: branches: - main pull_request: + # Weekly build: the dependencies are not locked, a new version of a dependency may break the build + schedule: + - cron: '0 6 * * 1' + workflow_dispatch: permissions: contents: read +# A new push cancels the build of the previous one, on a pull request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: + composer-validate: + name: Composer validate + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - name: Install PHP with extensions + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 + with: + php-version: '8.5' + coverage: none + tools: composer:v2 + - name: Validate composer.json + run: composer validate --strict --no-check-lock + phpstan: name: PHPStan runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 with: php-version: '8.5' coverage: none tools: composer:v2 - name: Install Composer dependencies (locked) - uses: ramsey/composer-install@v4 + uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4 - name: PHPStan run: vendor/bin/phpstan --no-progress --memory-limit=1G analyse --error-format=github php-cs-fixer: name: PHP-CS-Fixer runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 with: php-version: '8.5' coverage: none tools: composer:v2 - name: Install Composer dependencies (locked) - uses: ramsey/composer-install@v4 + uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4 - name: PHP-CS-Fixer run: vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none rector: name: Rector runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout code - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 with: php-version: '8.5' coverage: none tools: composer:v2 - name: Install Composer dependencies (locked) - uses: ramsey/composer-install@v4 + uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4 - name: Rector run: vendor/bin/rector --no-progress-bar --dry-run + + # Single check to require in the branch protection of main: its name does not depend on the matrix + quality-passed: + name: Quality passed + if: always() + needs: [composer-validate, phpstan, php-cs-fixer, rector] + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Check the result of the jobs + run: test "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" = false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90a11b6f..68243ab2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,102 +5,57 @@ on: branches: - main pull_request: + # Weekly build: the dependencies are not locked, a new version of a dependency may break the build + schedule: + - cron: '0 6 * * 1' + workflow_dispatch: permissions: contents: read +# A new push cancels the build of the previous one, on a pull request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test: - name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} + name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }}${{ matrix.symfony-require && format(' + Symfony {0}', matrix.symfony-require) || '' }} runs-on: ubuntu-latest - continue-on-error: ${{ matrix.allowed-to-fail }} + timeout-minutes: 20 env: SYMFONY_REQUIRE: ${{matrix.symfony-require}} strategy: + fail-fast: false matrix: - php-version: - - '8.2' - - '8.3' - - '8.4' - - '8.5' - dependencies: [highest] - allowed-to-fail: [false] - symfony-require: [''] - variant: [normal] include: # Lowest versions allowed by composer.json, on the lowest supported PHP version - - php-version: '8.2' - dependencies: lowest - allowed-to-fail: false - symfony-require: '' - variant: normal - - php-version: '8.2' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" - - php-version: '8.2' - dependencies: highest - allowed-to-fail: false - symfony-require: 7.4.* - variant: symfony/symfony:"7.4.*" - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 7.4.* - variant: symfony/symfony:"7.4.*" - - php-version: '8.4' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" - - php-version: '8.4' - dependencies: highest - allowed-to-fail: false - symfony-require: 7.4.* - variant: symfony/symfony:"7.4.*" - - php-version: '8.4' - dependencies: highest - allowed-to-fail: false - symfony-require: 8.* - variant: symfony/symfony:"8.*" - - php-version: '8.5' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" - - php-version: '8.5' - dependencies: highest - allowed-to-fail: false - symfony-require: 7.4.* - variant: symfony/symfony:"7.4.*" - - php-version: '8.5' - dependencies: highest - allowed-to-fail: false - symfony-require: 8.* - variant: symfony/symfony:"8.*" + - { php-version: '8.2', dependencies: lowest, symfony-require: '' } + # Highest versions, for each supported Symfony version (8.x requires PHP 8.4) + - { php-version: '8.2', dependencies: highest, symfony-require: 6.4.* } + - { php-version: '8.2', dependencies: highest, symfony-require: 7.4.* } + - { php-version: '8.3', dependencies: highest, symfony-require: 6.4.* } + - { php-version: '8.3', dependencies: highest, symfony-require: 7.4.* } + - { php-version: '8.4', dependencies: highest, symfony-require: 6.4.* } + - { php-version: '8.4', dependencies: highest, symfony-require: 7.4.* } + - { php-version: '8.4', dependencies: highest, symfony-require: 8.* } + - { php-version: '8.5', dependencies: highest, symfony-require: 6.4.* } + - { php-version: '8.5', dependencies: highest, symfony-require: 7.4.* } + - { php-version: '8.5', dependencies: highest, symfony-require: 8.* } steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 with: php-version: ${{ matrix.php-version }} coverage: pcov tools: composer:v2, flex - name: Add PHPUnit matcher run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Install variant - if: matrix.variant != 'normal' && !startsWith(matrix.variant, 'symfony/symfony') - run: composer require ${{ matrix.variant }} --no-update - name: Install Composer dependencies (${{ matrix.dependencies }}) - uses: ramsey/composer-install@v4 + uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4 with: dependency-versions: ${{ matrix.dependencies }} - name: Run Tests with coverage @@ -109,3 +64,14 @@ jobs: # uses: codecov/codecov-action@v4 # with: # files: build/logs/clover.xml + + # Single check to require in the branch protection of main: its name does not depend on the matrix + tests-passed: + name: Tests passed + if: always() + needs: [test] + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Check the result of the jobs + run: test "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" = false diff --git a/composer.json b/composer.json index 7de07557..1b71bcf5 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "phpstan/extension-installer": "*", "phpstan/phpstan": "*", "phpstan/phpstan-symfony": "*", - "phpunit/phpunit": "^10.5|^11|^12|^13", + "phpunit/phpunit": "^11.5|^12|^13", "rector/rector": "*", "roave/security-advisories": "dev-latest", "symfony/cache": "^6.4|^7.4|^8", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9e8b6885..e95707ad 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ Date: Thu, 22 Oct 2026 18:57:59 +0200 Subject: [PATCH 2/3] #347 - PHPUnit: ^11.5.50, the lowest version tested before (11.5.0 reports the exception handlers of the Symfony kernel as not removed) Co-Authored-By: Claude Opus 5.5 (1M context) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1b71bcf5..745a063b 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "phpstan/extension-installer": "*", "phpstan/phpstan": "*", "phpstan/phpstan-symfony": "*", - "phpunit/phpunit": "^11.5|^12|^13", + "phpunit/phpunit": "^11.5.50|^12|^13", "rector/rector": "*", "roave/security-advisories": "dev-latest", "symfony/cache": "^6.4|^7.4|^8", From 010717ffdb301a65cf9617aee96a78eaf2dca8ee Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 22 Oct 2026 22:04:32 +0200 Subject: [PATCH 3/3] #347 - PHPUnit: keep ^10.5, installed by the lowest build Co-Authored-By: Claude Opus 5.5 (1M context) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 745a063b..7de07557 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "phpstan/extension-installer": "*", "phpstan/phpstan": "*", "phpstan/phpstan-symfony": "*", - "phpunit/phpunit": "^11.5.50|^12|^13", + "phpunit/phpunit": "^10.5|^11|^12|^13", "rector/rector": "*", "roave/security-advisories": "dev-latest", "symfony/cache": "^6.4|^7.4|^8",