34 Commits

Author SHA1 Message Date
Dan Wallis
d148febc2a Reduce width of table in issue template 2023-05-26 23:32:02 +01:00
jrfnl
70476e52ee Bug report template: various tweaks
* Improve readability of reports by using headers.
* Improve readability of the versions list by using a table.
* Explicitly say that screenshots of code are not acceptable as a code sample.
* Added an "Install type" entry to the versions list
* Added an extra checklist for bug reporters in an attempt to reduce the number of issues which should never have been opened in the first place.
2023-05-23 23:52:42 +02:00
jrfnl
dd8ede12a5 GH Actions: automate some label management
This is a quite straight-forward workflow to just remove some labels which should only be on open issues/open PRs and which should be removed once an issue or PR has been closed/merged.

Just attempting to reduce yet some more manual labour.
2023-05-18 09:32:57 +02:00
jrfnl
b206485fa1 Bug template: fix yaml syntax 2023-05-18 09:02:41 +02:00
Greg Sherwood
ae84ad27c1 Merge branch 'feature/bug-report-template-tweaks' 2023-05-18 16:54:27 +10:00
jrfnl
70fb023393 Bug report template: add notice about external standards
... in hopes of reducing the number of issues which are incorrectly reported to this repo.

Includes automating the assignment of initial issue labels.
2023-05-16 18:46:33 +02:00
jrfnl
d439d9870c Add a pull request template
This pull requests template has been set up to attempt to gather all information needed by the maintainers to evaluate the PR.

It also is intended to act as a reminder for contributors to make sure the PR is complete and ready for review.
2023-05-16 18:45:59 +02:00
jrfnl
c9829af5a0 GH Actions: bust the cache semi-regularly
Caches used in GH Actions do not get updated, they can only be replaced by a different cache with a different cache key.

Now the predefined Composer install action this repo is using already creates a pretty comprehensive cache key:

> `ramsey/composer-install` will auto-generate a cache key which is composed of
the following elements:
> * The OS image name, like `ubuntu-latest`.
> * The exact PHP version, like `8.1.11`.
> * The options passed via `composer-options`.
> * The dependency version setting as per `dependency-versions`.
> * The working directory as per `working-directory`.
> * A hash of the `composer.json` and/or `composer.lock` files.

This means that aside from other factors, the cache will always be busted when changes are made to the (committed) `composer.json` or the `composer.lock` file (if the latter exists in the repo).

For packages running on recent versions of PHP, it also means that the cache will automatically be busted once a month when a new PHP version comes out.

### The problem

For runs on older PHP versions which don't receive updates anymore, the cache will not be busted via new PHP version releases, so effectively, the cache will only be busted when a change is made to the `composer.json`/`composer.lock` file - which may not happen that frequently on low-traffic repos.

But... packages _in use_ on those older PHP versions - especially dependencies of declared dependencies - may still release new versions and those new versions will not exist in the cache and will need to be downloaded each time the action is run and over time the cache gets less and less relevant as more and more packages will need to be downloaded for each run.

### The solution

To combat this issue, a new `custom-cache-suffix` option has been added to the Composer install action in version 2.2.0.
This new option allows for providing some extra information to add to the cache key, which allows for busting the cache based on your own additional criteria.

This commit implements the use of this `custom-cache-suffix` option for all relevant workflows in this repo.

Refs:
* https://github.com/ramsey/composer-install/#custom-cache-suffix
* https://github.com/ramsey/composer-install/releases/tag/2.2.0
2023-03-03 20:47:17 +01:00
jrfnl
e0f53ea940 GH Actions: fix use of deprecated set-output
GitHub has deprecated the use of `set-output` (and `set-state`) in favour of new environment files.

This commit updates workflows to use the new methodology.

Refs:
* https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
2022-10-14 19:55:38 +02:00
Greg Sherwood
f88fcbc9b2 Merge branch 'feature/ghactions-update-composer-action' of https://github.com/jrfnl/PHP_CodeSniffer 2022-05-23 11:24:33 +10:00
Greg Sherwood
ed9082c6fd Merge branch 'feature/ghactions-update-various-actions' of https://github.com/jrfnl/PHP_CodeSniffer 2022-04-01 09:19:50 +11:00
jrfnl
8925809a80 GH Actions/CS: fix build failure
Fix failing installation of the xmllint tooling.
2022-03-19 08:02:08 +01:00
jrfnl
37a1a98cf0 GH Actions: version update for various predefined actions
A number of predefined actions have had major release, which warrant an update the workflow(s).

These updates don't actually contain any changed functionality, they are mostly just a change of the Node version used by the action itself (from Node 14 to Node 16).

Refs:
* https://github.com/actions/checkout/releases
* https://github.com/actions/download-artifact/releases
* https://github.com/actions/upload-artifact/releases
2022-03-05 18:44:00 +01:00
jrfnl
afeaefa510 GH Actions: version update for ramsey/composer-install
The action used to install Composer packages and handle the caching has released a new major (and some follow-up patch releases), which means, the action reference needs to be updated to benefit from it.

Refs:
* https://github.com/ramsey/composer-install/releases/tag/2.0.0
* https://github.com/ramsey/composer-install/releases/tag/2.0.1
* https://github.com/ramsey/composer-install/releases/tag/2.0.2
2021-12-25 18:59:36 +01:00
jrfnl
46d8d16417 GH Actions: change the building of the (release) PHARs to PHP 8.0
The PHP native `php_strip_whitespace()` function used in the PHAR build script is PHP version sensitive.

The function strips comments and whitespace out of the code, but in PHP 7.4, attributes are seen as comments due to the `#[]` syntax, which means that if the PHAR files were being generated on PHP 7.4, the PHP 8.1 #[ReturnTypeWillChange]` attributes as put in via PR 3400 would be stripped out.

In other words: for the PHAR files to be cross-version compatible, they *MUST* be generated on PHP 8.0 or higher.

This fixes this for the CI part of things.

Ref: https://www.php.net/manual/en/function.php-strip-whitespace.php
2021-12-17 06:34:48 +01:00
jrfnl
7d4514d350 GH Actions: split PHAR build test from other tests
As things were in the CI script, the `phpcs` and `phpcbf` Phars would be build against each supported PHP version and the tests run with the `phpcs` Phar would use the Phar as build on the same PHP version as the test was being run on.

This test was not representative of the reality as with each release, only one `phpcs` and one `phpcbf` phar is released.

The changes in this commit:
* Split the building of the Phar off from the main test script.
* This new `build` job:
    - Tests building the Phar against all supported PHP versions as an early detection system for problems in the Phar extension/Phar building script.
    - Uploads both phars as build against PHP 7.4.
        The uploaded Phars match the Phars as would be included on a release as they are build against the same PHP version as used for releases.
        These Phars will now also be available for PRs and merges to `master` to allow for easier testing of change proposals by issue reporters who may not have a git clone of the repo.
        The uploaded Phars will be available for 28 days (default 90).
    - Does a cursory test with both the `phpcs.phar` as well as the `phpcbf.phar` to test that the build phar files are functional.
* In the `test` job, which now depends on the `build` job, the Phar will now no longer be build, but the Phar as uploaded in the `build` job - i.e. the Phar build against the same PHP version as used when releasing Phars - is downloaded and used to run the Phar test.

The uploaded Phar files can be found on the "Summary" page of the `test` workflow after the build has finished for each build run.
2021-12-17 06:34:48 +01:00
jrfnl
1fdb1e6411 GH Actions: PHP 8.1 has been released
PHP 8.1 has been released, so build against it should no longer be allowed to fail.

Also adding PHP 8.2 as the new "nightly" build (which is allowed to fail).
2021-11-27 16:11:21 +01:00
jrfnl
1a2d19fb0c GH Actions: minor tweaks to the conditions
The `matrix.php` setting is a text string, so let's compare against it as a text string.
2021-09-05 03:12:35 +02:00
jrfnl
d5934ef400 GH Actions: stablelize the error_reporting
What is included in `E_ALL` can vary across PHP versions. Setting `error_reporting` to `-1` will ensure ALL errors are always shown, no matter what.
2021-09-05 03:11:46 +02:00
jrfnl
94abd09e25 GH Actions: minor matrix simplification
We can remove the `experimental` key in favour of checking against the PHP version in `continue-on-error`.
2021-09-05 03:09:50 +02:00
jrfnl
357ed0110d GH Actions: set error reporting to E_ALL
Turns out the default setting for `error_reporting` used by the SetupPHP action is `error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT` and `display_errors` is set to `Off`.

