mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve problem matchers section in README
This commit is contained in:
parent
84b222366a
commit
7dcb43c768
48
README.md
48
README.md
@ -564,9 +564,11 @@ If you have a number of workflows which setup multiple tools or have many compos
|
||||
|
||||
### Problem Matchers
|
||||
|
||||
Problem matchers are `json` configurations which identify errors and warnings in your logs and surface that information prominently in the GitHub Actions UI by highlighting them and creating code annotations.
|
||||
|
||||
#### PHP
|
||||
|
||||
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step. This will scan the logs for PHP errors and warnings, and surface them prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
||||
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step.
|
||||
|
||||
```yaml
|
||||
- name: Setup problem matchers for PHP
|
||||
@ -575,19 +577,16 @@ Setup problem matchers for your `PHP` output by adding this step after the `setu
|
||||
|
||||
#### PHPUnit
|
||||
|
||||
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
||||
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step.
|
||||
|
||||
```yaml
|
||||
- name: Setup problem matchers for PHPUnit
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
```
|
||||
|
||||
#### Other Tools
|
||||
#### PHPStan
|
||||
|
||||
For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
|
||||
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
||||
|
||||
> Here is an example with `phpstan`.
|
||||
PHPStan supports error reporting in GitHub Actions, so no problem matchers are required.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP
|
||||
@ -596,10 +595,43 @@ For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-p
|
||||
php-version: '7.4'
|
||||
tools: phpstan
|
||||
|
||||
- name: PHPStan
|
||||
- name: Run PHPStan
|
||||
run: phpstan analyse src
|
||||
```
|
||||
|
||||
#### Psalm
|
||||
|
||||
Psalm supports error reporting in GitHub Actions with an output format `github`.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: psalm
|
||||
|
||||
- name: Run Psalm
|
||||
run: psalm --output-format=github
|
||||
```
|
||||
|
||||
#### Tools with checkstyle support
|
||||
|
||||
For tools that support `checkstyle` reporting like `phpstan`, `psalm`, `php-cs-fixer` and `phpcs` you can use `cs2pr` to annotate your code.
|
||||
For examples refer to [cs2pr documentation](https://github.com/staabm/annotate-pull-request-from-checkstyle).
|
||||
|
||||
> Here is an example with `phpcs`.
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: cs2pr, phpcs
|
||||
|
||||
- name: Run phpcs
|
||||
run: phpcs -q --report=checkstyle src | cs2pr
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
Examples of using `setup-php` with various PHP Frameworks and Packages.
|
||||
|
Loading…
Reference in New Issue
Block a user