|
1 |
| -# phpstan |
2 |
| -PHP Static Analysis in Github Actions |
| 1 | +<img src="http://159.65.210.101/php-actions.png" align="right" alt="PHP Static Analysis in Github Actions" /> |
| 2 | + |
| 3 | + PHP Static Analysis in Github Actions. |
| 4 | + ====================================== |
| 5 | + |
| 6 | +PHPStan finds bugs in your code without writing tests by using runnin static analysis on your project's code. |
| 7 | + |
| 8 | +Usage |
| 9 | +----- |
| 10 | + |
| 11 | +Create your Github Workflow configuration in `.github/workflows/ci.yml` or similar. |
| 12 | + |
| 13 | +```yaml |
| 14 | +name: CI |
| 15 | + |
| 16 | +on: [push] |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-test: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - uses: php-actions/composer@v2 # or alternative dependency management |
| 25 | + - uses: php-actions/phpstan@v1 |
| 26 | + # ... then your own project steps ... |
| 27 | +``` |
| 28 | + |
| 29 | +Commands |
| 30 | +-------- |
| 31 | + |
| 32 | +By default, adding - uses: php-actions/phpstan@v1 into your workflow will run `phpstan analyse`, as `analyse` is the default command name. |
| 33 | + |
| 34 | +You can issue custom commands by passing a command input, like so: |
| 35 | + |
| 36 | +```yaml |
| 37 | +jobs: |
| 38 | + phpstan: |
| 39 | + |
| 40 | + ... |
| 41 | + |
| 42 | + - name: PHPStan |
| 43 | + uses: php-actions/phpstan@v1 |
| 44 | + with: |
| 45 | + command: your-command-here |
| 46 | +``` |
| 47 | +
|
| 48 | +Inputs |
| 49 | +------ |
| 50 | +
|
| 51 | +The following configuration options are available: |
| 52 | +
|
| 53 | ++ `configuration` Path to the project configuration file |
| 54 | ++ `level` Level of rule options - the higher the stricter |
| 55 | ++ `paths_file` Path to a file with a list of paths to run analysis on |
| 56 | ++ `autoload_file` Project's additional autoload file path |
| 57 | ++ `error_format` Format in which to print the result of the analysis |
| 58 | ++ `generate_baseline` Path to a file where the baseline should be saved |
| 59 | ++ `memory_limit` Memory limit for analysis |
| 60 | + |
| 61 | +The syntax for passing in a custom input is the following: |
| 62 | + |
| 63 | +```yaml |
| 64 | +... |
| 65 | +
|
| 66 | +jobs: |
| 67 | + phpstan: |
| 68 | +
|
| 69 | + ... |
| 70 | +
|
| 71 | + - name: PHPStan Static Analysis |
| 72 | + uses: php-actions/phpstan@v1 |
| 73 | + with: |
| 74 | + configuration: custom/path/to/phpstan.neon |
| 75 | + memory_limit: 256M |
| 76 | +``` |
| 77 | + |
| 78 | +If you require other configurations of phpstan, please request them in the [Github issue tracker](https://github.com/php-actions/phpstan/issues) |
| 79 | + |
| 80 | +If you found this repository helpful, please consider [sponsoring the developer][sponsor]. |
| 81 | + |
| 82 | +[sponsor]: https://github.com/sponsors/g105b |
0 commit comments