CI: Replace pre-commit with prek - #119150
Conversation
akien-mga
left a comment
There was a problem hiding this comment.
Tested briefly, seems fine to me.
We need to update our documentation on how to set-up prek.
I was worried it would require users to have cargo to compile it, but it seems there's a lot of options (too many?) for binary installs: https://github.com/j178/prek#installation
We should figure out what to recommend for our contributors so the steps to set up prek aren't more complex than pre-commit (especially regarding having it in PATH). It seems it's provided as a pip package so pip install prek is at least something we can expect all contributors with a Python/SCons setup to be able to run.
|
For future reference, these are the hook runtimes on my system with prek using The two hooks that take the most time by a wide margin are Regarding the installation process, The DetailsPC specifications
|
|
Cherry-picked for 4.6.3. |
|
Cherry-picked for 4.5.3. |
|
This seems to cause a problem in Godot forks. A failure occurs whenever there is a large diff between the branch's previous state and the new state, resulting in an "Argument list too long" error. So essentially, if anyone has a Godot fork, and they just... don't sync their
For reference, see this CI run: https://github.com/godot-dimensions/godot/actions/runs/30243286140/job/89904801550 Also, another problem: When a brand new branch is created, the list of changed files is reported as nothing... so the checks completely skip everything, and a style problem would go unchecked until after the user submits that branch as a PR.
EDIT: I submitted #121819 to fix it. |
CI: Replace `pre-commit` with `prek`


Prek is the latest in a line of toolkits written in Rust meant to serve as drop-in replacements for industry-standard tools. This time, it's a replacement for pre-commit itself, and a damn good one at that. Comparing this repo's action runs, prek's action from a clean base took ~14 seconds, while pre-commit's cached action took ~25 seconds
Prek was ~11 seconds faster without a cache than pre-commit with a cache
It truly is a drop-in replacement, as the tool reads from
.pre-commit-config.yamlwithout issue. This means that users utilizingpre-commitdirectly may continue to do so at this time. It's entirely capable of reading from its own dedicated file—prek.toml—and supports unique configurations which aren't supported by pre-commit, but this PR aims to be as painless of a drop-in replacement as possible. It's unique options and dedicated file can be pursued in a followup, if desired