Skip to content

Travis: run the code style related checks in separate stage#798

Merged
wimg merged 1 commit intomasterfrom
feature/travis-use-build-stages
May 29, 2019
Merged

Travis: run the code style related checks in separate stage#798
wimg merged 1 commit intomasterfrom
feature/travis-use-build-stages

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented May 22, 2019

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 it is respected.

For more discussion about this:

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 from 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.

@jrfnl jrfnl added Type: chores/QA PR: quick merge PR only contains relatively simple changes PR: ready for review labels May 22, 2019
@jrfnl jrfnl added this to the 9.x Next milestone May 22, 2019
@jrfnl jrfnl requested a review from wimg May 22, 2019 13:41
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.
@jrfnl jrfnl force-pushed the feature/travis-use-build-stages branch from ccd5f39 to 104438f Compare May 22, 2019 13:46
@wimg wimg merged commit 369fcf0 into master May 29, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/travis-use-build-stages branch May 29, 2019 00:05
@jrfnl jrfnl removed the PR: quick merge PR only contains relatively simple changes label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants