Brain-WP / BrainMonkey

Mocking utility for PHP functions and WordPress plugin API
https://giuseppe-mazzapica.gitbook.io/brain-monkey/
MIT License
304 stars 29 forks source link

GH Actions: mixed bag of improvements #113

Closed jrfnl closed 3 years ago

jrfnl commented 3 years ago

GH Actions: another ini tweak

Follow up on #99: also enable assertions, which are turned off by default when using setup-php@v2.

GH Actions: use PHP Parallel Lint

... for faster linting results.

Ref: https://github.com/php-parallel-lint/PHP-Parallel-Lint/

The results of PHP Parallel Lint can also be used in combination with cs2pr to show any issues in-line in the GH (PR) code view.

GH Actions: cache downloads for Composer

... for faster builds and to be kind to the resources which GH provides freely.

The caching is handled by using a predefined GH action specifically created for this purpose. The alternative would be to handle the caching manually, which would add three extra steps to the script.

Refs:

GH Actions: selectively run tests with code coverage

As it was, the setup-php action would always install with xdebug enabled, making all PHP tasks slower and tests would always be run with code coverage being generated, while the coverage report was only used (uploaded to CodeCov) on PHP 7.4.

This commit changes that to:

GH Actions: run tests against highest/lowest versions of dependencies

Run tests against the highest and lowest versions of the dependencies.

To do so, this commit:

GH Actions: auto-cancel previous builds for same branch

When the same branch is pushed again (and again), builds queues can start piling up.

The configuration now added, will auto-cancel any builds from previous pushes, whether already running or still waiting.

More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free.

Refs:

GH Actions: allow for manually triggering a workflow

Triggering a workflow for a branch manually is not supported by default in GH Actions, but has to be explicitly allowed.

This is useful if, for instance, an external action script or composer dependency has broken. Once a fix is available, failing builds for open PRs can be retriggered manually instead of having to be re-pushed to retrigger the workflow.

Ref: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/