You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT`, `Union Types v2` and other [new features](https://wiki.php.net/rfc#php_80"New features implemented in PHP 8"). See [experimental setup](#experimental-setup) for more information.
64
66
@@ -69,9 +71,13 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
69
71
|Windows Server 2019|`windows-latest` or `windows-2019`|
70
72
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
71
73
|Ubuntu 16.04|`ubuntu-16.04`|
72
-
|macOS X Catalina 10.15|`macos-latest` or `macos-10.15`|
74
+
|MacOS X Catalina 10.15|`macos-latest` or `macos-10.15`|
75
+
|Self Hosted|`self-hosted`|
76
+
77
+
**Note:** Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
73
78
74
79
## :heavy_plus_sign: PHP Extension Support
80
+
75
81
- 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.
76
82
77
83
```yaml
@@ -108,15 +114,24 @@ with:
108
114
extensions: xdebug-beta
109
115
```
110
116
111
-
- Extensions which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
117
+
- Non-default extensions can be removed by prefixing it with a `:`.
118
+
119
+
```yaml
120
+
uses: shivammathur/setup-php@v2
121
+
with:
122
+
php-version: '7.4'
123
+
extensions: :opcache
124
+
```
125
+
126
+
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
112
127
113
128
- These extensions have custom support - `gearman` on ubuntu, `blackfire`, `phalcon3` and `phalcon4` on all supported OS.
114
129
115
130
## :wrench: Tools Support
116
131
117
132
These tools can be setup globally using the `tools` input.
- Specifying version for `composer` and `pecl` has no effect, latest versions of both tools which are compatible with the PHP version will be setup.
141
156
- Both agent and client will be setup when `blackfire` is specified.
142
157
- If the version specified for the tool is not in semver format, latest version of the tool will be setup.
143
-
- Tools which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
158
+
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
144
159
145
160
## :signal_strength: Coverage support
146
161
@@ -200,8 +215,9 @@ with:
200
215
201
216
#### `extensions` (optional)
202
217
203
-
- Specify the extensions you want to setup.
204
-
- Accepts a `string` in csv-format. For example `mbstring, zip`.
218
+
- Specify the extensions you want to add or remove.
219
+
- Accepts a `string` in csv-format. For example `mbstring, :opcache`.
220
+
- Non-default extensions prefixed with `:` are removed.
205
221
- See [PHP extension support](#heavy_plus_sign-php-extension-support) for more info.
206
222
207
223
#### `ini-values` (optional)
@@ -294,11 +310,76 @@ steps:
294
310
tools: php-cs-fixer, phpunit
295
311
```
296
312
313
+
### Self Hosted Setup
314
+
315
+
> Setup PHP on a self-hosted runner.
316
+
317
+
- `PHP 5.6`and newer versions are supported on self-hosted runners.
318
+
- `Windows 7`and newer, `Windows Server 2012 R2` and newer, `Ubuntu 18.04`, `Ubuntu 16.04` and `MacOS X Catalina 10.15` are supported.
319
+
- To setup a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to setup in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to setup in a `Windows` container.
320
+
- To setup the runner directly on the host OS or in a VM, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
321
+
322
+
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
> Test your `Ubuntu` workflow locally using [`nektos/act`](https://github.com/nektos/act "Project to test GitHub Actions locally").
347
+
348
+
```yaml
349
+
jobs:
350
+
run:
351
+
runs-on: ubuntu-latest
352
+
name: PHP 7.4 Test
353
+
steps:
354
+
- name: Checkout
355
+
uses: actions/checkout@v2
356
+
357
+
- name: Setup PHP
358
+
uses: shivammathur/setup-php@v2
359
+
with:
360
+
php-version: 7.4
361
+
```
362
+
363
+
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker image.
364
+
365
+
```bash
366
+
# For runs-on: ubuntu-latest
367
+
act -P ubuntu-latest=shivammathur/node:latest
368
+
369
+
# For runs-on: ubuntu-18.04
370
+
act -P ubuntu-18.04=shivammathur/node:latest
371
+
372
+
# For runs-on: ubuntu-16.04
373
+
act -P ubuntu-16.04=shivammathur/node:xenial
374
+
```
375
+
297
376
### Thread Safe Setup
298
377
378
+
> Setup both `TS` and `NTS` PHP on `Windows`.
379
+
299
380
- `NTS`versions are setup by default.
300
-
- On `ubuntu` and `macOS` only `NTS` versions are supported.
301
-
- On `windows` both `TS` and `NTS` versions are supported.
381
+
- On `Ubuntu` and `macOS` only `NTS` versions are supported.
382
+
- On `Windows` both `TS` and `NTS` versions are supported.
302
383
303
384
```yaml
304
385
jobs:
@@ -314,11 +395,13 @@ jobs:
314
395
with:
315
396
php-version: '7.4'
316
397
env:
317
-
PHPTS: ts # specify ts or nts
398
+
phpts: ts # specify ts or nts
318
399
```
319
400
320
401
### Force Update
321
402
403
+
> Update to latest patch of PHP versions.
404
+
322
405
- Pre-installed PHP versions on the GitHub Actions runner are not updated to their latest patch release by default.
323
406
- You can specify the `update` environment variable to `true` to force update to the latest release.
324
407
@@ -333,6 +416,8 @@ jobs:
333
416
334
417
### Verbose Setup
335
418
419
+
> Debug your workflow
420
+
336
421
To debug any issues, you can use the `verbose` tag instead of `v2`.
337
422
338
423
```yaml
@@ -344,7 +429,7 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
344
429
345
430
### Cache Extensions
346
431
347
-
You can cache PHP extensions using [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup if cached are available in the next workflow run and enabled directly which reduces the workflow execution time.
432
+
You can cache PHP extensions using [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
348
433
349
434
```yaml
350
435
runs-on: ${{ matrix.operating-system }}
@@ -382,7 +467,7 @@ steps:
382
467
extensions: ${{ env.extensions }}
383
468
```
384
469
385
-
**Note:** If you setup both `TS` and `NTS` PHP versions on `windows`, add `${{ env.PHPTS }}` to `key` and `restore-keys` inputs in `actions/cache` step.
470
+
**Note:** If you setup both `TS` and `NTS` PHP versions on `windows`, add `${{ env.phpts }}` to `key` and `restore-keys` inputs in `actions/cache` step.
0 commit comments