GitHub actions: run phpcs, ruff, and the Python tests on every PR#18
Open
GitHub actions: run phpcs, ruff, and the Python tests on every PR#18
Conversation
We're about to wire ruff into CI, and I want local runs to match what CI will report. A pyproject.toml at the repo root is the simplest way to get that; ruff picks it up automatically with no arguments. The config is deliberately small: Python 3.12 target, 100-character line length, and the pycodestyle, pyflakes, and import-sorting rule groups. No custom ignores yet; we'll add them when a real violation warrants it.
Running ruff against lib/ and tests/ for the first time surfaced 19 issues; none interesting, all mechanical. Fixing them now means the new ci.yml ruff job will be green on the first run instead of landing red and immediately needing a cleanup PR on top. The fixes fall in three buckets: import ordering (handled by ruff --fix), trailing whitespace on blank lines, and a handful of lines over 100 characters that I wrapped by either extracting a local variable or splitting a long string literal. No behavior changes; the unittest suite still passes 83/83.
Until now there was no automated gate on pull requests; a reviewer had to remember to run phpcs, ruff, and the unittest suite by hand. This adds a GitHub Actions workflow that runs all three on every PR (and on pushes to main, so the default branch status stays fresh). Of note: - Three parallel jobs, no dependency chain. A phpcs failure shouldn't hide Python feedback and vice versa. - PHP 8.4 and Python 3.12, single versions only. phpcs is style-only so runtime version doesn't matter, and we can add a matrix later if the need shows up. - Ruff runs with --output-format=github, which produces inline PR annotations for free. - phpcs output stays in the Actions log. I considered piping it through cs2pr for inline annotations, but that adds a dependency I'd rather not introduce for a project this size. - No PHP test job yet; we don't have any PHP tests to run. That's a separate ticket. Marking the three jobs as required status checks is a one-time click in branch protection settings, which I'll do after this merges. Refs: ARC-1682
Once branch protection is on and everything lands through a PR, the merge commit on main came from a PR that already went green. Running CI a second time on that same SHA doesn't tell us anything new; it just burns minutes. Leaving only pull_request as a trigger. If someone ever needs to push directly to main, that's a branch protection failure worth addressing at the source, not something CI should paper over.
obenland
reviewed
Apr 9, 2026
Co-authored-by: Konstantin Obenland <obenland@gmx.de>
The previous commit indented the ruff-action step with 7 spaces instead of 6, making GitHub reject the workflow with a YAML syntax error. Also drop the setup-python step since ruff-action installs ruff itself, and cache: pip would fail with no dependency file.
obenland
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today there's no automated gate on pull requests; a reviewer has to remember to run phpcs, ruff, and the unittest suite by hand. This PR adds a GitHub Actions workflow that runs all three in parallel on every PR, so regressions get caught mechanically and human review can focus on intent rather than style.
What's in here
.github/workflows/ci.ymlwith three jobs:phpcs,ruff, andpython-tests. They run in parallel with no dependency chain, so a phpcs failure doesn't hide Python feedback and vice versa.pyproject.tomlat the repo root so localruff checkproduces the same output as CI. Python 3.12 target, 100-character lines, pycodestyle + pyflakes + import sorting.Of note
--output-format=github, which gets us inline PR annotations for free.pull_requestonly, nopush: main. Once branch protection is on, the merge commit on main came from a PR that already went green, so running CI a second time there just burns minutes.Follow-up
We could then marking
phpcs,ruff, andpython-testsas required status checks in this repo's branch protection settings.How I tested
I tested the workflow with a PR in my fork of this repo, and it was successful.