-
Notifications
You must be signed in to change notification settings - Fork 47
Updated ubuntu and actions in GH workflow #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughCI workflow updated to modern Actions: triggers expanded, runner and checkout updated, PHP and Composer setup made explicit, composer validation and dependency install steps added, PHPUnit invoked directly with Xdebug coverage, and coverage upload to Codecov restricted to PHP 8.4. Composer dev deps adjusted (removed rector, broadened symfony/string). Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub Actions
participant Runner as ubuntu-latest
participant Checkout as actions/checkout@v5
participant PHP as shivammathur/setup-php@v2
participant ComposerValidate as composer validate
participant ComposerInstall as ramsey/composer-install@v3
participant PHPUnit as vendor/bin/phpunit
participant Codecov as codecov/codecov-action@v4
GH->>Runner: Trigger on push/pull_request
Runner->>Checkout: checkout repo
Runner->>PHP: setup PHP (matrix.php-version, xdebug, extensions, composer tool)
Runner->>ComposerValidate: composer validate --strict
Runner->>ComposerInstall: install dependencies (--no-interaction --prefer-dist)
Runner->>PHPUnit: run tests with coverage (XDEBUG_MODE=coverage)
alt matrix.php-version == '8.4'
Runner->>Codecov: upload ./coverage.xml (disable_search, fail_ci_if_error)
end
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Tip π Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. Warning Review ran into problemsπ₯ ProblemsErrors were encountered while retrieving linked issues. Errors (1)
β¨ Finishing Touchesπ§ͺ Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
π§Ή Nitpick comments (2)
.github/workflows/phpunit.yml (2)
3-6
: Avoid duplicate CI runs and keep permissions minimalRunning on both push and pull_request can double-trigger CI on branch PRs. Consider either scoping push (e.g., default branch only) or adding concurrency/cancellation to prevent redundant runs. Permissions look good and minimal.
If you want, I can propose a concurrency group snippet to auto-cancel superseded runs on the same branch.
30-34
: Slightly reduce noise during installConsider adding --no-progress to cut log noise in CI.
- name: Install dependencies uses: ramsey/composer-install@v3 with: - composer-options: --no-interaction --prefer-dist + composer-options: --no-interaction --prefer-dist --no-progress
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π‘ Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
π Files selected for processing (1)
.github/workflows/phpunit.yml
(1 hunks)
π Additional comments (4)
.github/workflows/phpunit.yml (4)
10-10
: LGTM: Runner moved to ubuntu-latestUsing ubuntu-latest is aligned with GitHub Actions recommendations and keeps images current.
16-16
: LGTM: checkout updated to v5Upgrading to actions/checkout@v5 is good for performance and security.
27-29
: LGTM: Composer validation addedcomposer validate --strict early-fails bad manifests; good addition.
14-14
: PHP matrix matches composer.json β OKcomposer.json allows ">=7.4 || >=8.0", so the workflow matrix (7.4, 8.0, 8.4) is compatible and phpunit is present in dev deps.
- Files to note:
- .github/workflows/phpunit.yml β php-version: [ "7.4", "8.0", "8.4" ] (matrix)
- composer.json (repo root) β require.php: ">=7.4 || >=8.0"
- composer.json β require-dev: "phpunit/phpunit": "^9.5"
Optional: mark 8.4 as experimental with a matrix include + continue-on-error if you want to avoid CI failures from upstream incompatibilities.
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php_version: "${{ matrix.php-versions }}" | ||
dev: yes | ||
interaction: no | ||
- name: PHPUnit Tests php | ||
uses: php-actions/phpunit@v2 | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: curl, json | ||
coverage: xdebug | ||
tools: composer:v2 | ||
ini-values: xdebug.mode=coverage | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Enable Xdebug/coverage only on the coverage job; drop redundant json extension
- json is built-in on supported PHP versions; no need to list it.
- You enable coverage for every matrix job; that slows tests considerably. Only the 8.4 job uploads coverage, so turn Xdebug on only there.
Apply:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- extensions: curl, json
- coverage: xdebug
+ extensions: curl
+ coverage: ${{ matrix.php-version == '8.4' && 'xdebug' || 'none' }}
tools: composer:v2
- ini-values: xdebug.mode=coverage
Then adjust the PHPUnit step (see below) to only enable coverage on 8.4.
Committable suggestion skipped: line range outside the PR's diff.
π€ Prompt for AI Agents
.github/workflows/phpunit.yml lines 18-26: the workflow currently lists the
built-in json extension and enables Xdebug/coverage for every matrix job; remove
json from the extensions list and make Xdebug/coverage and its ini-values only
enabled for the 8.4 matrix job. Update the setup-php step to omit json (e.g.,
extensions: curl) and add a conditional so coverage: xdebug and ini-values:
xdebug.mode=coverage are set only when matrix.php-version == '8.4', and then
modify the PHPUnit step to only run coverage-related flags/upload when
matrix.php-version == '8.4'.
- name: Run PHPUnit | ||
run: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml --exclude-group local-only | ||
env: | ||
XDEBUG_MODE: coverage | ||
- name: Upload to Codecov | ||
uses: codecov/codecov-action@v1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Run coverage only on PHP 8.4 to speed up the matrix
Currently you collect coverage on all PHP versions. Use a small shell wrapper to only enable coverage on 8.4 and run plain tests elsewhere.
- - name: Run PHPUnit
- run: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml --exclude-group local-only
- env:
- XDEBUG_MODE: coverage
+ - name: Run PHPUnit
+ run: |
+ if [[ "${{ matrix.php-version }}" == "8.4" ]]; then
+ XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml --exclude-group local-only
+ else
+ vendor/bin/phpunit --configuration phpunit.xml --exclude-group local-only
+ fi
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Run PHPUnit | |
run: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml --exclude-group local-only | |
env: | |
XDEBUG_MODE: coverage | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v1 | |
- name: Run PHPUnit | |
run: | | |
if [[ "${{ matrix.php-version }}" == "8.4" ]]; then | |
XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-clover=coverage.xml --exclude-group local-only | |
else | |
vendor/bin/phpunit --configuration phpunit.xml --exclude-group local-only | |
fi |
π€ Prompt for AI Agents
In .github/workflows/phpunit.yml around lines 35 to 39, the workflow currently
sets XDEBUG_MODE: coverage and collects coverage on every PHP version; change
the run command to a small shell wrapper that checks the PHP version (e.g., from
the matrix PHP version env or php -v) and only sets XDEBUG_MODE=coverage and
passes --coverage-clover=coverage.xml when the version equals 8.4, otherwise run
vendor/bin/phpunit without XDEBUG_MODE and without the --coverage-clover flag;
ensure the wrapper preserves the PHPUnit exit code so the job fails on test
failures.
- name: Upload coverage to Codecov | ||
if: matrix.php-version == '8.4' | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
files: ./coverage.xml | ||
disable_search: true | ||
fail_ci_if_error: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Prevent failures on forked PRs; gate Codecov upload by event
On pull_request from forks, CODECOV_TOKEN is not available. With fail_ci_if_error: true, the workflow can fail the PR. Gate the upload to push events (or when the token exists).
- - name: Upload coverage to Codecov
- if: matrix.php-version == '8.4'
+ - name: Upload coverage to Codecov
+ if: github.event_name == 'push' && matrix.php-version == '8.4'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
disable_search: true
- fail_ci_if_error: true
+ fail_ci_if_error: true
Alternatively, if you want uploads on PRs from the same repo, use:
- if: matrix.php-version == '8.4' && github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Upload coverage to Codecov | |
if: matrix.php-version == '8.4' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
files: ./coverage.xml | |
disable_search: true | |
fail_ci_if_error: true | |
- name: Upload coverage to Codecov | |
if: github.event_name == 'push' && matrix.php-version == '8.4' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
disable_search: true | |
fail_ci_if_error: true |
π€ Prompt for AI Agents
.github/workflows/phpunit.yml around lines 40 to 47: the Codecov upload step
currently runs on pull_request for forked PRs where CODECOV_TOKEN is unavailable
and fail_ci_if_error:true can fail the workflow; update the stepβs if condition
to only run when itβs safe β e.g., require push events or that the event is a
pull_request from the same repo (github.event_name != 'pull_request' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork
== false)), or alternatively check that secrets.CODECOV_TOKEN exists before
running β this will prevent failures on forked PRs while allowing uploads from
allowed events.
- Keeping it in require-dev breaks Composer install on PHP 7.4 (the project supports 7.4) because rector/rector requires PHP β₯ 8.1. - `rector.php` remains; contributors can install and run Rector locally when needed.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #219 +/- ##
============================================
- Coverage 86.44% 86.40% -0.05%
+ Complexity 973 971 -2
============================================
Files 75 75
Lines 2604 2603 -1
============================================
- Hits 2251 2249 -2
- Misses 353 354 +1 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
π Outside diff range comments (1)
composer.json (1)
27-27
: Tighten PHP platform constraintThe current constraint ">=7.4 || >=8.0" effectively resolves to ">=7.4" and unintentionally permits PHP 9.x. Use caret constraints to express the supported major lines.
Apply this diff:
- "php": ">=7.4 || >=8.0", + "php": "^7.4 || ^8.0",
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π‘ Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
π Files selected for processing (1)
composer.json
(1 hunks)
π Additional comments (1)
composer.json (1)
39-41
: Incorrect: Symfony 5.4 dev deps wonβt block PHP 8.4; widening is optionalcomposer.json (require-dev) indeed has:
- symfony/string: "^5.4 || ^6.4"
- symfony/dotenv: "^5.4"
- symfony/var-dumper: "^5.4"
CI runs PHP 8.4 (.github/workflows/phpunit.yml includes 8.4). However Symfony 5.4 components (e.g. symfony/dotenv 5.4) declare only minimum PHP requirements (dotnev 5.4: >=7.1.3), so they do not prevent installation on PHP 8.4 β the original claim that PHP 8.4 will cause composer resolution failures is incorrect.
If you want consistent dev-dep constraints (recommended but optional), you can apply this diff:
- "symfony/string": "^5.4 || ^6.4", - "symfony/dotenv": "^5.4", - "symfony/var-dumper": "^5.4", + "symfony/string": "^5.4 || ^6.4", + "symfony/dotenv": "^5.4 || ^6.4", + "symfony/var-dumper": "^5.4 || ^6.4",Files to note:
- composer.json (lines ~39β41)
- .github/workflows/phpunit.yml (matrix includes PHP 8.4)
Likely an incorrect or invalid review comment.
"require-dev": { | ||
"fakerphp/faker": "^1.20", | ||
"friendsofphp/php-cs-fixer": "^3.11", | ||
"phpunit/phpunit": "^9.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Verification agent
π§© Analysis chain
Verify PHPUnit compatibility with PHP 8.4; consider upgrade
CI runs on PHP 8.4 (at least for coverage). PHPUnit 9.5 may not be fully compatible with PHP 8.4. Consider bumping to a PHPUnit version line that explicitly supports PHP 8.4 (likely 10.x or 11.x), noting that this may require test and config updates.
Please check latest compatibility and version:
π Web query:
What PHPUnit versions officially support PHP 8.4, and what is the latest stable PHPUnit version?
π‘ Result:
PHPUnit version 12 is the first and only major version that officially supports PHP 8.4. The latest stable PHPUnit release as of August 14, 2025, is PHPUnit 12.1[1][4][7][8][10].
- PHPUnit 12: Requires PHP 8.3 or newer (including PHP 8.4). The official documentation and release notes for version 12 clarify that if you are not using at least PHP 8.3 or 8.4, you cannot use PHPUnit 12[1][4][7].
- No earlier PHPUnit versions (9.x, 10.x, 11.x) are officially compatible with PHP 8.4, as each prior version has stricter maximum PHP version requirements[4].
- Life support: While older PHPUnit versions may receive "life support" updates to allow running on newer PHP versions (when feasible), official compatibility and guaranteed support for PHP 8.4 begin with PHPUnit 12[4].
PHPUnit Version | Minimum Supported PHP | Official PHP 8.4 Support |
---|---|---|
12.x | 8.3 | Yes |
11.x | 8.2 | No |
10.x | 8.1 | No |
- Latest release: The most recent stable release is PHPUnit 12.1, available as of August 2025[8][10].
Summary:
Only PHPUnit 12.x (starting from PHPUnit 12.0.0, with latest 12.1 as of this date) is officially supported for PHP 8.4. Older PHPUnit versions (11, 10, 9) do not claim compatibility with PHP 8.4[1][4][8].
Citations:
- 1: https://phpunit.de/announcements/phpunit-12.html
- 2: https://moodledev.io/general/development/tools/phpunit/upgrading-11
- 3: https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/
- 4: https://phpunit.de/supported-versions.html
- 5: https://laravelshift.com/upgrade-phpunit-10
- 6: https://core.trac.wordpress.org/ticket/46149
- 7: https://phpunit.de/getting-started/phpunit-12.html
- 8: https://phpunit.de/announcements/index.html
- 9: https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/
- 10: https://packagist.org/packages/phpunit/phpunit
Upgrade PHPUnit to 12.x for PHP 8.4 compatibility
Composer currently requires "phpunit/phpunit": "^9.5" which is not officially compatible with PHP 8.4. PHPUnit 12.x is the first major line that supports PHP 8.4 (latest stable β 12.1 as of Aug 14, 2025). Bump the dev dependency and run the test suite β config and tests may need updates for PHPUnit 12 breaking changes.
Files/locations to update/check:
- composer.json (root) β replace the dev dependency line:
"phpunit/phpunit": "^12.1",
- phpunit.xml / phpunit.xml.dist β review for deprecated/changed config options
- tests/ β run and fix any failing tests or deprecations
π€ Prompt for AI Agents
In composer.json around line 38, the dev dependency pins phpunit to ^9.5 which
is incompatible with PHP 8.4; update the line to require PHPUnit 12.x (e.g.
^12.1), run composer update --dev to install PHPUnit 12, then open phpunit.xml /
phpunit.xml.dist and adjust any deprecated/removed config keys to the PHPUnit 12
schema and run the test suite, fixing any failing tests or API changes
(namespaces, assertions, setUp/tearDown signatures, type hints, and lifecycle
hooks) until the suite passes.
"symfony/string": "^5.4 || ^6.4", | ||
"symfony/dotenv": "^5.4", | ||
"symfony/var-dumper": "^5.4", | ||
"vimeo/psalm": "^4.27" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Verification agent
π§© Analysis chain
Psalm v4 likely outdated for PHP 8.4
vimeo/psalm ^4.27 is quite old; newer PHP versions often require Psalm 5+ or 6+. Running CI on PHP 8.4 may hit constraint or runtime analysis issues. Consider upgrading Psalm.
Please verify current compatibility and upgrade guidance:
π Web query:
What are the current supported PHP versions for vimeo/psalm versions 4, 5, and 6? Which Psalm version supports PHP 8.4?
π‘ Result:
Short answer (current as of 2025-08-14):
- Psalm 4.x β supports PHP 7.3 and PHP 8 (composer constraint shown as php ^7.3 || ^8). (github.com)
- Psalm 5.x β requires PHP β₯7.4 and its releases were bumped to explicitly allow up through PHP 8.3 (constraints like php ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 in recent 5.x releases). (github.com)
- Psalm 6.x β moves Psalm to require a modern PHP (planning targeted PHP β₯8.1) and Psalm v6 added official PHP 8.4 support. In other words, Psalm 6 supports PHP 8.4. (github.com)
So: Psalm 6 is the release line that supports PHP 8.4. If you want, I can fetch the exact composer "require" line from a specific tag (e.g. v4.30.0, v5.26.1, v6.0.0) and paste it here. Which exact version(s) do you want checked?
Citations:
- 1: https://github.com/vimeo/psalm/discussions/4987?utm_source=chatgpt.com
- 2: https://github.com/vimeo/psalm/issues/11194?utm_source=chatgpt.com
- 3: https://github.com/vimeo/psalm/discussions/10701?utm_source=chatgpt.com
Upgrade vimeo/psalm to a release that supports PHP 8.4
Psalm is pinned to "vimeo/psalm": "^4.27" (composer.json, line 42) β Psalm 4.x does not support PHP 8.4. Psalm 6.x adds official PHP 8.4 support (Psalm 5.x covers up to ~8.3). Recommend upgrading Psalm to 6.x and verifying the repo after the major bump.
Files to change:
- composer.json β line ~42
Suggested change (diff):
- "vimeo/psalm": "^4.27"
- "vimeo/psalm": "^6.0"
After upgrading: run composer update, run psalm, fix any new issues or plugin/config incompatibilities, and run your test suite.
π€ Prompt for AI Agents
In composer.json around line 42, Psalm is pinned to "vimeo/psalm": "^4.27" which
lacks PHP 8.4 support; update the requirement to "vimeo/psalm": "^6.0" in
composer.json, run composer update to fetch Psalm 6.x, then run psalm and the
test suite, and fix any new type errors or plugin/config incompatibilities
introduced by the major upgrade.
Summary by CodeRabbit