mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Add 8.0 support on windows
This commit is contained in:
parent
922f1e27b8
commit
c6ad3d1a70
11
.github/workflows/experimental-workflow.yml
vendored
11
.github/workflows/experimental-workflow.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, ubuntu-16.04, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
php-versions: ['8.0']
|
||||
steps:
|
||||
- name: Checkout
|
||||
@ -59,7 +59,7 @@ jobs:
|
||||
run: node dist/index.js
|
||||
env:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, xdebug, pcov #optional
|
||||
extensions: mbstring, opcache, xdebug, pcov #optional
|
||||
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
|
||||
coverage: xdebug
|
||||
|
||||
@ -83,10 +83,13 @@ jobs:
|
||||
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
||||
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
||||
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||
- name: Test and Benchmark JIT
|
||||
- name: Test JIT
|
||||
run: |
|
||||
php -r "if(! extension_loaded('Zend OPcache')) {throw new Exception('Zend OPcache not found');}"
|
||||
php -r "if(ini_get('opcache.jit_buffer_size')!='256M') {throw new Exception('opcache.jit_buffer_size not set');}"
|
||||
php -r "if(ini_get('opcache.jit')!=1235) {throw new Exception('opcache.jit not set');}"
|
||||
php -r "if(ini_get('pcre.jit')!=1) {throw new Exception('pcre.jit not set');}"
|
||||
curl https://raw.githubusercontent.com/php/php-src/master/Zend/bench.php | php
|
||||
- name: Benchmark JIT
|
||||
run: |
|
||||
curl -o bench.php https://raw.githubusercontent.com/php/php-src/master/Zend/bench.php
|
||||
php bench.php
|
40
README.md
40
README.md
@ -25,8 +25,9 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
||||
- [PCOV](#pcov)
|
||||
- [Disable coverage](#disable-coverage)
|
||||
- [Usage](#memo-usage)
|
||||
- [Basic Usage](#basic-usage)
|
||||
- [Matrix Testing](#matrix-testing)
|
||||
- [Basic Setup](#basic-setup)
|
||||
- [Matrix Setup](#matrix-setup)
|
||||
- [Experimental Setup](#experimental-setup)
|
||||
- [Cache dependencies](#cache-dependencies)
|
||||
- [Examples](#examples)
|
||||
- [License](#scroll-license)
|
||||
@ -47,7 +48,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
||||
|7.4|`Stable`|`Active`|
|
||||
|8.0|`Experimental`|`In development`|
|
||||
|
||||
**Note:** Specifying `8.0` in `php-version` input installs `PHP 8.0.0-dev`. This is an experimental feature on this action available on `ubuntu` and `macOS`. Currently some extensions might not be available for this version.
|
||||
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT` support. See [experimental setup](#experimental-setup) for more information.
|
||||
|
||||
## :cloud: OS/Platform Support
|
||||
|
||||
@ -70,7 +71,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
||||
### Xdebug
|
||||
|
||||
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") except `8.0`.
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v1
|
||||
@ -123,9 +124,9 @@ Inputs supported by this GitHub Action.
|
||||
|
||||
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
|
||||
|
||||
### Basic Usage
|
||||
### Basic Setup
|
||||
|
||||
> Setup a particular PHP version
|
||||
> Setup a particular PHP version.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
@ -142,9 +143,9 @@ steps:
|
||||
pecl: false #optional, setup PECL
|
||||
```
|
||||
|
||||
### Matrix Testing
|
||||
### Matrix Setup
|
||||
|
||||
> Setup multiple PHP versions
|
||||
> Setup multiple PHP versions on multiple operating systems.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
@ -169,6 +170,29 @@ jobs:
|
||||
pecl: false #optional, setup PECL
|
||||
```
|
||||
|
||||
### Experimental Setup
|
||||
|
||||
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
|
||||
|
||||
- This version is currently in development and is an experimental feature on this action.
|
||||
- `PECL` is installed by default with this version on `ubuntu`.
|
||||
- Some extensions might not support this version currently.
|
||||
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on this version.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v1
|
||||
with:
|
||||
php-version: '8.0'
|
||||
extensions: mbstring #optional, setup extensions
|
||||
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 #optional, setup php.ini configuration
|
||||
coverage: pcov #optional, setup PCOV, Xdebug does not support this version yet.
|
||||
```
|
||||
|
||||
### Cache dependencies
|
||||
|
||||
You can persist composer's internal cache directory using the [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Action. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -1848,7 +1848,7 @@ function run() {
|
||||
}
|
||||
case 'win32':
|
||||
script_path = yield build('win32.ps1', version, os_version);
|
||||
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version);
|
||||
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -63,7 +63,9 @@ export async function run(): Promise<void> {
|
||||
}
|
||||
case 'win32':
|
||||
script_path = await build('win32.ps1', version, os_version);
|
||||
await exec('pwsh ' + script_path + ' -version ' + version);
|
||||
await exec(
|
||||
'pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname
|
||||
);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
|
@ -1,11 +1,14 @@
|
||||
param (
|
||||
[Parameter(Mandatory = $true)][string]$version = "7.3"
|
||||
[Parameter(Mandatory = $true)][string]$version = "7.4",
|
||||
[Parameter(Mandatory=$true)][string]$dir
|
||||
)
|
||||
|
||||
$tick = ([char]8730)
|
||||
$cross = ([char]10007)
|
||||
$php_dir = 'C:\tools\php'
|
||||
$ext_dir = $php_dir + '\ext'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$master_version = '8.0'
|
||||
|
||||
Function Step-Log($message) {
|
||||
printf "\n\033[90;1m==> \033[0m\033[37;1m%s \033[0m\n" $message
|
||||
@ -16,10 +19,6 @@ Function Add-Log($mark, $subject, $message) {
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message
|
||||
}
|
||||
|
||||
if ($version -eq '8.0') {
|
||||
$version = '7.4'
|
||||
}
|
||||
|
||||
Step-Log "Setup PhpManager"
|
||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||
Add-Log $tick "PhpManager" "Installed"
|
||||
@ -39,6 +38,9 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
||||
Install-Module -Name VcRedist -Force
|
||||
$arch='x86'
|
||||
}
|
||||
if ($version -eq $master_version) {
|
||||
$version = 'master'
|
||||
}
|
||||
|
||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
|
||||
$installed = Get-Php -Path $php_dir
|
||||
@ -49,12 +51,17 @@ else {
|
||||
}
|
||||
|
||||
Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
|
||||
Enable-PhpExtension -Extension openssl, curl -Path $php_dir
|
||||
Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir
|
||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||
Add-Log $tick "PHP" $status
|
||||
|
||||
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
||||
Add-Log $tick "Composer" "Installed"
|
||||
if ($version -eq 'master') {
|
||||
Copy-Item $dir"\..\src\ext\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
|
||||
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
|
||||
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
||||
}
|
||||
|
||||
Function Add-Extension {
|
||||
Param (
|
||||
|
Loading…
Reference in New Issue
Block a user