ci: Only run RuboCop on changed files
What does this MR do and why?
This makes the rubocop
job only run on changed files, unless on master
or if RUN_ALL_RUBOCOP == "true"
, which is set when any RuboCop config file is touched.
This implements the idea from #370975 (comment 1070335109).
Testing
In !96203 (closed):
- When I touched
.rubocop.yml
, and therubocop
job indeed ran for all files: https://gitlab.com/gitlab-org/gitlab/-/jobs/2930622456 - When I touched
app/models/user.rb
,rubocop
only ran for a subset of files: https://gitlab.com/gitlab-org/gitlab/-/jobs/2935400951
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Rémy Coutable