Travis: run the code style related checks in separate stage#798
Merged
Conversation
Travis now offers stages. Using stages we can: - Run the code style related checks before running any unit tests and stop the build early if any are detected. - Only run the (heavy) code coverage builds when we already know that the unit tests for most builds pass. While this does mean that the unit tests will run with a slight delay (the `Sniff` stage has to finish before they start), it also means that we: * Get code style errors reported earlier as it's been moved to be the first stage and the build will just stop if any are found. * We won't be wasting Travis's resources on builds which will have to be re-run anyway. * The output of the Travis jobs will be a lot easier to decipher as it only shows the output related to that particular stage. Ref: https://docs.travis-ci.com/user/build-stages/ Note that `Allowed failures` is no longer listed as a separate block in the Travis result overview, but is _is_ respected. For more discussion about this: * travis-ci/travis-ci#7789 * https://travis-ci.community/t/always-show-allow-failures-allowed-failures-when-build-stages-are-used/217 * https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090 * travis-ci/travis-ci#9677 In addition to this, this PR makes the following changes to the Travis script: * Removes `sudo: false` as it is no longer supported. This switches the build form container-based builds to VM based. See: https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration * Groups the two separate `cache` directives together. * Simplifies the setting of the `env` variable for the PHPUnit version for those PHP versions which cannot use the Travis image default PHPUnit version. * Removes the global `COVERALLS_VERSION` `env` variable which is no longer needed. * Updates the PHPCS versions in the "mix it up" builds. * Removes `composer self-update` which is no longer needed. Travis does this by default. * Adds `--no-update` to the additional Composer requires so we only invoke `composer install` once, instead of potentially four times. * Updates the PHP `lint` command to have simpler output (no more the long list of files). * Attempts to make the script more readable by using multi-line conditions whenever the line would become quite long. It also removes the `phpunit-travis.xml` file and moves the additional config into the normal `phpunit.xml.dist` file. To run PHPUnit without code coverage, either run it on a PHP version without Xdebug enabled or run it with the `--no-coverage` command-line flag. This flag has also been added to the relevant commands in the Travis build script.
ccd5f39 to
104438f
Compare
wimg
approved these changes
May 29, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Travis now offers stages. Using stages we can:
While this does mean that the unit tests will run with a slight delay (the
Sniffstage has to finish before they start), it also means that we:Ref: https://docs.travis-ci.com/user/build-stages/
Note that
Allowed failuresis no longer listed as a separate block in the Travis result overview, but it is respected.For more discussion about this:
In addition to this, this PR makes the following changes to the Travis script:
sudo: falseas it is no longer supported.This switches the build from container-based builds to VM based.
See: https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
cachedirectives together.envvariable for the PHPUnit version for those PHP versions which cannot use the Travis image default PHPUnit version.COVERALLS_VERSIONenvvariable which is no longer needed.composer self-updatewhich is no longer needed. Travis does this by default.--no-updateto the additional Composer requires so we only invokecomposer installonce, instead of potentially four times.lintcommand to have simpler output (no more the long list of files).It also removes the
phpunit-travis.xmlfile and moves the additional config into the normalphpunit.xml.distfile. To run PHPUnit without code coverage, either run it on a PHP version without Xdebug enabled or run it with the--no-coveragecommand-line flag.This flag has also been added to the relevant commands in the Travis build script.