phpro / grumphp

A PHP code-quality tool
MIT License
4.14k stars 429 forks source link

Add support for pre-push tasks #942

Closed dshafik closed 2 years ago

dshafik commented 2 years ago
Q A
Version GrumPHP 1.5.0
Bug? no
New feature? yes
Question? no
Documentation? no
Related tickets n/a

Currently GrumPHP supports being run as a pre-commit hook, however some tasks we want to run only pre-push. These would be time-consuming tasks such as psalm or running our test suite.

In our case, we want to run our test suite on bare metal in pre-commit (~20s), but in Docker in pre-push (~3m).

The way I see this functioning is adding new config options as siblings to tasks, pre-commit and pre-push, each either their own tasks sub-key. pre-commit.tasks would execute identically to tasks in it's functionality (and either could be used, for backwards compatibility), the second pre-push.tasks would run when the git:pre-push command is run.

You would also need to allow the other siblings of tasks (e.g. git_hook_variables, process_timeout, fixer, parallel etc.) as children of pre-commit and pre-push.

I understand this is a large change, and I'm happy to try and spend some time on implementing it if there's interest?