# Qual: disable PHPCS action (now performed by pre-commit)
The php-cs analysis is now ensured by pre-commit which does analysis
on changed files in PR's and full analysis in the main branches.
It also provides better reports (PHPCS did not report all the issues
seen in travis).
This change to the workflow will run phpcs on all files in develop,
17.0, 18.0, ... (rule== branch ends in .0).
This ensures that phpcs is run in a github workflow for fast phpcs
issue detection in the develop and other main branches.
Ultimately, this means that the PHPCS action can be disabled
in branches where it is active. But I propose to verify that
the updated action does the job as expected (tested in a fork
it is ok).
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This change to the workflow will run phpcs on all files in develop,
17.0, 18.0, ... (rule== branch ends in .0).
This ensures that phpcs is run in a github workflow for fast phpcs
issue detection in the develop and other main branches.
Ultimately, this means that the PHPCS action can be disabled
in branches where it is active. But I propose to verify that
the updated action does the job as expected (tested in a fork
it is ok).
Backport the pre-commit tool to bring extra checks to the older versions
so that they are fixed earlier before merging in upper versions.
Other PRs will be created for backporting to 18.0 and 19.0.
The PRs should be accepted in reverse order:
- develop;
- 19.0:
- 18.0;
- 17.0.
That should avoid merge conflicts and ensure that options (and ignored
messages or steps) are adapted to the version branch.
* Qual: Backport pre-commit to 17.0
Backport the pre-commit tool to bring extra checks to the older versions
so that they are fixed earlier before merging in upper versions.
Other PRs will be created for backporting to 18.0 and 19.0.
The PRs should be accepted in reverse order:
- develop;
- 19.0:
- 18.0;
- 17.0.
That should avoid merge conflicts and ensure that options (and ignored
messages or steps) are adapted to the version branch.
* Qual: Backport pre-commit to 18.0
# Qual: Backport pre-commit to 18.0
Backport the pre-commit tool to bring extra checks to the older versions
so that they are fixed earlier before merging in upper versions.
Other PRs will be created for backporting to 18.0 and 19.0.
The PRs should be accepted in reverse order:
- develop;
- 19.0:
- 18.0;
- 17.0.
That should avoid merge conflicts and ensure that options (and ignored
messages or steps) are adapted to the version branch.
* Qual: Backport pre-commit to 19.0
# Qual: Backport pre-commit to 19.0
Backport the pre-commit tool to bring extra checks to the older versions
so that they are fixed earlier before merging in upper versions.
Other PRs will be created for backporting to 18.0 and 19.0.
The PRs should be accepted in reverse order:
- develop;
- 19.0:
- 18.0;
- 17.0.
That should avoid merge conflicts and ensure that options (and ignored
messages or steps) are adapted to the version branch.
# Qual: Optimize/explain workflows
phpstan checkout took about 1.5 minutes, while pre-commit only takes 10s.
So I removed the option to the checkout option which likely makes
the difference.
I removed the IMHO useless step of installing node - it may have been
useful during setting up the workflow, but not now.
I commented on the pre-commit workflow.
The PHPStan steps run a long time for the latest runs and I suspect that
this may be because of a bad cache, possibly includeing:
```
Result cache was not saved because of non-ignorable exception: Syntax error, unexpected } on line 378
``` .
This change should only save the cache if the run was successful or if no cache
was loaded. The possibly preserves a cache that still reduces the run time.
For instance, the following got an empty cache, saved at 2024-01-19T21:28:22.18Z.
- https://github.com/Dolibarr/dolibarr/actions/runs/7589384926
That was an aborted run:
- https://github.com/Dolibarr/dolibarr/actions/runs/7589372703/job/20673878193
So I added `cancelled()` to avoid overwriting valid cache and phpstan cache
will only be written if the outcome was success or if the cache could not
be loaded before.
I also updated the version for the cache action.
# Qual: Fix line endings of yaml files for yamllint.
yamllint (included in the pre-commit setup) has some messages about the line-endings of yml files.
This fixes that.
# Qual: Fix trailing whitespace in yaml file.
Yaml check tools complain about trailing whitespace, so I fix them.
pre-commit (#27392) has rules to fix them automatically (locally).