wp-dev-lib icon indicating copy to clipboard operation
wp-dev-lib copied to clipboard

Improve Travis build time

Open JDGrimes opened this issue 10 years ago • 3 comments

I was working on improving the build time for a plugin a while back, and I found that there is potential here for some significant improvements:

  • [ ] Run codesniffing tools only once. There's no need to install all of these tools for each and every build only to run them over the same code. WordPress has implemented this.
  • [ ] The PHP syntax check still needs to run for every version of PHP, but it should only run once for each version. Like only when WP_VERSION=latest.
  • [x] Add sudo: false to the config file so that the new, faster, container-based infrastructure is used. It means you can't use sudo though. (WordPress has also implemented this.)
  • [ ] Add fast_finish: true to the matrix. This will notify you of a failure as soon as it happens, rather than waiting until the whole build is finished. Then, by running the codesniff pass first, you get notified almost instantaneously for codesniff errors.
  • [ ] Run WP_MULTISITE=1 and WP_MULTISITE=0 both on on a single pass for each version of WordPress. This speeds things up because it takes long enough to download WordPress that parallelization of multisite on/off is futile.
  • [ ] Don't run composer install on the codesniff pass. I don't see any reason it would be needed, unless the project is using other codesniffing tools that they are installing with composer. And in that case, they can run composer install themselves.

I have implemented all of this for a plugin, and I'd be happy to submit a PR if you are interested.

JDGrimes avatar Feb 20 '15 14:02 JDGrimes

Awesome! Yes, I'd love to see a PR for this. This would really help with private repos on Travis, where build time is a premium. /cc @shadyvb

westonruter avatar Feb 20 '15 16:02 westonruter

Seeing as I'm watching this repo, a couple more suggestions in addition to @JDGrimes:

If you move to checking out the WordPress develop repo it includes everything needed for PHPUnit and WordPress tests, also checking out with Git it is significantly faster than what wp-dev-lib is currently using here via WP-CLI's wget/svn checkouts.

No need for for the MYSQLi database layer any more.

Take a peek at bbPress' .travis.yml file for some hints and jump starting a pull request ;) https://bbpress.trac.wordpress.org/browser/trunk/.travis.yml

ntwb avatar Feb 21 '15 03:02 ntwb

@ntwb thanks for the input!

For reference, here is what WP-CLI is doing: https://github.com/wp-cli/wp-cli/blob/master/templates/install-wp-tests.sh

Right, a git clone with --depth=1 I suppose would be faster than an SVN checkout, or maybe just as fast, since it would only be making one request instead of downloading/checking out multiple SVN URLs.

Will you be opening a PR to improve that install-wp-tests.sh template in WP-CLI itself? If the performance can be fixed it in WP-CLI directly, then there will be more benefit all around.

westonruter avatar Feb 21 '15 20:02 westonruter