Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3a501e

Browse files
committed
Update README
1 parent ffded4a commit e3a501e

File tree

1 file changed

+78
-51
lines changed

1 file changed

+78
-51
lines changed

README.md

Lines changed: 78 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
<a href="https://github.com/shivammathur/setup-php" title="GitHub action to setup PHP"><img alt="GitHub Actions status" src="https://github.com/shivammathur/setup-php/workflows/Main%20workflow/badge.svg"></a>
1111
<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>
1212
<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>
13-
<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>
14-
<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>
13+
<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>
14+
</p>
15+
<p align="center">
16+
<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>
17+
<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>
1518
</p>
1619

1720
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
@@ -100,11 +103,12 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
100103
- 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.
101104

102105
```yaml
103-
uses: shivammathur/setup-php@v2
104-
with:
105-
php-version: '7.4'
106-
tools: pecl
107-
extensions: swoole
106+
- name: Setup PHP with pecl extension
107+
uses: shivammathur/setup-php@v2
108+
with:
109+
php-version: '7.4'
110+
tools: pecl
111+
extensions: swoole
108112
```
109113
110114
- On `windows` PECL extensions which have the `DLL` binary can be installed.
@@ -116,30 +120,33 @@ with:
116120
- 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.
117121

118122
```yaml
119-
uses: shivammathur/setup-php@v2
120-
with:
121-
php-version: '5.4'
122-
tools: pecl
123-
extensions: swoole-1.9.3
123+
- name: Setup PHP with specific version of PECL extension
124+
uses: shivammathur/setup-php@v2
125+
with:
126+
php-version: '5.4'
127+
tools: pecl
128+
extensions: swoole-1.9.3
124129
```
125130

126131
- Pre-release versions of PECL extensions can be setup by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot`.
127132

128133
```yaml
129-
uses: shivammathur/setup-php@v2
130-
with:
131-
php-version: '7.4'
132-
tools: pecl
133-
extensions: xdebug-beta
134+
- name: Setup PHP with pre-release PECL extension
135+
uses: shivammathur/setup-php@v2
136+
with:
137+
php-version: '7.4'
138+
tools: pecl
139+
extensions: xdebug-beta
134140
```
135141

136142
- Shared extensions can be removed by prefixing them with a `:`.
137143

138144
```yaml
139-
uses: shivammathur/setup-php@v2
140-
with:
141-
php-version: '7.4'
142-
extensions: :opcache
145+
- name: Setup PHP and remove shared extension
146+
uses: shivammathur/setup-php@v2
147+
with:
148+
php-version: '7.4'
149+
extensions: :opcache
143150
```
144151

145152
- 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.
153160
`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`
154161

155162
```yaml
156-
uses: shivammathur/setup-php@v2
157-
with:
158-
php-version: '7.4'
159-
tools: php-cs-fixer, phpunit
163+
- name: Setup PHP with tools
164+
uses: shivammathur/setup-php@v2
165+
with:
166+
php-version: '7.4'
167+
tools: php-cs-fixer, phpunit
160168
```
161169

162170
To setup a particular version of a tool, specify it in the form `tool:version`.
163171
Latest stable version of `composer` is setup by default. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
164172

165173
```yaml
166-
uses: shivammathur/setup-php@v2
167-
with:
168-
php-version: '7.4'
169-
tools: composer:v2
174+
- name: Setup PHP with composer v2
175+
uses: shivammathur/setup-php@v2
176+
with:
177+
php-version: '7.4'
178+
tools: composer:v2
170179
```
171180

172-
Version for other tools should be in `semver` format and a valid release of the tool.
181+
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.
182+
183+
Version for other tools should be in `semver` format and a valid release of the tool.
184+
This is useful for installing tools for older versions of PHP.
185+
For example to setup `PHPUnit` on `PHP 7.2`.
173186

174187
```yaml
175-
uses: shivammathur/setup-php@v2
176-
with:
177-
php-version: '7.4'
178-
tools: php-cs-fixer:2.16.2, phpunit:8.5.1
188+
- name: Setup PHP with tools
189+
uses: shivammathur/setup-php@v2
190+
with:
191+
php-version: '7.2'
192+
tools: phpunit:8.5.8
179193
```
180194

181195
**Notes**
182-
- Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
183196
- 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.
184197
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
185198

@@ -191,10 +204,11 @@ Specify `coverage: xdebug` to use `Xdebug`.
191204
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
192205

193206
```yaml
194-
uses: shivammathur/setup-php@v2
195-
with:
196-
php-version: '7.4'
197-
coverage: xdebug
207+
- name: Setup PHP with Xdebug
208+
uses: shivammathur/setup-php@v2
209+
with:
210+
php-version: '7.4'
211+
coverage: xdebug
198212
```
199213

200214
### PCOV
@@ -205,11 +219,23 @@ Tests with `PCOV` run much faster than with `Xdebug`.
205219
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
206220

207221
```yaml
208-
uses: shivammathur/setup-php@v2
209-
with:
210-
php-version: '7.4'
211-
ini-values: pcov.directory=api #optional, see above for usage.
212-
coverage: pcov
222+
- name: Setup PHP with PCOV
223+
uses: shivammathur/setup-php@v2
224+
with:
225+
php-version: '7.4'
226+
ini-values: pcov.directory=api #optional, see above for usage.
227+
coverage: pcov
228+
```
229+
230+
`PHPUnit` 8 and above supports `PCOV` out of the box.
231+
If you are using `PHPUnit` 5, 6 or 7, you will need `krakjoe/pcov-clobber`.
232+
Before executing your tests add the following step.
233+
234+
```yaml
235+
- name: Setup PCOV
236+
run: |
237+
composer require pcov/clobber
238+
vendor/bin/pcov clobber
213239
```
214240

215241
### Disable Coverage
@@ -223,10 +249,11 @@ Consider disabling the coverage using this PHP action for these reasons.
223249
- You are profiling your code using `blackfire`.
224250

225251
```yaml
226-
uses: shivammathur/setup-php@v2
227-
with:
228-
php-version: '7.4'
229-
coverage: none
252+
- name: Setup PHP with no coverage driver
253+
uses: shivammathur/setup-php@v2
254+
with:
255+
php-version: '7.4'
256+
coverage: none
230257
```
231258

232259
## :memo: Usage
@@ -326,7 +353,7 @@ steps:
326353
- name: Checkout
327354
uses: actions/checkout@v2
328355
329-
- name: Setup PHP
356+
- name: Setup nightly PHP
330357
uses: shivammathur/setup-php@v2
331358
with:
332359
php-version: '8.0'
@@ -438,7 +465,7 @@ jobs:
438465
- You can specify the `update` environment variable to `true` to force update to the latest release.
439466

440467
```yaml
441-
- name: Setup PHP
468+
- name: Setup PHP with latest versions
442469
uses: shivammathur/setup-php@v2
443470
with:
444471
php-version: '7.4'
@@ -453,7 +480,7 @@ jobs:
453480
To debug any issues, you can use the `verbose` tag instead of `v2`.
454481

455482
```yaml
456-
- name: Setup PHP
483+
- name: Setup PHP with logs
457484
uses: shivammathur/setup-php@verbose
458485
with:
459486
php-version: '7.4'

0 commit comments

Comments
 (0)