-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH Actions: mixed bag of improvements #113
Merged
Merged
Conversation
This file contains 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
Follow up on 99: also enable assertions, which are turned off by default when using `setup-php@v2`.
... 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](https://github.com/staabm/annotate-pull-request-from-checkstyle) to show any issues in-line in the GH (PR) code view.
... for faster builds and to be kind to the resources which GH provides freely. The caching is handled by using a [predefined GH action](https://github.com/marketplace/actions/install-composer-dependencies) specifically created for this purpose. The alternative would be to handle the caching manually, which would add three extra steps to the script. Refs: * https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows * https://github.com/ramsey/composer-install/
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: * Only enable Xdebug for the PHP 7.4 build. * Only run the tests with code coverage on PHP 7.4.
Run tests against the highest and lowest versions of the dependencies. To do so, this commit: * Expands the matrix to include a new `dependency-versions` key. It also special cases the build against PHP 8.2, as running PHP against `lowest` won't be any use for the time being. * Passes the new `dependency-versions` key to the `composer-install` action to allow composer to install either with `--prefer-lowest` or to install via `composer update` and get the highest available versions of dependencies. Ref: https://github.com/ramsey/composer-install/#dependency-versions * Adds (extra) conditions to the linting and PHPCompat tasks as those only need to be run once per PHP version / once per build, respectively. * Adjusts the conditions for the test runs so that the code coverage is only generated and uploaded for the `PHP 7.4 + highest` build.
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: * https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ * https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
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/
gmazzap
approved these changes
Nov 11, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again.
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.
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 withxdebug
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:
dependency-versions
key.It also special cases the build against PHP 8.2, as running PHP against
lowest
won't be any use for the time being.dependency-versions
key to thecomposer-install
action to allow composer to install either with--prefer-lowest
or to install viacomposer update
and get the highest available versions of dependencies.Ref: https://github.com/ramsey/composer-install/#dependency-versions
PHP 7.4 + highest
build.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/