Page MenuHomePhabricator

MediaWiki core PHPCS job should only run against files changed in HEAD
Closed, ResolvedPublic

Description

The Jenkins job mediawiki-core-phpcs-trusty runs PHP CodeSniffer against every single files. That is one of the slowest jobs we have. We could be smarter and only run against files changed in the patchset proposed which would dramatically speed it up.

phpcs supports a bootstrap file that would let us finely tweak it is state after all arguments and configuration have been processed and just before the lint actually starts.

Thus, we could shell out to git just like the slave script git-changed-in-head, grab the files, filter out the one that do not match phpcs.xml extension: <arg name="extensions" value="php,php5,inc,sample"/> and process :}

Event Timeline

Change 339666 had a related patch set uploaded (by Paladox):
Add new mediawiki-core-composer-test-HEAD-php55lint-trusty test

https://gerrit.wikimedia.org/r/339666

Change 339675 had a related patch set uploaded (by Hashar):
PHP CodeSniffer on CI should only lint HEAD

https://gerrit.wikimedia.org/r/339675

Change 339666 abandoned by Hashar:
Add new mediawiki-core-composer-test-HEAD-php55lint-trusty test

Reason:
Running PHP CodeSniffer solely on files changed in HEAD will make it way faster indeed. https://gerrit.wikimedia.org/r/#/c/339675/ is a simpler approach.

https://gerrit.wikimedia.org/r/339666

Once reviewed/happy with it, I guess we will be able to merge phpcs in the job mediawiki-phpunit-hhvm-jessie :]

Change 358554 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/tools/codesniffer@master] PHP CodeSniffer on CI should only lint HEAD

https://gerrit.wikimedia.org/r/358554

Change 339675 abandoned by Hashar:
PHP CodeSniffer on CI should only lint HEAD

Reason:
Lets ship it in mediawiki/tools/codesniffer instead https://gerrit.wikimedia.org/r/358554

https://gerrit.wikimedia.org/r/339675

Change 358554 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] PHP CodeSniffer on CI should only lint HEAD

https://gerrit.wikimedia.org/r/358554

Change 363461 had a related patch set uploaded (by Legoktm; owner: Hashar):
[mediawiki/tools/codesniffer@0.8.x] PHP CodeSniffer on CI should only lint HEAD

https://gerrit.wikimedia.org/r/363461

Change 363461 merged by jenkins-bot:
[mediawiki/tools/codesniffer@0.8.x] PHP CodeSniffer on CI should only lint HEAD

https://gerrit.wikimedia.org/r/363461

hashar added a subscriber: Legoktm.

Summary

The patch made it to codesniffer 0.8.1 (thank you @Legoktm )

The job mediawiki-core-phpcs-jessie thus went from ~ 5-7 minutes to 1 min 30s.

So I guess it is now a candidate to be merged in mediawiki-phpunit-hhvm-jessie

Change 423677 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/quibble@master] Speed up php lint/style with git-changed-in-head

https://gerrit.wikimedia.org/r/423677

Change 423677 merged by jenkins-bot:
[integration/quibble@master] Speed up php lint/style with git-changed-in-head

https://gerrit.wikimedia.org/r/423677