Skip to content

GH Actions: fix cs annotations not showing #1063

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

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 28, 2025

Description

As things are, the CS check for the PHPCS codebase is run in the test workflow as an integration test and will show inline annotations about code style issues in PRs. These annotations are intended to help contributors identify issues with their PR.

As the test workflow is run against a large range of PHP versions and OSes, this showing of the annotations was limited to PHP 8.4 + Ubuntu to prevent the contributor seeing a wall of duplicate annotations when issues would be found (one for each test build).

However, the test workflow also uses the "fail-fast" option, cancelling the builds on the first failure, which means the PHP 8.4/Ubuntu build may have been cancelled before it was run, in which case, the inline CS annotations don't show at all.

This means the current setup is counter-productive as in most cases, PR annotations will not show, even when they should be shown.

This commit intends to fix this by adding a separate CS run against PHP "latest" to the validate workflow.
This CS run in the validate workflow will now trigger the showing of annotations, and as this job is stand-alone, will not be subject to cancellation due to other builds failing.
The code related to showing the annotations has been removed from the test workflow.

Yes, this does mean the CS check will have a semi-duplicated run in the test workflow. I do not see this as a problem as:

  1. The intention behind that run is different ("integration test" vs "cs check").
  2. The CS run in the test workflow is run with different settings - --no-cache --parallel=1 -, meaning more variations of PHPCS CLI args are tested.

Suggested changelog entry

N/A

As things are, the CS check for the PHPCS codebase is run in the `test` workflow as an integration test and will show inline annotations about code style issues in PRs. These annotations are intended to help contributors identify issues with their PR.

As the `test` workflow is run against a large range of PHP versions and OSes, this showing of the annotations was limited to PHP 8.4 + Ubuntu to prevent the contributor seeing a wall of duplicate annotations when issues would be found (one for each test build).

However, the `test` workflow also uses the "fail-fast" option, cancelling the builds on the first failure, which means the PHP 8.4/Ubuntu build may have been cancelled before it was run, in which case, the inline CS annotations don't show at all.

This means the current setup is counter-productive as in most cases, PR annotations will not show, even when they should be shown.

This commit intends to fix this by adding a separate CS run against PHP "latest" to the `validate` workflow.
This CS run in the `validate` workflow will now trigger the showing of annotations, and as this job is stand-alone, will not be subject to cancellation due to other builds failing.
The code related to showing the annotations has been removed from the `test` workflow.

Yes, this does mean the CS check will have a semi-duplicated run in the `test` workflow.
I do not see this as a problem as:
1. The _intention_ behind that run is different ("integration test" vs "cs check").
2. The CS run in the `test` workflow is run with different settings - `--no-cache --parallel=1` -, meaning more variations of PHPCS CLI args are tested.
@jrfnl jrfnl added this to the 3.13.0 milestone Apr 28, 2025
@jrfnl
Copy link
Member Author

jrfnl commented Apr 28, 2025

Note: branch protection should be updated once this PR has been merged.

@jrfnl jrfnl merged commit 23feb19 into master Apr 28, 2025
65 checks passed
@jrfnl jrfnl deleted the feature/ghactions-fix-inline-annotations-for-cs-errors branch April 28, 2025 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant