Update README
This commit is contained in:
parent
ffded4a3e8
commit
e3a501e061
123
README.md
123
README.md
@ -11,6 +11,9 @@
|
|||||||
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/setup-php/branch/master/graph/badge.svg"></a>
|
<a href="https://codecov.io/gh/shivammathur/setup-php" title="Code coverage"><img alt="Codecov Code Coverage" src="https://codecov.io/gh/shivammathur/setup-php/branch/master/graph/badge.svg"></a>
|
||||||
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
<a href="https://github.com/shivammathur/setup-php/blob/master/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
|
||||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.3-8892BF.svg"></a>
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.3-8892BF.svg"></a>
|
||||||
|
</p>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://reddit.com/r/setup_php" title="setup-php reddit"><img alt="setup-php reddit" src="https://img.shields.io/badge/reddit-join-FF5700?logo=reddit"></a>
|
||||||
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter"></a>
|
<a href="https://twitter.com/setup_php" title="setup-php twitter"><img alt="setup-php twitter" src="https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -100,11 +103,12 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
|
|||||||
- On `ubuntu` by default extensions which are available as a package can be installed. PECL extensions if not available as a package can be installed by specifying `pecl` in the tools input.
|
- On `ubuntu` by default extensions which are available as a package can be installed. PECL extensions if not available as a package can be installed by specifying `pecl` in the tools input.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with pecl extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: pecl
|
php-version: '7.4'
|
||||||
extensions: swoole
|
tools: pecl
|
||||||
|
extensions: swoole
|
||||||
```
|
```
|
||||||
|
|
||||||
- On `windows` PECL extensions which have the `DLL` binary can be installed.
|
- On `windows` PECL extensions which have the `DLL` binary can be installed.
|
||||||
@ -116,30 +120,33 @@ with:
|
|||||||
- Specific versions of PECL extensions can be installed by suffixing the version. This is useful for installing old versions of extensions which support end of life PHP versions.
|
- Specific versions of PECL extensions can be installed by suffixing the version. This is useful for installing old versions of extensions which support end of life PHP versions.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with specific version of PECL extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '5.4'
|
with:
|
||||||
tools: pecl
|
php-version: '5.4'
|
||||||
extensions: swoole-1.9.3
|
tools: pecl
|
||||||
|
extensions: swoole-1.9.3
|
||||||
```
|
```
|
||||||
|
|
||||||
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
|
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with pre-release PECL extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: pecl
|
php-version: '7.4'
|
||||||
extensions: xdebug-beta
|
tools: pecl
|
||||||
|
extensions: xdebug-beta
|
||||||
```
|
```
|
||||||
|
|
||||||
- Shared extensions can be removed by prefixing them with a `:`.
|
- Shared extensions can be removed by prefixing them with a `:`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP and remove shared extension
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
extensions: :opcache
|
php-version: '7.4'
|
||||||
|
extensions: :opcache
|
||||||
```
|
```
|
||||||
|
|
||||||
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
|
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
@ -153,33 +160,39 @@ These tools can be setup globally using the `tools` input.
|
|||||||
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with tools
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: php-cs-fixer, phpunit
|
php-version: '7.4'
|
||||||
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
```
|
||||||
|
|
||||||
To setup a particular version of a tool, specify it in the form `tool:version`.
|
To setup a particular version of a tool, specify it in the form `tool:version`.
|
||||||
Latest stable version of `composer` is setup by default. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
|
Latest stable version of `composer` is setup by default. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with composer v2
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: composer:v2
|
php-version: '7.4'
|
||||||
|
tools: composer:v2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
|
||||||
|
|
||||||
Version for other tools should be in `semver` format and a valid release of the tool.
|
Version for other tools should be in `semver` format and a valid release of the tool.
|
||||||
|
This is useful for installing tools for older versions of PHP.
|
||||||
|
For example to setup `PHPUnit` on `PHP 7.2`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with tools
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
|
php-version: '7.2'
|
||||||
|
tools: phpunit:8.5.8
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
**Notes**
|
||||||
- Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
|
|
||||||
- If you have a tool in your `composer.json`, do not setup it globally using this action as the two instances of the tool might conflict.
|
- If you have a tool in your `composer.json`, do not setup it globally using this action as the two instances of the tool might conflict.
|
||||||
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
|
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
@ -191,10 +204,11 @@ Specify `coverage: xdebug` to use `Xdebug`.
|
|||||||
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with Xdebug
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
coverage: xdebug
|
php-version: '7.4'
|
||||||
|
coverage: xdebug
|
||||||
```
|
```
|
||||||
|
|
||||||
### PCOV
|
### PCOV
|
||||||
@ -205,11 +219,23 @@ Tests with `PCOV` run much faster than with `Xdebug`.
|
|||||||
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
|
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with PCOV
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
ini-values: pcov.directory=api #optional, see above for usage.
|
php-version: '7.4'
|
||||||
coverage: pcov
|
ini-values: pcov.directory=api #optional, see above for usage.
|
||||||
|
coverage: pcov
|
||||||
|
```
|
||||||
|
|
||||||
|
`PHPUnit` 8 and above supports `PCOV` out of the box.
|
||||||
|
If you are using `PHPUnit` 5, 6 or 7, you will need `krakjoe/pcov-clobber`.
|
||||||
|
Before executing your tests add the following step.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PCOV
|
||||||
|
run: |
|
||||||
|
composer require pcov/clobber
|
||||||
|
vendor/bin/pcov clobber
|
||||||
```
|
```
|
||||||
|
|
||||||
### Disable Coverage
|
### Disable Coverage
|
||||||
@ -223,10 +249,11 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
- You are profiling your code using `blackfire`.
|
- You are profiling your code using `blackfire`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
- name: Setup PHP with no coverage driver
|
||||||
with:
|
uses: shivammathur/setup-php@v2
|
||||||
php-version: '7.4'
|
with:
|
||||||
coverage: none
|
php-version: '7.4'
|
||||||
|
coverage: none
|
||||||
```
|
```
|
||||||
|
|
||||||
## :memo: Usage
|
## :memo: Usage
|
||||||
@ -326,7 +353,7 @@ steps:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup nightly PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.0'
|
||||||
@ -438,7 +465,7 @@ jobs:
|
|||||||
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP with latest versions
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
@ -453,7 +480,7 @@ jobs:
|
|||||||
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP with logs
|
||||||
uses: shivammathur/setup-php@verbose
|
uses: shivammathur/setup-php@verbose
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user