For the purposes of CI, I'd recommend running with `E_ALL` and `display_errors=On` to ensure **all** PHP notices are shown.

Includes minor fix to the documentation of that part of the script.
2021-06-21 22:04:54 +02:00
jrfnl
5ee08ea5b6 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/
2021-02-28 07:08:35 +01:00
jrfnl
a7b2b955cb GH Actions: report CS violations in the PR
The cs2pr tool will allow to display the results from an action run in checkstyle format in-line in the PR code view, which should improve usability of the workflow results.

As the CS run is run in every test run in the matrix, passing the results on to CS2PR would result in violations being displayed multiple times, so using conditions to only pass the CS violations on to the PR for one of the runs.

Ref: https://github.com/staabm/annotate-pull-request-from-checkstyle
2021-02-28 06:24:34 +01:00
jrfnl
cc678d16fc GH Actions: improve fix to run the tests on PHP 8.1
There is no need to remove the config file and have all settings on the command-line as PHPUnit offers a `--no-configuration` option to ignore the config file.

Enabling that simplifies the action steps a little and isolates the customization for PHP 8.1 to PHP 8.1.
2021-02-28 06:06:57 +01:00
jrfnl
6dc06c014d GH Actions: fix faulty condition 2021-02-28 04:50:11 +01:00
jrfnl
07ec92c861 GH Actions: simplify the PHPStan workflow
* No need to install via Composer, the `setup-php` action can make PHPStan globally available.
2021-02-28 04:46:10 +01:00
Greg Sherwood
2da6904087 Useless tests were not reported for before PHPUnit 6, so it doesn't understand the CLI argument 2021-02-01 17:06:08 +11:00
Greg Sherwood
9f6385eb32 No need to report useless tests 2021-02-01 16:56:29 +11:00
Greg Sherwood
500d1dbafc Remove the PHPUnit config file during testing
Running PHPUnit 7 under PHP 8.1 causes an error when reading config files due to the assignment of  by reference. By removing the config file and specifying the settings on the command line, this bit of code is skipped. The additional config options in the config file have also been removed as they didn't seem to be necessary, but this needs to be validated in the pipeline first.
2021-02-01 16:49:59 +11:00
jrfnl
2b20b5690a CI: switch to GitHub Actions - step 4: tests
This commit:
*  Adds a GH Actions workflow for the CI checks which were previously run on Travis as the default test script.
    Includes only running the base tests for the builds using custom ini setting.
* Removes the, now redundant,  `.travis.yml` configuration.
* Remove the custom PHP ini configurations.
    Setting these is now handled in the script itself.
* Updates the `.gitattributes` file.
* Updates the  "Build Status" badge in the Readme to use the results from the GH `Test`  Actions runs.
2020-12-20 10:51:29 +01:00
jrfnl
0792441471 CI: switch to GitHub Actions - step 3: move the PEAR package validation
The PEAR native package validation script used to be run on every PHP build, but the results should be no different on any particular PHP version.

To that end, move the running of the script from the "test" cycles, to the one-time only run PEAR specific job.
2020-12-20 10:51:29 +01:00
jrfnl
7eda8140c9 CI: switch to GitHub Actions - step 2: XML and PEAR validation
This commit:
* Adds a GH  Actions workflow for the build which validated the XML file against schema and checked their code style consistency, as well as validate the PEAR package file, as was previously run on Travis.
*  Removes that part of the `.travis.yml` configuration.

Notes:
Builds will run on all pushes and on pull requests, with the exception  of those just modifying files which are irrelevant to this workflow.
2020-12-20 10:51:29 +01:00
jrfnl
63fd430159 CI: switch to GitHub Actions - step 1: phpstan
This commit:
* Adds a GH  Actions workflow for the PHPStan check which was previously run on Travis.
*  Removes that part of the `.travis.yml` configuration.

Notes:
Builds will run on all pushes and on pull requests, with the exception  of those just modifying files which are irrelevant to this workflow.
2020-12-20 10:51:28 +01:00
Greg Sherwood
e3eecbb8b0 Added bug report template 2020-07-21 09:06:10 +10:00