Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d14c0d0dd7 |
@@ -1,8 +1,8 @@
|
|||||||
name: Docs workflow
|
name: Docs workflow
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
repository_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 15 * * 2'
|
- cron: '0 0 * * 2'
|
||||||
jobs:
|
jobs:
|
||||||
create:
|
create:
|
||||||
name: Create
|
name: Create
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
version: ${{ matrix.php-versions }}
|
version: ${{ matrix.php-versions }}
|
||||||
if: matrix.operating-system == 'windows-2019'
|
if: matrix.operating-system == 'windows-2019'
|
||||||
run: |
|
run: |
|
||||||
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
|
Write-Output "## PHP $version`n" | Out-File -FilePath "$env:file"
|
||||||
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
||||||
php -m | Out-File -FilePath "$env:file" -Append
|
php -m | Out-File -FilePath "$env:file" -Append
|
||||||
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
||||||
@@ -60,9 +60,9 @@ jobs:
|
|||||||
git config --local user.email "${{ secrets.email }}"
|
git config --local user.email "${{ secrets.email }}"
|
||||||
git config --local user.name "${{ github.repository_owner }}"
|
git config --local user.name "${{ github.repository_owner }}"
|
||||||
for os in ubuntu-20.04 ubuntu-18.04 ubuntu-16.04 windows-2019 macos-10.15 macos-11.0; do
|
for os in ubuntu-20.04 ubuntu-18.04 ubuntu-16.04 windows-2019 macos-10.15 macos-11.0; do
|
||||||
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
echo "# PHP Extensions on $os" > Php-extensions-on-"$os".md
|
||||||
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1; do
|
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1; do
|
||||||
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
cat lists/php"$version"-"$os".md >> Php-extensions-on-"$os".md
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm -rf ./lists
|
rm -rf ./lists
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node.js 14.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
|
- [PHP Support](#tada-php-support)
|
||||||
- [OS/Platform Support](#cloud-osplatform-support)
|
- [OS/Platform Support](#cloud-osplatform-support)
|
||||||
- [GitHub-Hosted Runners](#github-hosted-runners)
|
- [GitHub-Hosted Runners](#github-hosted-runners)
|
||||||
- [Self-Hosted Runners](#self-hosted-runners)
|
- [Self-Hosted Runners](#self-hosted-runners)
|
||||||
- [PHP Support](#tada-php-support)
|
|
||||||
- [PHP Extension Support](#heavy_plus_sign-php-extension-support)
|
- [PHP Extension Support](#heavy_plus_sign-php-extension-support)
|
||||||
- [Tools Support](#wrench-tools-support)
|
- [Tools Support](#wrench-tools-support)
|
||||||
- [Coverage Support](#signal_strength-coverage-support)
|
- [Coverage Support](#signal_strength-coverage-support)
|
||||||
@@ -36,15 +36,14 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [Inputs](#inputs)
|
- [Inputs](#inputs)
|
||||||
- [Flags](#flags)
|
- [Flags](#flags)
|
||||||
- [Basic Setup](#basic-setup)
|
- [Basic Setup](#basic-setup)
|
||||||
- [Matrix Setup](#matrix-setup)
|
- [Matrix Setup](#matrix-setup)
|
||||||
- [Nightly Build Setup](#nightly-build-setup)
|
|
||||||
- [Thread Safe Setup](#thread-safe-setup)
|
|
||||||
- [Force Update Setup](#force-update-setup)
|
|
||||||
- [Verbose Setup](#verbose-setup)
|
|
||||||
- [Multi-Arch Setup](#multi-arch-setup)
|
- [Multi-Arch Setup](#multi-arch-setup)
|
||||||
|
- [Nightly Build Setup](#nightly-build-setup)
|
||||||
- [Self Hosted Setup](#self-hosted-setup)
|
- [Self Hosted Setup](#self-hosted-setup)
|
||||||
- [Local Testing Setup](#local-testing-setup)
|
- [Local Testing Setup](#local-testing-setup)
|
||||||
- [JIT Configuration](#jit-configuration)
|
- [Thread Safe Setup](#thread-safe-setup)
|
||||||
|
- [Force Update](#force-update)
|
||||||
|
- [Verbose Setup](#verbose-setup)
|
||||||
- [Cache Extensions](#cache-extensions)
|
- [Cache Extensions](#cache-extensions)
|
||||||
- [Cache Composer Dependencies](#cache-composer-dependencies)
|
- [Cache Composer Dependencies](#cache-composer-dependencies)
|
||||||
- [Cache Node.js Dependencies](#cache-nodejs-dependencies)
|
- [Cache Node.js Dependencies](#cache-nodejs-dependencies)
|
||||||
@@ -58,20 +57,39 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [Dependencies](#package-dependencies)
|
- [Dependencies](#package-dependencies)
|
||||||
- [Further Reading](#bookmark_tabs-further-reading)
|
- [Further Reading](#bookmark_tabs-further-reading)
|
||||||
|
|
||||||
|
## :tada: PHP Support
|
||||||
|
|
||||||
|
|PHP Version|Stability|Release Support|Runner Support|
|
||||||
|
|--- |--- |--- |--- |
|
||||||
|
|`5.3`|`Stable`|`End of life`|`GitHub-hosted`|
|
||||||
|
|`5.4`|`Stable`|`End of life`|`GitHub-hosted`|
|
||||||
|
|`5.5`|`Stable`|`End of life`|`GitHub-hosted`|
|
||||||
|
|`5.6`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`7.2`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`7.3`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`7.4`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`8.0`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|`8.1`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
|
||||||
|
|
||||||
|
**Note:** Specifying `8.0` and `8.1` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` and `PHP 8.1.0-dev` respectively. See [nightly build setup](#nightly-build-setup) for more information.
|
||||||
|
|
||||||
|
|
||||||
## :cloud: OS/Platform Support
|
## :cloud: OS/Platform Support
|
||||||
|
|
||||||
Both `GitHub-hosted` and `self-hosted` runners are suppported by `setup-php` on the following OS/Platforms.
|
The action supports both `GitHub-hosted` runners and `self-hosted` runners on the following operating systems.
|
||||||
|
|
||||||
### GitHub-Hosted Runners
|
### GitHub-Hosted Runners
|
||||||
|
|
||||||
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
|Virtual environment|YAML workflow label|Pre-installed PHP|
|
||||||
|--- |--- |--- |
|
|--- |--- |--- |
|
||||||
|Ubuntu 16.04|`ubuntu-16.04`|`PHP 5.6` to `PHP 8.0`|
|
|Ubuntu 16.04|`ubuntu-16.04`|`PHP 5.6` to `PHP 7.4`|
|
||||||
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|`PHP 7.1` to `PHP 7.4`|
|
||||||
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
|
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4`|
|
||||||
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 7.4`|
|
||||||
|macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 8.0`|
|
|macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 7.4`|
|
||||||
|macOS Big Sur 11.0|`macos-11.0`|`PHP 8.0`|
|
|macOS Big Sur 11.0|`macos-11.0`|`PHP 7.4`|
|
||||||
|
|
||||||
### Self-Hosted Runners
|
### Self-Hosted Runners
|
||||||
|
|
||||||
@@ -83,73 +101,50 @@ Both `GitHub-hosted` and `self-hosted` runners are suppported by `setup-php` on
|
|||||||
|Windows 7 and newer|`self-hosted` or `Windows`|
|
|Windows 7 and newer|`self-hosted` or `Windows`|
|
||||||
|Windows Server 2012 R2 and newer|`self-hosted` or `Windows`|
|
|Windows Server 2012 R2 and newer|`self-hosted` or `Windows`|
|
||||||
|macOS Catalina 10.15|`self-hosted` or `macOS`|
|
|macOS Catalina 10.15|`self-hosted` or `macOS`|
|
||||||
|macOS Big Sur 11.x x86_64/arm64|`self-hosted` or `macOS`|
|
|macOS Big Sur 11.0|`self-hosted` or `macOS`|
|
||||||
|
|
||||||
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
|
- Refer to the [self-hosted setup](#self-hosted-setup) to use the action on self-hosted runners.
|
||||||
- If the requested PHP version is pre-installed, `setup-php` switches to it, otherwise it installs the PHP version.
|
|
||||||
|
|
||||||
## :tada: PHP Support
|
|
||||||
|
|
||||||
On all supported OS/Platforms the following PHP versions are supported as per the runner.
|
|
||||||
|
|
||||||
- PHP 5.3 to PHP 8.1 on GitHub-hosted runners.
|
|
||||||
- PHP 5.6 to PHP 8.1 on self-hosted runners.
|
|
||||||
|
|
||||||
|PHP Version|Stability|Release Support|Runner Support|
|
|
||||||
|--- |--- |--- |--- |
|
|
||||||
|`5.3`|`Stable`|`End of life`|`GitHub-hosted`|
|
|
||||||
|`5.4`|`Stable`|`End of life`|`GitHub-hosted`|
|
|
||||||
|`5.5`|`Stable`|`End of life`|`GitHub-hosted`|
|
|
||||||
|`5.6`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`7.0`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`7.1`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`7.2`|`Stable`|`End of life`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`7.3`|`Stable`|`Security fixes only`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`7.4`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`8.0`|`Stable`|`Active`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|`8.1`|`Nightly`|`In development`|`GitHub-hosted`, `self-hosted`|
|
|
||||||
|
|
||||||
**Notes:**
|
|
||||||
- Specifying `8.1` in `php-version` input installs a nightly build of `PHP 8.1.0-dev`. See [nightly build setup](#nightly-build-setup) for more information.
|
|
||||||
- To use JIT on `PHP 8.0` and `PHP 8.1` refer to the [JIT configuration](#jit-configuration) section.
|
|
||||||
|
|
||||||
## :heavy_plus_sign: PHP Extension Support
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
|
|
||||||
PHP extensions can be setup using the `extensions` input. It accepts a `string` in csv-format.
|
- Extensions enabled by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
|
||||||
|
|
||||||
- On `Ubuntu`, extensions which are available as a package or available on `PECL` can be setup.
|
- 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
|
||||||
- name: Setup PHP with PECL extension
|
- name: Setup PHP with pecl extension
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
extensions: imagick, swoole
|
tools: pecl
|
||||||
|
extensions: swoole
|
||||||
```
|
```
|
||||||
|
|
||||||
- On `Windows`, extensions available on `PECL` which have the `DLL` binary can be setup.
|
- On `windows` PECL extensions which have the `DLL` binary can be installed.
|
||||||
|
|
||||||
- On `macOS`, extensions available on `PECL` can be installed.
|
- On `macOS` PECL extensions can be installed.
|
||||||
|
|
||||||
- Extensions installed along with PHP if specified are enabled.
|
- Extensions installed along with PHP if specified are enabled.
|
||||||
|
|
||||||
- Specific versions of extensions available on `PECL` can be setup by suffixing the extension's name with 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
|
||||||
- name: Setup PHP with specific version of PECL extension
|
- name: Setup PHP with specific version of PECL extension
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '5.4'
|
php-version: '5.4'
|
||||||
|
tools: pecl
|
||||||
extensions: swoole-1.9.3
|
extensions: swoole-1.9.3
|
||||||
```
|
```
|
||||||
|
|
||||||
- Pre-release versions extensions available on `PECL` can be setup by suffixing the extension's name 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
|
||||||
- name: Setup PHP with pre-release PECL extension
|
- name: Setup PHP with pre-release PECL extension
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
|
tools: pecl
|
||||||
extensions: xdebug-beta
|
extensions: xdebug-beta
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -163,22 +158,17 @@ PHP extensions can be setup using the `extensions` input. It accepts a `string`
|
|||||||
extensions: :opcache
|
extensions: :opcache
|
||||||
```
|
```
|
||||||
|
|
||||||
- Extension `intl` can be setup with specific `ICU` version for `PHP 5.6` to `PHP 8.0` in `Ubuntu` workflows by suffixing `intl` with the `ICU` version. `ICU 50.2` and newer versions are supported. Refer to [`ICU builds`](https://github.com/shivammathur/icu-intl#icu4c-builds) for the specific versions supported.
|
- Extension `intl` can be setup with specific `ICU` version for `PHP 5.6` to `PHP 7.4` in `Ubuntu` workflows by suffixing `intl` with the `ICU` version. `ICU 50.2` and newer versions are supported. Refer to [`ICU builds`](https://github.com/shivammathur/icu-intl#icu4c-builds) for the specific versions supported.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with intl
|
- name: Setup PHP with intl
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
extensions: intl-68.2
|
extensions: intl-67.1
|
||||||
```
|
```
|
||||||
|
|
||||||
- Extensions loaded by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
|
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
||||||
|
|
||||||
- These extensions have custom support:
|
|
||||||
- `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
|
|
||||||
- `geos` on `Ubuntu` and `macOS`.
|
|
||||||
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
|
||||||
|
|
||||||
- By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
|
- By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
|
||||||
|
|
||||||
@@ -194,7 +184,7 @@ PHP extensions can be setup using the `extensions` input. It accepts a `string`
|
|||||||
|
|
||||||
## :wrench: Tools Support
|
## :wrench: Tools Support
|
||||||
|
|
||||||
These tools can be setup globally using the `tools` input. It accepts a string in csv-format.
|
These tools can be setup globally using the `tools` input.
|
||||||
|
|
||||||
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||||
|
|
||||||
@@ -216,7 +206,7 @@ These tools can be setup globally using the `tools` input. It accepts a string i
|
|||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
```
|
```
|
||||||
|
|
||||||
- Tools `prestissimo` and `composer-prefetcher` will be skipped unless `composer:v1` is also specified in tools input. It is recommended to drop `prestissimo` and use `composer v2`.
|
- If you have specified composer plugins `prestissimo` or `composer-prefetcher` in tools, the latest stable version of `composer v1` will be setup. Unless some of your packages require `composer v1`, it is recommended to drop `prestissimo` and use `composer v2`.
|
||||||
|
|
||||||
- The 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.
|
- The 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.
|
||||||
|
|
||||||
@@ -262,24 +252,12 @@ Runs on all [PHP versions supported](#tada-php-support "List of PHP versions sup
|
|||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
```
|
```
|
||||||
|
|
||||||
- The latest version of Xdebug compatible with the PHP version is set up by default.
|
|
||||||
- If you need Xdebug 2.x on PHP 7.2, 7.3 or 7.4, you can specify `coverage: xdebug2`.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup PHP with Xdebug 2.x
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '7.4'
|
|
||||||
coverage: xdebug2
|
|
||||||
```
|
|
||||||
|
|
||||||
### PCOV
|
### PCOV
|
||||||
|
|
||||||
Specify `coverage: pcov` to use PCOV and disable Xdebug.
|
Specify `coverage: pcov` to use `PCOV` and disable `Xdebug`.
|
||||||
Runs on PHP 7.1 and newer PHP versions.
|
`PCOV` supports `PHP 7.1` and newer PHP versions.
|
||||||
|
Tests with `PCOV` run much faster than with `Xdebug`.
|
||||||
- In most cases, tests with `PCOV` execute 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
|
||||||
- name: Setup PHP with PCOV
|
- name: Setup PHP with PCOV
|
||||||
@@ -290,8 +268,9 @@ Runs on PHP 7.1 and newer PHP versions.
|
|||||||
coverage: pcov
|
coverage: pcov
|
||||||
```
|
```
|
||||||
|
|
||||||
- PHPUnit 8.x and above supports PCOV out of the box.
|
`PHPUnit` 8 and above supports `PCOV` out of the box.
|
||||||
- If you are using PHPUnit 5.x, 6.x or 7.x, you need to set up `pcov/clobber` before executing your tests.
|
If you are using `PHPUnit` 5, 6 or 7, you will need `krakjoe/pcov-clobber`.
|
||||||
|
Before executing your tests add the following step.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PCOV
|
- name: Setup PCOV
|
||||||
@@ -329,7 +308,6 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
- Specify the PHP version you want to set up.
|
- Specify the PHP version you want to set up.
|
||||||
- Accepts a `string`. For example `'7.4'`.
|
- Accepts a `string`. For example `'7.4'`.
|
||||||
- Accepts `latest` to set up the latest stable PHP version.
|
- Accepts `latest` to set up the latest stable PHP version.
|
||||||
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
|
|
||||||
- See [PHP support](#tada-php-support) for supported PHP versions.
|
- See [PHP support](#tada-php-support) for supported PHP versions.
|
||||||
|
|
||||||
#### `extensions` (optional)
|
#### `extensions` (optional)
|
||||||
@@ -341,9 +319,8 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
|
|
||||||
#### `ini-values` (optional)
|
#### `ini-values` (optional)
|
||||||
|
|
||||||
- Specify the values you want to add to `php.ini`.
|
- Specify the values you want to add to `php.ini`.
|
||||||
- Accepts a `string` in csv-format. For example `post_max_size=256M, max_execution_time=180`.
|
- Accepts a `string` in csv-format. For example `post_max_size=256M, short_open_tag=On`.
|
||||||
- Accepts ini values with commas if wrapped in quotes. For example `xdebug.mode="develop,coverage"`.
|
|
||||||
|
|
||||||
#### `coverage` (optional)
|
#### `coverage` (optional)
|
||||||
|
|
||||||
@@ -380,7 +357,7 @@ Consider disabling the coverage using this PHP action for these reasons.
|
|||||||
- Specify to update PHP on the runner to the latest patch version.
|
- Specify to update PHP on the runner to the latest patch version.
|
||||||
- Accepts `true` and `false`.
|
- Accepts `true` and `false`.
|
||||||
- By default, it is set to `false`.
|
- By default, it is set to `false`.
|
||||||
- See [force update setup](#force-update-setup) for more info.
|
- See [force update](#force-update) for more info.
|
||||||
|
|
||||||
See below for more info.
|
See below for more info.
|
||||||
|
|
||||||
@@ -398,7 +375,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '7.4'
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
ini-values: post_max_size=256M, max_execution_time=180
|
ini-values: post_max_size=256M, short_open_tag=On
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
tools: php-cs-fixer, phpunit
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
```
|
||||||
@@ -413,13 +390,9 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.3', '7.4']
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||||
phpunit-versions: ['latest']
|
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
||||||
include:
|
|
||||||
- operating-system: 'ubuntu-latest'
|
|
||||||
php-versions: '7.2'
|
|
||||||
phpunit-versions: '8.5.13'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -429,85 +402,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, intl
|
extensions: mbstring, intl
|
||||||
ini-values: post_max_size=256M, max_execution_time=180
|
ini-values: post_max_size=256M, short_open_tag=On
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}
|
tools: php-cs-fixer, phpunit
|
||||||
```
|
|
||||||
|
|
||||||
### Nightly Build Setup
|
|
||||||
|
|
||||||
> Setup a nightly build of `PHP 8.1`.
|
|
||||||
|
|
||||||
- This version is currently in development.
|
|
||||||
- Some user space extensions might not support this version currently.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Setup nightly PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.1'
|
|
||||||
extensions: mbstring
|
|
||||||
ini-values: post_max_size=256M, max_execution_time=180
|
|
||||||
coverage: xdebug
|
|
||||||
tools: php-cs-fixer, phpunit
|
|
||||||
```
|
|
||||||
|
|
||||||
### Thread Safe Setup
|
|
||||||
|
|
||||||
> Setup `TS` or `NTS` PHP on `Windows`.
|
|
||||||
|
|
||||||
- `NTS` versions are setup by default.
|
|
||||||
- On `Ubuntu` and `macOS` only `NTS` versions are supported.
|
|
||||||
- On `Windows` both `TS` and `NTS` versions are supported.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
runs-on: windows-latest
|
|
||||||
name: Setup PHP TS on Windows
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '7.4'
|
|
||||||
env:
|
|
||||||
phpts: ts # specify ts or nts
|
|
||||||
```
|
|
||||||
|
|
||||||
### Force Update Setup
|
|
||||||
|
|
||||||
> Update to the latest patch of PHP versions.
|
|
||||||
|
|
||||||
- Pre-installed PHP versions on the GitHub Actions runner are not updated to their latest patch release by default.
|
|
||||||
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup PHP with latest versions
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '7.4'
|
|
||||||
env:
|
|
||||||
update: true # specify true or false
|
|
||||||
```
|
|
||||||
|
|
||||||
### Verbose Setup
|
|
||||||
|
|
||||||
> Debug your workflow
|
|
||||||
|
|
||||||
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Setup PHP with logs
|
|
||||||
uses: shivammathur/setup-php@verbose
|
|
||||||
with:
|
|
||||||
php-version: '7.4'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Multi-Arch Setup
|
### Multi-Arch Setup
|
||||||
@@ -536,11 +433,36 @@ jobs:
|
|||||||
# Install PHP
|
# Install PHP
|
||||||
spc --php-version "7.4" \
|
spc --php-version "7.4" \
|
||||||
--extensions "mbstring, intl" \
|
--extensions "mbstring, intl" \
|
||||||
--ini-values "post_max_size=256M, max_execution_time=180" \
|
--ini-values "post_max_size=256M, short_open_tag=On" \
|
||||||
--coverage "xdebug" \
|
--coverage "xdebug" \
|
||||||
--tools "php-cs-fixer, phpunit"
|
--tools "php-cs-fixer, phpunit"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Nightly Build Setup
|
||||||
|
|
||||||
|
> Setup a nightly build of `PHP 8.0` or `PHP 8.1`.
|
||||||
|
|
||||||
|
- These versions are currently in development.
|
||||||
|
- `PECL` is installed by default with these versions on `ubuntu` and `macOS`.
|
||||||
|
- Some user space extensions might not support these versions currently.
|
||||||
|
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on these versions.
|
||||||
|
- Refer to this [list of RFCs](https://wiki.php.net/rfc#php_80 "List of RFCs implemented in PHP8") for features implemented in `PHP 8.0`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup nightly PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.1'
|
||||||
|
extensions: mbstring
|
||||||
|
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
|
||||||
|
coverage: pcov
|
||||||
|
tools: php-cs-fixer, phpunit
|
||||||
|
```
|
||||||
|
|
||||||
### Self Hosted Setup
|
### Self Hosted Setup
|
||||||
|
|
||||||
> Setup PHP on a self-hosted runner.
|
> Setup PHP on a self-hosted runner.
|
||||||
@@ -595,7 +517,7 @@ jobs:
|
|||||||
php-version: 7.4
|
php-version: 7.4
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker images.
|
Run the workflow locally with `act` using [`shivammathur/node`](https://github.com/shivammathur/node-docker "Docker image to run setup-php") docker image.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For runs-on: ubuntu-latest
|
# For runs-on: ubuntu-latest
|
||||||
@@ -611,22 +533,58 @@ act -P ubuntu-18.04=shivammathur/node:bionic
|
|||||||
act -P ubuntu-16.04=shivammathur/node:xenial
|
act -P ubuntu-16.04=shivammathur/node:xenial
|
||||||
```
|
```
|
||||||
|
|
||||||
### JIT Configuration
|
### Thread Safe Setup
|
||||||
|
|
||||||
> Enable Just-in-time(JIT) on PHP 8.0 and PHP 8.1.
|
> Setup `TS` or `NTS` PHP on `Windows`.
|
||||||
|
|
||||||
- To enable JIT, enable `opcache` in cli mode by setting `opcache.enable_cli=1`.
|
- `NTS` versions are setup by default.
|
||||||
- By default, `opcache.jit=1235` and `opcache.jit_buffer_size=256M` are set which can be changed using `ini-values` input.
|
- On `Ubuntu` and `macOS` only `NTS` versions are supported.
|
||||||
- For detailed information about JIT related directives refer to the [`official PHP documentation`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit "opcache.jit documentation").
|
- On `Windows` both `TS` and `NTS` versions are supported.
|
||||||
|
|
||||||
For example to enable JIT in `tracing` mode with buffer size of `64 MB`.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP with JIT in tracing mode
|
jobs:
|
||||||
|
run:
|
||||||
|
runs-on: windows-latest
|
||||||
|
name: Setup PHP TS on Windows
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
env:
|
||||||
|
phpts: ts # specify ts or nts
|
||||||
|
```
|
||||||
|
|
||||||
|
### Force Update
|
||||||
|
|
||||||
|
> Update to the latest patch of PHP versions.
|
||||||
|
|
||||||
|
- Pre-installed PHP versions on the GitHub Actions runner are not updated to their latest patch release by default.
|
||||||
|
- You can specify the `update` environment variable to `true` to force update to the latest release.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP with latest versions
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '7.4'
|
||||||
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
|
env:
|
||||||
|
update: true # specify true or false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verbose Setup
|
||||||
|
|
||||||
|
> Debug your workflow
|
||||||
|
|
||||||
|
To debug any issues, you can use the `verbose` tag instead of `v2`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup PHP with logs
|
||||||
|
uses: shivammathur/setup-php@verbose
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cache Extensions
|
### Cache Extensions
|
||||||
@@ -818,7 +776,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
|||||||
> Contributions are welcome!
|
> Contributions are welcome!
|
||||||
|
|
||||||
- See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
|
- See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide") before you start.
|
||||||
- If you face any issues or want to suggest a feature/improvement, start a discussion [here](https://github.com/shivammathur/setup-php/discussions "Setup PHP discussions").
|
- If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported").
|
||||||
|
|
||||||
*Join the list of setup-php contributors*
|
*Join the list of setup-php contributors*
|
||||||
|
|
||||||
@@ -830,31 +788,24 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
|||||||
|
|
||||||
## :sparkling_heart: Support This Project
|
## :sparkling_heart: Support This Project
|
||||||
|
|
||||||
- If setup-php saved your developer time, please consider sponsoring setup-php:
|
|
||||||
- [Open Collective](https://opencollective.com/setup-php "setup-php Open Collective")
|
|
||||||
- [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal")
|
|
||||||
- [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon")
|
|
||||||
- Please [reach out](mailto:contact@setup-php.com) if you have any questions regarding sponsoring setup-php.
|
|
||||||
- Please star the project and share it. If you blog, please share your experience of using this action.
|
- Please star the project and share it. If you blog, please share your experience of using this action.
|
||||||
|
- Please consider supporting our work by sponsoring using [Open Collective](https://opencollective.com/setup-php), [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal") or [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon").
|
||||||
|
- If you use `setup-php` at your company, please [reach out](mailto:contact@setup-php.com) to sponsor the project.
|
||||||
|
|
||||||
*Huge thanks to the following companies for supporting `setup-php`*
|
*Huge thanks to the following companies for supporting `setup-php`*
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://www.jetbrains.com/?from=setup-php">
|
<a href="https://www.jetbrains.com/?from=setup-php">
|
||||||
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="106" height="60">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://blackfire.io/?utm_source=setup-php">
|
<a href="https://blackfire.io/?utm_source=setup-php">
|
||||||
<img src="https://setup-php.com/sponsors//blackfire.svg" alt="Blackfire" width="212" height="60">
|
<img src="https://shivammathur.com/blackfire.svg" alt="Blackfire" width="212" height="60">
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="https://www.macstadium.com/?source=setup-php">
|
|
||||||
<img src="https://setup-php.com/sponsors//macstadium.png" alt="Mac Stadium" width="148" height="60">
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||||
<img src="https://setup-php.com/sponsors//tidelift.png" alt="Tidelift" width="70" height="60">
|
<img src="https://shivammathur.com/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## :package: Dependencies
|
## :package: Dependencies
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ describe('Config tests', () => {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
expect(linux).toContain(
|
expect(linux).toContain(
|
||||||
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
);
|
);
|
||||||
|
|
||||||
linux = await config.addINIValues(
|
linux = await config.addINIValues(
|
||||||
@@ -40,7 +40,7 @@ describe('Config tests', () => {
|
|||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain(
|
expect(darwin).toContain(
|
||||||
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
);
|
);
|
||||||
|
|
||||||
darwin = await config.addINIValues(
|
darwin = await config.addINIValues(
|
||||||
|
|||||||
+25
-33
@@ -30,29 +30,39 @@ describe('Config tests', () => {
|
|||||||
expect(win32).toContain('Add-Extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug3 on windows', async () => {
|
|
||||||
const win32: string = await coverage.addCoverage('xdebug3', '7.4', 'win32');
|
|
||||||
expect(win32).toContain('Add-Extension xdebug');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug2 on windows', async () => {
|
|
||||||
const win32: string = await coverage.addCoverage('xdebug2', '7.4', 'win32');
|
|
||||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on linux', async () => {
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||||
expect(linux).toContain('add_extension xdebug');
|
expect(linux).toContain('add_extension xdebug');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug3 on linux', async () => {
|
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||||
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
|
const linux: string = await coverage.addCoverage('xdebug3', '7.4', 'linux');
|
||||||
expect(linux).toContain('add_extension xdebug');
|
expect(linux).toContain('add_extension_from_source xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug2 on linux', async () => {
|
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||||
const linux: string = await coverage.addCoverage('xdebug2', '7.4', 'linux');
|
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
|
||||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug3', '8.1', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug', '8.1', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on darwin', async () => {
|
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||||
@@ -64,24 +74,6 @@ describe('Config tests', () => {
|
|||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug3 on darwin', async () => {
|
|
||||||
const darwin: string = await coverage.addCoverage(
|
|
||||||
'xdebug3',
|
|
||||||
'7.4',
|
|
||||||
'darwin'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug2 on darwin', async () => {
|
|
||||||
const darwin: string = await coverage.addCoverage(
|
|
||||||
'xdebug2',
|
|
||||||
'7.4',
|
|
||||||
'darwin'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking disableCoverage windows', async () => {
|
it('checking disableCoverage windows', async () => {
|
||||||
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
|
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
|
||||||
expect(win32).toContain('Remove-Extension xdebug');
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ describe('Extension tests', () => {
|
|||||||
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
);
|
);
|
||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32');
|
|
||||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
|
||||||
|
|
||||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
@@ -62,11 +59,13 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
let linux: string = await extensions.addExtension(
|
let linux: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
'Xdebug, xdebug3, pcov, sqlite, :intl, ast, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('add_extension xdebug');
|
expect(linux).toContain(
|
||||||
|
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
|
||||||
|
);
|
||||||
expect(linux).toContain('add_extension sqlite3');
|
expect(linux).toContain('add_extension sqlite3');
|
||||||
expect(linux).toContain('remove_extension intl');
|
expect(linux).toContain('remove_extension intl');
|
||||||
expect(linux).toContain('add_unstable_extension ast beta extension');
|
expect(linux).toContain('add_unstable_extension ast beta extension');
|
||||||
@@ -97,9 +96,6 @@ describe('Extension tests', () => {
|
|||||||
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
|
||||||
expect(linux).toContain('add_cubrid cubrid');
|
expect(linux).toContain('add_cubrid cubrid');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
|
||||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
expect(linux).toContain('Platform openbsd is not supported');
|
expect(linux).toContain('Platform openbsd is not supported');
|
||||||
|
|
||||||
@@ -110,9 +106,6 @@ describe('Extension tests', () => {
|
|||||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
||||||
expect(linux).toContain('add_ioncube');
|
expect(linux).toContain('add_ioncube');
|
||||||
|
|
||||||
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('add_geos');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||||
expect(linux).toContain('add_oci oci8');
|
expect(linux).toContain('add_oci oci8');
|
||||||
expect(linux).toContain('add_oci pdo_oci');
|
expect(linux).toContain('add_oci pdo_oci');
|
||||||
@@ -128,24 +121,19 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
|
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
|
||||||
expect(linux).toContain('add_intl intl-67.1');
|
expect(linux).toContain('add_intl intl-67.1');
|
||||||
|
|
||||||
linux = await extensions.addExtension('intl-68.2', '8.0', 'linux');
|
|
||||||
expect(linux).toContain('add_intl intl-68.2');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'amqp, Xdebug, pcov, grpc, igbinary, imagick, imap, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
'Xdebug, pcov, grpc, igbinary, imagick, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_brew_extension amqp extension');
|
|
||||||
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
|
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
|
||||||
expect(darwin).toContain('add_brew_extension pcov extension');
|
expect(darwin).toContain('add_brew_extension pcov extension');
|
||||||
expect(darwin).toContain('add_brew_extension grpc extension');
|
expect(darwin).toContain('add_brew_extension grpc extension');
|
||||||
expect(darwin).toContain('add_brew_extension igbinary extension');
|
expect(darwin).toContain('add_brew_extension igbinary extension');
|
||||||
expect(darwin).toContain('add_brew_extension imagick extension');
|
expect(darwin).toContain('add_brew_extension imagick extension');
|
||||||
expect(darwin).toContain('add_brew_extension imap extension');
|
|
||||||
expect(darwin).toContain('add_brew_extension protobuf extension');
|
expect(darwin).toContain('add_brew_extension protobuf extension');
|
||||||
expect(darwin).toContain('add_brew_extension swoole extension');
|
expect(darwin).toContain('add_brew_extension swoole extension');
|
||||||
expect(darwin).toContain('add_extension sqlite3');
|
expect(darwin).toContain('add_extension sqlite3');
|
||||||
@@ -168,9 +156,6 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('add_ioncube');
|
expect(darwin).toContain('add_ioncube');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
|
|
||||||
expect(darwin).toContain('add_geos');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('add_oci oci8');
|
expect(darwin).toContain('add_oci oci8');
|
||||||
expect(darwin).toContain('add_oci pdo_oci');
|
expect(darwin).toContain('add_oci pdo_oci');
|
||||||
@@ -192,9 +177,6 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
|
||||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('add_extension redis-2.2.8');
|
expect(darwin).toContain('add_extension redis-2.2.8');
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ describe('Install', () => {
|
|||||||
|
|
||||||
script = '' + (await install.run());
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash linux.sh 8.0 ');
|
expect(script).toContain('bash linux.sh 7.4 ');
|
||||||
|
|
||||||
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
||||||
|
|
||||||
|
|||||||
+6
-12
@@ -167,22 +167,14 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking addPhive', async () => {
|
it('checking addPhive', async () => {
|
||||||
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
let script: string = await tools.addPhive('1.2.3', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
);
|
);
|
||||||
|
|
||||||
script = await tools.addPhive('latest', '5.5', 'win32');
|
script = await tools.addPhive('latest', 'win32');
|
||||||
expect(script).toContain('Phive is not supported on PHP 5.5');
|
|
||||||
|
|
||||||
script = await tools.addPhive('latest', '5.6', 'win32');
|
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'
|
'Add-Tool https://phar.io/releases/phive.phar phive'
|
||||||
);
|
|
||||||
|
|
||||||
script = await tools.addPhive('latest', '7.1', 'win32');
|
|
||||||
expect(script).toContain(
|
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -259,6 +251,9 @@ describe('Tools tests', () => {
|
|||||||
expect(
|
expect(
|
||||||
await tools.addComposer(['a', 'b', 'c', 'composer:v2'])
|
await tools.addComposer(['a', 'b', 'c', 'composer:v2'])
|
||||||
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
).toStrictEqual(['composer:2', 'a', 'b', 'c']);
|
||||||
|
expect(
|
||||||
|
await tools.addComposer(['hirak', 'b', 'c', 'composer:v2'])
|
||||||
|
).toStrictEqual(['composer:1', 'hirak', 'b', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getComposerUrl', async () => {
|
it('checking getComposerUrl', async () => {
|
||||||
@@ -634,7 +629,6 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
it('checking addTools with composer tool using user/tool as input', async () => {
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'composer:v1',
|
|
||||||
'hirak/prestissimo',
|
'hirak/prestissimo',
|
||||||
'narrowspark/automatic-composer-prefetcher',
|
'narrowspark/automatic-composer-prefetcher',
|
||||||
'robmorgan/phinx'
|
'robmorgan/phinx'
|
||||||
|
|||||||
+1
-29
@@ -8,12 +8,6 @@ jest.mock('@actions/core', () => ({
|
|||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.spyOn(utils, 'fetch').mockImplementation(
|
|
||||||
async (url): Promise<string> => {
|
|
||||||
return `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
async function cleanup(path: string): Promise<void> {
|
async function cleanup(path: string): Promise<void> {
|
||||||
fs.unlink(path, error => {
|
fs.unlink(path, error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -39,18 +33,10 @@ describe('Utils tests', () => {
|
|||||||
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking fetch', async () => {
|
|
||||||
expect(await utils.fetch('test_url')).toBe(
|
|
||||||
'{ "latest": "8.0", "5.x": "5.6", "url": "test_url" }'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking parseVersion', async () => {
|
it('checking parseVersion', async () => {
|
||||||
expect(await utils.parseVersion('latest')).toBe('8.0');
|
|
||||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
expect(await utils.parseVersion('latest')).toBe('7.4');
|
||||||
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking asyncForEach', async () => {
|
it('checking asyncForEach', async () => {
|
||||||
@@ -125,20 +111,6 @@ describe('Utils tests', () => {
|
|||||||
'b=2',
|
'b=2',
|
||||||
'c=3'
|
'c=3'
|
||||||
]);
|
]);
|
||||||
expect(await utils.CSVArray('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([
|
|
||||||
'a=1,2',
|
|
||||||
'b=3, 4',
|
|
||||||
'c=5',
|
|
||||||
"d='~e~'"
|
|
||||||
]);
|
|
||||||
expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([
|
|
||||||
'a=1,2',
|
|
||||||
'b=3, 4',
|
|
||||||
'c=5'
|
|
||||||
]);
|
|
||||||
expect(
|
|
||||||
await utils.CSVArray('a=E_ALL, b=E_ALL & ~ E_ALL, c="E_ALL", d=\'E_ALL\'')
|
|
||||||
).toEqual(['a=E_ALL', 'b=E_ALL & ~ E_ALL', 'c=E_ALL', 'd=E_ALL']);
|
|
||||||
expect(await utils.CSVArray('')).toEqual([]);
|
expect(await utils.CSVArray('')).toEqual([]);
|
||||||
expect(await utils.CSVArray(' ')).toEqual([]);
|
expect(await utils.CSVArray(' ')).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
name: 'Setup PHP Action'
|
name: 'Setup PHP Action'
|
||||||
author: shivammathur
|
author: shivammathur
|
||||||
description: 'GitHub Action for PHP'
|
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
|
||||||
branding:
|
branding:
|
||||||
color: 'purple'
|
color: 'purple'
|
||||||
icon: 'play-circle'
|
icon: 'play-circle'
|
||||||
inputs:
|
inputs:
|
||||||
php-version:
|
php-version:
|
||||||
description: 'Setup PHP version.'
|
description: 'Setup PHP version.'
|
||||||
default: '8.0'
|
default: '7.4'
|
||||||
required: true
|
required: true
|
||||||
extensions:
|
extensions:
|
||||||
description: 'Setup PHP extensions.'
|
description: 'Setup PHP extensions.'
|
||||||
|
|||||||
Vendored
+77
-101
@@ -1054,9 +1054,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.customPackage = exports.scriptTool = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.parseVersion = exports.fetch = exports.getInput = exports.readEnv = void 0;
|
exports.customPackage = exports.scriptTool = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.parseVersion = exports.getInput = exports.readEnv = void 0;
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const https = __importStar(__webpack_require__(211));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
/**
|
/**
|
||||||
@@ -1095,34 +1094,15 @@ async function getInput(name, mandatory) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getInput = getInput;
|
exports.getInput = getInput;
|
||||||
/**
|
|
||||||
* Function to fetch an URL
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
*/
|
|
||||||
async function fetch(url) {
|
|
||||||
const fetch_promise = new Promise(resolve => {
|
|
||||||
const req = https.get(url, (res) => {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
let body = '';
|
|
||||||
res.on('data', chunk => (body += chunk));
|
|
||||||
res.on('end', () => resolve(body));
|
|
||||||
});
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
return await fetch_promise;
|
|
||||||
}
|
|
||||||
exports.fetch = fetch;
|
|
||||||
/**
|
/**
|
||||||
* Function to parse PHP version.
|
* Function to parse PHP version.
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
async function parseVersion(version) {
|
async function parseVersion(version) {
|
||||||
const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
switch (version) {
|
||||||
switch (true) {
|
case 'latest':
|
||||||
case /latest|\d.x/.test(version):
|
return '7.4';
|
||||||
return JSON.parse(await fetch(manifest))[version];
|
|
||||||
default:
|
default:
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.length > 1:
|
case version.length > 1:
|
||||||
@@ -1261,7 +1241,8 @@ async function extensionArray(extension_csv) {
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^php[-_]/, '');
|
.replace('php-', '')
|
||||||
|
.replace('php_', '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -1280,12 +1261,9 @@ async function CSVArray(values_csv) {
|
|||||||
return [];
|
return [];
|
||||||
default:
|
default:
|
||||||
return values_csv
|
return values_csv
|
||||||
.split(/,(?=(?:(?:[^"']*["']){2})*[^"']*$)/)
|
.split(',')
|
||||||
.map(function (value) {
|
.map(function (value) {
|
||||||
return value
|
return value.trim();
|
||||||
.trim()
|
|
||||||
.replace(/^["']|["']$|(?<==)["']/g, '')
|
|
||||||
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'");
|
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -1297,11 +1275,18 @@ exports.CSVArray = CSVArray;
|
|||||||
* @param extension
|
* @param extension
|
||||||
*/
|
*/
|
||||||
async function getExtensionPrefix(extension) {
|
async function getExtensionPrefix(extension) {
|
||||||
switch (true) {
|
const zend = [
|
||||||
|
'xdebug',
|
||||||
|
'xdebug3',
|
||||||
|
'opcache',
|
||||||
|
'ioncube',
|
||||||
|
'eaccelerator'
|
||||||
|
];
|
||||||
|
switch (zend.indexOf(extension)) {
|
||||||
default:
|
default:
|
||||||
return 'extension';
|
|
||||||
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
|
||||||
return 'zend_extension';
|
return 'zend_extension';
|
||||||
|
case -1:
|
||||||
|
return 'extension';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getExtensionPrefix = getExtensionPrefix;
|
exports.getExtensionPrefix = getExtensionPrefix;
|
||||||
@@ -1414,13 +1399,6 @@ async function customPackage(pkg, type, version, os_version) {
|
|||||||
exports.customPackage = customPackage;
|
exports.customPackage = customPackage;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 211:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("https");
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 357:
|
/***/ 357:
|
||||||
@@ -1930,20 +1908,9 @@ exports.getCodeceptionUri = getCodeceptionUri;
|
|||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
* @param php_version
|
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
async function addPhive(version, php_version, os_version) {
|
async function addPhive(version, os_version) {
|
||||||
switch (true) {
|
|
||||||
case /5\.[3-5]/.test(php_version):
|
|
||||||
return await utils.addLog('$cross', 'phive', 'Phive is not supported on PHP ' + php_version, os_version);
|
|
||||||
case /5\.6|7\.0/.test(php_version):
|
|
||||||
version = version.replace('latest', '0.12.1');
|
|
||||||
break;
|
|
||||||
case /7\.1/.test(php_version):
|
|
||||||
version = version.replace('latest', '0.13.5');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
return ((await utils.getCommand(os_version, 'tool')) +
|
return ((await utils.getCommand(os_version, 'tool')) +
|
||||||
@@ -2056,10 +2023,14 @@ exports.getWpCliUrl = getWpCliUrl;
|
|||||||
async function addComposer(tools_list) {
|
async function addComposer(tools_list) {
|
||||||
const regex_any = /^composer($|:.*)/;
|
const regex_any = /^composer($|:.*)/;
|
||||||
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
||||||
|
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
|
||||||
const matches = tools_list.filter(tool => regex_valid.test(tool));
|
const matches = tools_list.filter(tool => regex_valid.test(tool));
|
||||||
let composer = 'composer';
|
let composer = 'composer';
|
||||||
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case regex_composer1_tools.test(tools_list.join(' ')):
|
||||||
|
composer = 'composer:1';
|
||||||
|
break;
|
||||||
case matches[0] == undefined:
|
case matches[0] == undefined:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2241,7 +2212,7 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case 'phive':
|
||||||
script += await addPhive(version, php_version, os_version);
|
script += await addPhive(version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-config':
|
case 'php-config':
|
||||||
case 'phpize':
|
case 'phpize':
|
||||||
@@ -2359,8 +2330,16 @@ const config = __importStar(__webpack_require__(641));
|
|||||||
async function addCoverageXdebug(extension, version, os_version, pipe) {
|
async function addCoverageXdebug(extension, version, os_version, pipe) {
|
||||||
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
|
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
|
||||||
pipe;
|
pipe;
|
||||||
|
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
|
||||||
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
||||||
return xdebug + '\n' + log;
|
switch (true) {
|
||||||
|
case /^xdebug3$/.test(extension):
|
||||||
|
case /^8\.\d$/.test(version):
|
||||||
|
return '\n' + xdebug + '\n' + ini + '\n' + log;
|
||||||
|
case /^xdebug$/.test(extension):
|
||||||
|
default:
|
||||||
|
return xdebug + '\n' + log;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.addCoverageXdebug = addCoverageXdebug;
|
exports.addCoverageXdebug = addCoverageXdebug;
|
||||||
/**
|
/**
|
||||||
@@ -2441,9 +2420,8 @@ async function addCoverage(coverage_driver, version, os_version) {
|
|||||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||||
case 'xdebug':
|
case 'xdebug':
|
||||||
case 'xdebug3':
|
case 'xdebug3':
|
||||||
return (script + (await addCoverageXdebug('xdebug', version, os_version, pipe)));
|
return (script +
|
||||||
case 'xdebug2':
|
(await addCoverageXdebug(coverage_driver, version, os_version, pipe)));
|
||||||
return (script + (await addCoverageXdebug('xdebug2', version, os_version, pipe)));
|
|
||||||
case 'none':
|
case 'none':
|
||||||
return script + (await disableCoverage(version, os_version, pipe));
|
return script + (await disableCoverage(version, os_version, pipe));
|
||||||
default:
|
default:
|
||||||
@@ -2494,10 +2472,7 @@ async function addINIValuesUnix(ini_values_csv) {
|
|||||||
script +=
|
script +=
|
||||||
'\n' + (await utils.addLog('$tick', line, 'Added to php.ini', 'linux'));
|
'\n' + (await utils.addLog('$tick', line, 'Added to php.ini', 'linux'));
|
||||||
});
|
});
|
||||||
return ('echo "' +
|
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
||||||
ini_values.join('\n') +
|
|
||||||
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
|
|
||||||
script);
|
|
||||||
}
|
}
|
||||||
exports.addINIValuesUnix = addINIValuesUnix;
|
exports.addINIValuesUnix = addINIValuesUnix;
|
||||||
/**
|
/**
|
||||||
@@ -2599,7 +2574,10 @@ async function getScript(filename, version, os_version) {
|
|||||||
const extension_csv = await utils.getInput('extensions', false);
|
const extension_csv = await utils.getInput('extensions', false);
|
||||||
const ini_values_csv = await utils.getInput('ini-values', false);
|
const ini_values_csv = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver = await utils.getInput('coverage', false);
|
const coverage_driver = await utils.getInput('coverage', false);
|
||||||
const tools_csv = await utils.getInput('tools', false);
|
let tools_csv = await utils.getInput('tools', false);
|
||||||
|
if (/.*-(beta|alpha|devel|snapshot|\d+\.\d+\.\d+).*/.test(extension_csv)) {
|
||||||
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
|
}
|
||||||
let script = await utils.readScript(filename);
|
let script = await utils.readScript(filename);
|
||||||
script += await tools.addTools(tools_csv, version, os_version);
|
script += await tools.addTools(tools_csv, version, os_version);
|
||||||
if (extension_csv) {
|
if (extension_csv) {
|
||||||
@@ -2622,16 +2600,11 @@ exports.getScript = getScript;
|
|||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const version = await utils.parseVersion(await utils.getInput('php-version', true));
|
const version = await utils.parseVersion(await utils.getInput('php-version', true));
|
||||||
if (version) {
|
const os_version = process.platform;
|
||||||
const os_version = process.platform;
|
const tool = await utils.scriptTool(os_version);
|
||||||
const tool = await utils.scriptTool(os_version);
|
const script = os_version + (await utils.scriptExtension(os_version));
|
||||||
const script = os_version + (await utils.scriptExtension(os_version));
|
const location = await getScript(script, version, os_version);
|
||||||
const location = await getScript(script, version, os_version);
|
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
|
||||||
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.setFailed('Unable to get the PHP version');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
@@ -2906,21 +2879,21 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6couchbase...7.4couchbase
|
// match 5.6couchbase...7.4couchbase
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
@@ -2931,9 +2904,11 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, protobuf, swoole and xdebug
|
// match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary
|
||||||
// match 7.1 to 8.9 for pcov
|
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|protobuf|swoole|xdebug)/.test(version_extension):
|
// match 7.1pcov to 8.9pcov
|
||||||
|
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|igbinary)/.test(version_extension):
|
||||||
|
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
||||||
return;
|
return;
|
||||||
@@ -2972,20 +2947,20 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
break;
|
break;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
@@ -2996,10 +2971,6 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(version_extension);
|
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(version_extension);
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
|
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
|
||||||
break;
|
break;
|
||||||
// match 7.2xdebug2 to 7.4xdebug2
|
|
||||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
|
||||||
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
|
||||||
break;
|
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
@@ -3049,24 +3020,24 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
case /^(5\.6|7\.[0-4]|8\.0)intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
// match semver versions
|
||||||
@@ -3077,10 +3048,15 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug2...7.4xdebug2
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_pecl_extension', 'xdebug', '2.9.8', ext_prefix);
|
add_script +=
|
||||||
|
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
|
||||||
return;
|
return;
|
||||||
|
// match 8.0xdebug3...8.9xdebug3
|
||||||
|
case /^8\.[0-9]xdebug3$/.test(version_extension):
|
||||||
|
extension = 'xdebug';
|
||||||
|
break;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
|
|||||||
@@ -43,14 +43,13 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack symfony/phpunit-bridge
|
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
php bin/phpunit install
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
|
composer require symfony/orm-pack
|
||||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: php bin/phpunit --coverage-text
|
run: php bin/phpunit --coverage-text
|
||||||
@@ -41,14 +41,13 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/orm-pack symfony/phpunit-bridge
|
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
php bin/phpunit install
|
|
||||||
- name: Run Migration
|
- name: Run Migration
|
||||||
run: |
|
run: |
|
||||||
|
composer require symfony/orm-pack
|
||||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: php bin/phpunit --coverage-text
|
run: php bin/phpunit --coverage-text
|
||||||
@@ -32,8 +32,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer require --dev symfony/phpunit-bridge
|
composer require symfony/orm-pack
|
||||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
php bin/phpunit install
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: php bin/phpunit --coverage-text
|
run: php bin/phpunit --coverage-text
|
||||||
Generated
+465
-7990
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.9.0",
|
"version": "2.8.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -30,22 +30,22 @@
|
|||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.19",
|
"@types/jest": "^26.0.15",
|
||||||
"@types/node": "^14.14.14",
|
"@types/node": "^14.14.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.10.0",
|
"@typescript-eslint/eslint-plugin": "^4.7.0",
|
||||||
"@typescript-eslint/parser": "^4.10.0",
|
"@typescript-eslint/parser": "^4.7.0",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^7.16.0",
|
"eslint": "^7.13.0",
|
||||||
"eslint-config-prettier": "^7.1.0",
|
"eslint-config-prettier": "^6.15.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-jest": "^24.1.3",
|
"eslint-plugin-jest": "^24.1.3",
|
||||||
"eslint-plugin-prettier": "^3.3.0",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"husky": "^4.3.6",
|
"husky": "^4.3.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.6.3",
|
"jest-circus": "^26.6.3",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.1.2",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.4.4",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.0.5"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
|
|||||||
+1
-6
@@ -14,12 +14,7 @@ export async function addINIValuesUnix(
|
|||||||
script +=
|
script +=
|
||||||
'\n' + (await utils.addLog('$tick', line, 'Added to php.ini', 'linux'));
|
'\n' + (await utils.addLog('$tick', line, 'Added to php.ini', 'linux'));
|
||||||
});
|
});
|
||||||
return (
|
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
||||||
'echo "' +
|
|
||||||
ini_values.join('\n') +
|
|
||||||
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
|
|
||||||
script
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"latest": "8.0",
|
|
||||||
"5.x": "5.6",
|
|
||||||
"7.x": "7.4",
|
|
||||||
"8.x": "8.0"
|
|
||||||
}
|
|
||||||
+15
-6
@@ -19,13 +19,25 @@ export async function addCoverageXdebug(
|
|||||||
const xdebug =
|
const xdebug =
|
||||||
(await extensions.addExtension(extension, version, os_version, true)) +
|
(await extensions.addExtension(extension, version, os_version, true)) +
|
||||||
pipe;
|
pipe;
|
||||||
|
const ini = await config.addINIValues(
|
||||||
|
'xdebug.mode=coverage',
|
||||||
|
os_version,
|
||||||
|
true
|
||||||
|
);
|
||||||
const log = await utils.addLog(
|
const log = await utils.addLog(
|
||||||
'$tick',
|
'$tick',
|
||||||
extension,
|
extension,
|
||||||
'Xdebug enabled as coverage driver',
|
'Xdebug enabled as coverage driver',
|
||||||
os_version
|
os_version
|
||||||
);
|
);
|
||||||
return xdebug + '\n' + log;
|
switch (true) {
|
||||||
|
case /^xdebug3$/.test(extension):
|
||||||
|
case /^8\.\d$/.test(version):
|
||||||
|
return '\n' + xdebug + '\n' + ini + '\n' + log;
|
||||||
|
case /^xdebug$/.test(extension):
|
||||||
|
default:
|
||||||
|
return xdebug + '\n' + log;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,11 +152,8 @@ export async function addCoverage(
|
|||||||
case 'xdebug':
|
case 'xdebug':
|
||||||
case 'xdebug3':
|
case 'xdebug3':
|
||||||
return (
|
return (
|
||||||
script + (await addCoverageXdebug('xdebug', version, os_version, pipe))
|
script +
|
||||||
);
|
(await addCoverageXdebug(coverage_driver, version, os_version, pipe))
|
||||||
case 'xdebug2':
|
|
||||||
return (
|
|
||||||
script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
|
|
||||||
);
|
);
|
||||||
case 'none':
|
case 'none':
|
||||||
return script + (await disableCoverage(version, os_version, pipe));
|
return script + (await disableCoverage(version, os_version, pipe));
|
||||||
|
|||||||
+34
-38
@@ -22,17 +22,17 @@ export async function addExtensionDarwin(
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6couchbase...7.4couchbase
|
// match 5.6couchbase...7.4couchbase
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
@@ -43,9 +43,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -66,9 +64,11 @@ export async function addExtensionDarwin(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, protobuf, swoole and xdebug
|
// match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary
|
||||||
// match 7.1 to 8.9 for pcov
|
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|protobuf|swoole|xdebug)/.test(
|
// match 7.1pcov to 8.9pcov
|
||||||
|
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|igbinary)/.test(version_extension):
|
||||||
|
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
@@ -116,12 +116,12 @@ export async function addExtensionWindows(
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
break;
|
break;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
@@ -135,11 +135,11 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension',
|
'\nAdd-Extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
ext_version.replace('stable', '')
|
ext_version
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
@@ -163,10 +163,6 @@ export async function addExtensionWindows(
|
|||||||
matches[1]
|
matches[1]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match 7.2xdebug2 to 7.4xdebug2
|
|
||||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
|
||||||
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
|
||||||
break;
|
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
@@ -219,22 +215,24 @@ export async function addExtensionLinux(
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
case /^(5\.6|7\.[0-4]|8\.0)intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
version_extension
|
||||||
|
):
|
||||||
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
@@ -245,9 +243,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@@ -268,15 +264,15 @@ export async function addExtensionLinux(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug2...7.4xdebug2
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script +=
|
||||||
'\nadd_pecl_extension',
|
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
|
||||||
'xdebug',
|
|
||||||
'2.9.8',
|
|
||||||
ext_prefix
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
|
// match 8.0xdebug3...8.9xdebug3
|
||||||
|
case /^8\.[0-9]xdebug3$/.test(version_extension):
|
||||||
|
extension = 'xdebug';
|
||||||
|
break;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
|
|||||||
+9
-10
@@ -25,7 +25,10 @@ export async function getScript(
|
|||||||
const extension_csv: string = await utils.getInput('extensions', false);
|
const extension_csv: string = await utils.getInput('extensions', false);
|
||||||
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const tools_csv: string = await utils.getInput('tools', false);
|
let tools_csv: string = await utils.getInput('tools', false);
|
||||||
|
if (/.*-(beta|alpha|devel|snapshot|\d+\.\d+\.\d+).*/.test(extension_csv)) {
|
||||||
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
|
}
|
||||||
|
|
||||||
let script: string = await utils.readScript(filename);
|
let script: string = await utils.readScript(filename);
|
||||||
script += await tools.addTools(tools_csv, version, os_version);
|
script += await tools.addTools(tools_csv, version, os_version);
|
||||||
@@ -54,15 +57,11 @@ export async function run(): Promise<void> {
|
|||||||
const version: string = await utils.parseVersion(
|
const version: string = await utils.parseVersion(
|
||||||
await utils.getInput('php-version', true)
|
await utils.getInput('php-version', true)
|
||||||
);
|
);
|
||||||
if (version) {
|
const os_version: string = process.platform;
|
||||||
const os_version: string = process.platform;
|
const tool = await utils.scriptTool(os_version);
|
||||||
const tool = await utils.scriptTool(os_version);
|
const script = os_version + (await utils.scriptExtension(os_version));
|
||||||
const script = os_version + (await utils.scriptExtension(os_version));
|
const location = await getScript(script, version, os_version);
|
||||||
const location = await getScript(script, version, os_version);
|
await exec(await utils.joins(tool, location, version, __dirname));
|
||||||
await exec(await utils.joins(tool, location, version, __dirname));
|
|
||||||
} else {
|
|
||||||
core.setFailed('Unable to get the PHP version');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-31
@@ -2,10 +2,8 @@
|
|||||||
export tick="✓"
|
export tick="✓"
|
||||||
export cross="✗"
|
export cross="✗"
|
||||||
export curl_opts=(-sL)
|
export curl_opts=(-sL)
|
||||||
|
export nightly_versions="8.[0-1]"
|
||||||
export old_versions="5.[3-5]"
|
export old_versions="5.[3-5]"
|
||||||
export jit_versions="8.[0-9]"
|
|
||||||
export nightly_versions="8.[1-9]"
|
|
||||||
export xdebug3_versions="7.[2-4]|8.[0-9]"
|
|
||||||
export tool_path_dir="/usr/local/bin"
|
export tool_path_dir="/usr/local/bin"
|
||||||
export composer_bin="$HOME/.composer/vendor/bin"
|
export composer_bin="$HOME/.composer/vendor/bin"
|
||||||
export composer_json="$HOME/.composer/composer.json"
|
export composer_json="$HOME/.composer/composer.json"
|
||||||
@@ -77,7 +75,7 @@ run_script() {
|
|||||||
repo=$1
|
repo=$1
|
||||||
shift
|
shift
|
||||||
args=("$@")
|
args=("$@")
|
||||||
get -q -e /tmp/install.sh "$bintray/php/$repo.sh" "$github/$repo/$latest/install.sh"
|
get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$bintray/php/$repo.sh"
|
||||||
bash /tmp/install.sh "${args[@]}"
|
bash /tmp/install.sh "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,30 +103,19 @@ check_extension() {
|
|||||||
|
|
||||||
# Function to enable existing extensions.
|
# Function to enable existing extensions.
|
||||||
enable_extension() {
|
enable_extension() {
|
||||||
modules_dir="/var/lib/php/modules/$version"
|
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then
|
||||||
[ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
|
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
|
||||||
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
echo "$2=${ext_dir:?}/$1.so" >>"${pecl_file:-$ini_file}"
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# Function to configure PHP
|
|
||||||
configure_php() {
|
|
||||||
(
|
|
||||||
echo -e "date.timezone=UTC\nmemory_limit=-1"
|
|
||||||
[[ "$version" =~ $jit_versions ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235"
|
|
||||||
[[ "$version" =~ $xdebug3_versions ]] && echo -e "xdebug.mode=coverage"
|
|
||||||
) | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure PECL.
|
# Function to configure PECL.
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
if ! [ -e /tmp/pecl_config ]; then
|
if ! [ -e /tmp/pecl_config ] && command -v pecl >/dev/null; then
|
||||||
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
|
||||||
add_pecl >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}"
|
||||||
sudo "$script" channel-update "$script".php.net
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
||||||
@@ -138,12 +125,12 @@ configure_pecl() {
|
|||||||
# Function to get the PECL version of an extension.
|
# Function to get the PECL version of an extension.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
|
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
|
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
||||||
fi
|
fi
|
||||||
echo "$pecl_version"
|
echo "$pecl_version"
|
||||||
}
|
}
|
||||||
@@ -151,7 +138,6 @@ get_pecl_version() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
configure_pecl >/dev/null 2>&1
|
|
||||||
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,10 +176,10 @@ configure_composer() {
|
|||||||
add_log "$cross" "composer" "Could not download composer"
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
composer -q config -g process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
echo "$composer_bin" >> "$GITHUB_PATH"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
composer -q config -g github-oauth.github.com "$COMPOSER_TOKEN"
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,10 +189,6 @@ add_tool() {
|
|||||||
tool=$2
|
tool=$2
|
||||||
ver_param=$3
|
ver_param=$3
|
||||||
tool_path="$tool_path_dir/$tool"
|
tool_path="$tool_path_dir/$tool"
|
||||||
if ! [[ "$PATH" =~ $tool_path_dir ]] ; then
|
|
||||||
export PATH=$PATH:"$tool_path_dir"
|
|
||||||
echo "export PATH=\$PATH:$tool_path_dir" | sudo tee -a "$GITHUB_ENV" >/dev/null
|
|
||||||
fi
|
|
||||||
if [ ! -e "$tool_path" ]; then
|
if [ ! -e "$tool_path" ]; then
|
||||||
rm -rf "$tool_path"
|
rm -rf "$tool_path"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+15
-49
@@ -11,7 +11,7 @@ self_hosted_helper() {
|
|||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
sudo sed -i '' "/$extension/d" "${ini_file:?}"
|
||||||
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
||||||
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
||||||
add_log "${cross:?}" ":$extension" "Could not remove $extension on PHP ${semver:?}"
|
add_log "${cross:?}" ":$extension" "Could not remove $extension on PHP ${semver:?}"
|
||||||
@@ -39,47 +39,19 @@ add_pecl_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to fetch a brew tap
|
|
||||||
fetch_brew_tap() {
|
|
||||||
tap=$1
|
|
||||||
tap_user=$(dirname "$tap")
|
|
||||||
tap_name=$(basename "$tap")
|
|
||||||
mkdir -p "$tap_dir/$tap_user"
|
|
||||||
get -s -n "" "https://github.com/$tap/archive/master.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user"
|
|
||||||
if [ -d "$tap_dir/$tap_user/$tap_name-master" ]; then
|
|
||||||
sudo mv "$tap_dir/$tap_user/$tap_name-master" "$tap_dir/$tap_user/$tap_name"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to add a brew tap.
|
|
||||||
add_brew_tap() {
|
|
||||||
tap=$1
|
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
|
||||||
brew tap --shallow "$tap" >/dev/null 2>&1
|
|
||||||
else
|
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
|
||||||
brew tap --shallow "$tap" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install a php extension from shivammathur/extensions tap.
|
# Function to install a php extension from shivammathur/extensions tap.
|
||||||
add_brew_extension() {
|
add_brew_extension() {
|
||||||
formula=$1
|
extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
extension=${formula//[0-9]/}
|
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
add_brew_tap shivammathur/homebrew-php
|
if ! brew tap | grep -q shivammathur/extensions; then
|
||||||
add_brew_tap shivammathur/homebrew-extensions
|
brew tap --shallow shivammathur/extensions >/dev/null 2>&1
|
||||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$extension"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
fi
|
||||||
brew install "$formula@$version" >/dev/null 2>&1
|
brew install "$extension@$version" >/dev/null 2>&1
|
||||||
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
sudo cp "$(brew --prefix)/opt/$extension@$version/$extension.so" "$ext_dir"
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -113,28 +85,29 @@ add_pecl() {
|
|||||||
|
|
||||||
# Function to update dependencies.
|
# Function to update dependencies.
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
if [[ "$version" =~ ${nightly_versions:?} ]] && [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
if [[ "$version" =~ ${nightly_versions:?} ]] && [ "${runner:?}" != "self-hosted" ]; then
|
||||||
|
tap_dir="$(brew --prefix)/Homebrew/Library/Taps"
|
||||||
while read -r formula; do
|
while read -r formula; do
|
||||||
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
get -q -n "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb" &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
fi
|
fi
|
||||||
# Remove once commit with bottle syntax breaking change is in images
|
|
||||||
git -C "$brew_repo" pull origin master
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup PHP 5.6 and newer using Homebrew.
|
# Function to setup PHP 5.6 and newer using Homebrew.
|
||||||
add_php() {
|
add_php() {
|
||||||
action=$1
|
action=$1
|
||||||
add_brew_tap shivammathur/homebrew-php
|
if ! brew tap | grep -q shivammathur/php; then
|
||||||
|
brew tap --shallow shivammathur/php
|
||||||
|
fi
|
||||||
update_dependencies
|
update_dependencies
|
||||||
if ! [[ "$(find "$(brew --cellar)"/php/ -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]] && [ "$action" != "upgrade" ]; then
|
if ! [[ "$(find "$(brew --cellar)"/php/ -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]] && [ "$action" != "upgrade" ]; then
|
||||||
brew unlink shivammathur/php/php@"$version"
|
brew unlink shivammathur/php/php@"$version"
|
||||||
else
|
else
|
||||||
brew upgrade "shivammathur/php/php@$version" 2>/dev/null || brew install "shivammathur/php/php@$version"
|
brew upgrade "shivammathur/php/php@$version" 2>/dev/null || brew install "shivammathur/php/php@$version"
|
||||||
fi
|
fi
|
||||||
brew link --force --overwrite shivammathur/php/php@"$version"
|
brew link --force --overwrite php@"$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to Setup PHP
|
# Function to Setup PHP
|
||||||
@@ -155,15 +128,12 @@ setup_php() {
|
|||||||
fi
|
fi
|
||||||
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
sudo chmod 777 "$ini_file" "${tool_path_dir:?}"
|
sudo chmod 777 "$ini_file" "${tool_path_dir:?}"
|
||||||
configure_php
|
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
|
||||||
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||||
if [ "${semver%.*}" != "$version" ]; then
|
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
||||||
add_log "$cross" "PHP" "Could not setup PHP $version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
}
|
}
|
||||||
@@ -171,10 +141,6 @@ setup_php() {
|
|||||||
# Variables
|
# Variables
|
||||||
version=$1
|
version=$1
|
||||||
dist=$2
|
dist=$2
|
||||||
brew_prefix="$(brew --prefix)"
|
|
||||||
brew_repo="$(brew --repository)"
|
|
||||||
tap_dir="$brew_repo"/Library/Taps
|
|
||||||
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ add_blackfire() {
|
|||||||
no_dot_version=${version/./}
|
no_dot_version=${version/./}
|
||||||
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
blackfire_ini_file="${pecl_file:-${ini_file[@]}}"
|
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
if [ "$extension_version" = "blackfire" ]; then
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
extension_version=$(get -s -n "" https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ add_couchbase() {
|
|||||||
else
|
else
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-1] ]]; then
|
if [[ ${version:?} =~ 5.6|7.[0-1] ]]; then
|
||||||
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
pecl_install couchbase-2.6.2 >/dev/null 2>&1
|
||||||
elif [[ ${version:?} =~ 7.2 ]]; then
|
|
||||||
pecl_install couchbase-3.0.4 >/dev/null 2>&1
|
|
||||||
else
|
else
|
||||||
pecl_install couchbase >/dev/null 2>&1
|
pecl_install couchbase >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ set_cubrid_branch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_cubrid_helper() {
|
add_cubrid_helper() {
|
||||||
ext=$1
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
enable_extension "$ext" extension
|
|
||||||
if ! check_extension "$ext"; then
|
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
set_cubrid_repo
|
set_cubrid_repo
|
||||||
set_cubrid_branch
|
set_cubrid_branch
|
||||||
@@ -46,7 +44,7 @@ add_cubrid_helper() {
|
|||||||
add_cubrid() {
|
add_cubrid() {
|
||||||
ext=$1
|
ext=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
add_cubrid_helper "$ext" >/dev/null 2>&1
|
add_cubrid_helper >/dev/null 2>&1
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
# Helper function install geos library and headers
|
|
||||||
add_geos_libs() {
|
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
|
||||||
brew install geos
|
|
||||||
else
|
|
||||||
sudo apt-get install libgeos-dev
|
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
|
||||||
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake gcc g++
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Patch geos for PHP 7
|
|
||||||
patch_geos() {
|
|
||||||
if [ "$(php -r "echo PHP_VERSION_ID;")" -ge 70000 ]; then
|
|
||||||
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" /tmp/php-geos-"$geos_tag"/geos.c
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get geos source
|
|
||||||
get_geos() {
|
|
||||||
curl -o /tmp/geos.tar.gz -sL https://github.com/libgeos/php-geos/archive/"$geos_tag".tar.gz
|
|
||||||
tar -xzf /tmp/geos.tar.gz -C /tmp
|
|
||||||
patch_geos
|
|
||||||
}
|
|
||||||
|
|
||||||
# Helper function to compile and install geos
|
|
||||||
add_geos_helper() {
|
|
||||||
get_geos
|
|
||||||
(
|
|
||||||
cd /tmp/php-geos-"$geos_tag" || exit
|
|
||||||
phpize
|
|
||||||
./configure --enable-geos --with-geos-config="$(command -v geos-config)"
|
|
||||||
sudo make -j"$(nproc)"
|
|
||||||
sudo make install
|
|
||||||
enable_extension geos extension
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to add geos
|
|
||||||
add_geos() {
|
|
||||||
geos_tag='1.0.0'
|
|
||||||
add_geos_libs >/dev/null 2>&1
|
|
||||||
enable_extension "geos" "extension"
|
|
||||||
if check_extension "geos"; then
|
|
||||||
add_log "${tick:?}" "geos" "Enabled"
|
|
||||||
else
|
|
||||||
add_geos_helper >/dev/null 2>&1
|
|
||||||
add_extension_log "geos" "Installed and enabled"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
@@ -83,7 +83,7 @@ patch_pdo_oci_config() {
|
|||||||
add_dependencies() {
|
add_dependencies() {
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
${apt_install:?} --no-upgrade --no-install-recommends libaio-dev
|
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake libaio-dev gcc g++
|
||||||
fi
|
fi
|
||||||
! [[ ${version:?} =~ $nightly_versions ]] && add_devtools phpize
|
! [[ ${version:?} =~ $nightly_versions ]] && add_devtools phpize
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ add_phalcon_helper() {
|
|||||||
${apt_install:?} "php${version:?}-$extension"
|
${apt_install:?} "php${version:?}-$extension"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
phalcon_ini_file=${ini_file:?}
|
||||||
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
||||||
brew tap shivammathur/homebrew-phalcon
|
brew tap shivammathur/homebrew-phalcon
|
||||||
brew install phalcon@"${version:?}"_"$extension_major_version"
|
brew install phalcon@"${version:?}"_"$extension_major_version"
|
||||||
@@ -28,7 +29,7 @@ add_phalcon3() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
add_phalcon_helper
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add phalcon4.
|
# Function to add phalcon4.
|
||||||
@@ -49,7 +50,7 @@ add_phalcon4() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
add_phalcon_helper
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add phalcon.
|
# Function to add phalcon.
|
||||||
@@ -57,7 +58,7 @@ add_phalcon() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
status='Enabled'
|
status='Enabled'
|
||||||
os_name=$(uname -s)
|
os_name=$(uname -s)
|
||||||
phalcon_ini_file="${pecl_file:-${ini_file[@]}}"
|
phalcon_ini_file="${scan_dir:?}/50-phalcon.ini"
|
||||||
extension_major_version=${extension: -1}
|
extension_major_version=${extension: -1}
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
if [ "$extension_major_version" = "4" ]; then
|
||||||
add_phalcon4 >/dev/null 2>&1
|
add_phalcon4 >/dev/null 2>&1
|
||||||
|
|||||||
+23
-47
@@ -3,7 +3,7 @@ self_hosted_helper() {
|
|||||||
if ! command -v apt-fast >/dev/null; then
|
if ! command -v apt-fast >/dev/null; then
|
||||||
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
||||||
fi
|
fi
|
||||||
install_packages curl make software-properties-common unzip autoconf automake gcc g++
|
install_packages curl make software-properties-common unzip
|
||||||
add_ppa
|
add_ppa
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,20 +45,15 @@ install_packages() {
|
|||||||
$apt_install "${packages[@]}" >/dev/null 2>&1 || update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1
|
$apt_install "${packages[@]}" >/dev/null 2>&1 || update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable an extension.
|
# Function to delete extensions.
|
||||||
disable_extension() {
|
|
||||||
extension=$1
|
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file[@]}"
|
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?$/d" "$pecl_file"
|
|
||||||
sudo find "$ini_dir"/.. -name "*$extension.ini" -delete >/dev/null 2>&1 || true
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to delete an extension.
|
|
||||||
delete_extension() {
|
delete_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
disable_extension "$extension"
|
sudo sed -i "/$extension/d" "${ini_file:?}"
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo sed -i "/$extension/d" "${pecl_file:?}"
|
||||||
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
||||||
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
|
$apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to disable and delete extensions.
|
# Function to disable and delete extensions.
|
||||||
@@ -67,6 +62,7 @@ remove_extension() {
|
|||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||||
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
|
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
|
||||||
|
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
||||||
@@ -83,22 +79,14 @@ add_pdo_extension() {
|
|||||||
if check_extension "$pdo_ext"; then
|
if check_extension "$pdo_ext"; then
|
||||||
add_log "${tick:?}" "$pdo_ext" "Enabled"
|
add_log "${tick:?}" "$pdo_ext" "Enabled"
|
||||||
else
|
else
|
||||||
ext=$1
|
ext=$1; ext_name=$1;
|
||||||
ext_name=$1
|
sudo rm -rf "$scan_dir"/*pdo.ini >/dev/null 2>&1
|
||||||
disable_extension pdo
|
if ! check_extension "pdo" 2>/dev/null; then echo "extension=pdo.so" >>"$ini_file"; fi
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
|
||||||
if [ "$ext" = "mysql" ]; then
|
if [ "$ext" = "mysql" ]; then
|
||||||
enable_extension "mysqlnd" "extension"
|
enable_extension "mysqlnd" "extension"
|
||||||
ext_name='mysqli'
|
ext_name="mysqli"
|
||||||
elif [ "$ext" = "dblib" ]; then
|
|
||||||
ext_name="sybase"
|
|
||||||
elif [ "$ext" = "firebird" ]; then
|
|
||||||
install_packages libfbclient2 >/dev/null 2>&1
|
|
||||||
enable_extension "pdo_firebird" "extension"
|
|
||||||
ext_name="interbase"
|
|
||||||
elif [ "$ext" = "sqlite" ]; then
|
elif [ "$ext" = "sqlite" ]; then
|
||||||
ext="sqlite3"
|
ext="sqlite3"; ext_name="sqlite3";
|
||||||
ext_name="sqlite3"
|
|
||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
||||||
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
||||||
@@ -123,7 +111,7 @@ add_extension() {
|
|||||||
fi
|
fi
|
||||||
add_extension_log "$extension" "Installed and enabled"
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
fi
|
fi
|
||||||
sudo chmod 777 "${ini_file[@]}"
|
sudo chmod 777 "$ini_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a PECL version.
|
# Function to install a PECL version.
|
||||||
@@ -172,7 +160,9 @@ add_devtools() {
|
|||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
||||||
configure_pecl >/dev/null 2>&1
|
if command -v pecl >/dev/null; then
|
||||||
|
configure_pecl >/dev/null 2>&1
|
||||||
|
fi
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +174,7 @@ setup_nightly() {
|
|||||||
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
||||||
setup_old_versions() {
|
setup_old_versions() {
|
||||||
run_script "php5-ubuntu" "$version"
|
run_script "php5-ubuntu" "$version"
|
||||||
|
configure_pecl
|
||||||
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +194,7 @@ switch_version() {
|
|||||||
for tool in pear pecl php phar phar.phar php-cgi php-config phpize phpdbg; do
|
for tool in pear pecl php phar phar.phar php-cgi php-config phpize phpdbg; do
|
||||||
if [ -e "/usr/bin/$tool$version" ]; then
|
if [ -e "/usr/bin/$tool$version" ]; then
|
||||||
sudo update-alternatives --set $tool /usr/bin/"$tool$version" &
|
sudo update-alternatives --set $tool /usr/bin/"$tool$version" &
|
||||||
to_wait+=($!)
|
to_wait+=( $! )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
@@ -244,15 +235,6 @@ add_php() {
|
|||||||
status="Installed"
|
status="Installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to ini file for pear and link it to each SAPI.
|
|
||||||
link_pecl_file() {
|
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
|
||||||
for file in "${ini_file[@]}"; do
|
|
||||||
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
|
||||||
[ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ] && sudo ln -sf "$pecl_file" "$sapi_scan_dir/99-pecl.ini"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to Setup PHP
|
# Function to Setup PHP
|
||||||
setup_php() {
|
setup_php() {
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
@@ -277,20 +259,14 @@ setup_php() {
|
|||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if ! command -v php"$version" >/dev/null; then
|
|
||||||
add_log "$cross" "PHP" "Could not setup PHP $version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
semver=$(php_semver)
|
semver=$(php_semver)
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
ini_dir=$(php --ini | grep "(php.ini)" | sed -e "s|.*: s*||")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
pecl_file="$scan_dir"/99-pecl.ini
|
pecl_file="$scan_dir"/99-pecl.ini
|
||||||
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
|
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
||||||
link_pecl_file
|
|
||||||
configure_php
|
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
||||||
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
sudo chmod 777 "$ini_file" "$pecl_file" "${tool_path_dir:?}"
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "${tick:?}" "PHP" "$status PHP $semver"
|
add_log "${tick:?}" "PHP" "$status PHP $semver"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,49 +14,36 @@ add_bazel() {
|
|||||||
|
|
||||||
get_grpc_tag() {
|
get_grpc_tag() {
|
||||||
if [ "$grpc_tag" = "latest" ]; then
|
if [ "$grpc_tag" = "latest" ]; then
|
||||||
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
grpc_tag=$(get -s -n "" https://grpc.io/release)
|
||||||
else
|
else
|
||||||
if [[ ${grpc_tag:0:1} != "v" ]] ; then grpc_tag="v$grpc_tag"; fi
|
status_code=$(get -v -n /tmp/grpc.tmp "https://github.com/grpc/grpc/releases/tag/v$grpc_tag")
|
||||||
status_code=$(get -v -n /tmp/grpc.tmp "https://github.com/grpc/grpc/releases/tag/$grpc_tag")
|
if [ "$status_code" = "200" ]; then
|
||||||
if [ "$status_code" != "200" ]; then
|
grpc_tag="v$grpc_tag"
|
||||||
grpc_tag=$(get -s -n "" https://github.com/grpc/grpc/releases/latest | grep -Eo -m 1 "v[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
else
|
||||||
|
grpc_tag=$(get -s -n "" https://grpc.io/release)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_grpc_php_plugin_macos() {
|
|
||||||
brew install grpc
|
|
||||||
brew link --force --overwrite grpc >/dev/null 2>&1
|
|
||||||
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
|
||||||
license_path="$(brew --prefix grpc)/LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
add_grpc_php_plugin_linux() {
|
|
||||||
get_grpc_tag
|
|
||||||
get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
|
||||||
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
|
||||||
add_bazel
|
|
||||||
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
|
||||||
CC="$(command -v gcc)" CXX="$(command -v g++)" ./tools/bazel build src/compiler:grpc_php_plugin
|
|
||||||
else
|
|
||||||
./tools/bazel build src/compiler:grpc_php_plugin
|
|
||||||
fi
|
|
||||||
sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
|
|
||||||
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
|
||||||
license_path="/tmp/grpc-${grpc_tag:1}/LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
add_grpc_php_plugin() {
|
add_grpc_php_plugin() {
|
||||||
grpc_tag=$1
|
grpc_tag=$1
|
||||||
license_path=""
|
get_grpc_tag
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
(
|
||||||
add_grpc_php_plugin_macos >/dev/null 2>&1
|
get -s -n "" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
||||||
else
|
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
||||||
add_grpc_php_plugin_linux >/dev/null 2>&1
|
add_bazel
|
||||||
fi
|
[ "$(uname -s)" = "Darwin" ] && sudo xcode-select -s /Applications/Xcode_11.7.app
|
||||||
echo "::set-output name=grpc_php_plugin_path::$(command -v grpc_php_plugin)"
|
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||||
|
CC="$(command -v gcc)" CXX="$(command -v g++)" ./tools/bazel build src/compiler:grpc_php_plugin
|
||||||
|
else
|
||||||
|
./tools/bazel build src/compiler:grpc_php_plugin
|
||||||
|
fi
|
||||||
|
sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
|
||||||
|
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
||||||
|
) >/dev/null 2>&1
|
||||||
|
echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
cat "$license_path"
|
cat "/tmp/grpc-${grpc_tag:1}/LICENSE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-31
@@ -8,7 +8,10 @@ param (
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
[string]
|
[string]
|
||||||
$dist
|
$dist,
|
||||||
|
[Parameter(Position = 2, Mandatory = $false)]
|
||||||
|
[string]
|
||||||
|
$fail_fast = 'false'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to log start of a operation.
|
# Function to log start of a operation.
|
||||||
@@ -22,7 +25,7 @@ Function Add-Log($mark, $subject, $message) {
|
|||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
||||||
} else {
|
} else {
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
||||||
if($env:fail_fast -eq 'true') {
|
if($fail_fast -eq 'true') {
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,10 +204,10 @@ Function Edit-ComposerConfig() {
|
|||||||
Add-Log "$cross" "composer" "Could not download composer"
|
Add-Log "$cross" "composer" "Could not download composer"
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
composer -q config -g process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
composer -q config -g github-oauth.github.com $env:COMPOSER_TOKEN
|
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,12 +222,12 @@ Function Get-ToolVersion() {
|
|||||||
$version_regex = "[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-z0-9]+){0,1}"
|
$version_regex = "[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-z0-9]+){0,1}"
|
||||||
if($tool -eq 'composer') {
|
if($tool -eq 'composer') {
|
||||||
if ($param -eq 'snapshot') {
|
if ($param -eq 'snapshot') {
|
||||||
$composer_version = (Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }) + '+' + (Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value })
|
$trunk = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
||||||
|
$commit = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value }
|
||||||
|
return "$trunk+$commit"
|
||||||
} else {
|
} else {
|
||||||
$composer_version = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
return Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
||||||
}
|
}
|
||||||
Set-Variable -Name 'composer_version' -Value $composer_version -Scope Global
|
|
||||||
return "$composer_version"
|
|
||||||
}
|
}
|
||||||
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
|
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
|
||||||
}
|
}
|
||||||
@@ -307,11 +310,6 @@ Function Add-Composertool() {
|
|||||||
[string]
|
[string]
|
||||||
$prefix
|
$prefix
|
||||||
)
|
)
|
||||||
if($tool -match "prestissimo|composer-prefetcher" -and $composer_version.split('.')[0] -ne "1") {
|
|
||||||
Write-Output "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
|
|
||||||
Add-Log $cross $tool "Skipped"
|
|
||||||
Return
|
|
||||||
}
|
|
||||||
composer global require $prefix$release 2>&1 | out-null
|
composer global require $prefix$release 2>&1 | out-null
|
||||||
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
||||||
if(Test-Path $composer_bin\composer) {
|
if(Test-Path $composer_bin\composer) {
|
||||||
@@ -397,14 +395,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') {
|
if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
||||||
}
|
}
|
||||||
try {
|
if ($version -match $nightly_version) {
|
||||||
if ($version -match $nightly_version) {
|
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
||||||
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
||||||
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
} else {
|
||||||
} else {
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
}
|
||||||
}
|
|
||||||
} catch { }
|
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir >$null 2>&1
|
||||||
@@ -415,20 +411,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
}
|
}
|
||||||
|
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
if($installed.MajorMinorVersion -ne $version) {
|
('date.timezone=UTC', 'memory_limit=-1') | foreach { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
||||||
Add-Log $cross "PHP" "Could not setup PHP $version"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
('date.timezone=UTC', 'memory_limit=-1', 'xdebug.mode=coverage') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
|
||||||
} else {
|
} else {
|
||||||
$enable_extensions += ('opcache')
|
$enable_extensions += ('opcache')
|
||||||
}
|
}
|
||||||
# Patch till there is a pcov DLL for PHP 8.0 on pecl
|
|
||||||
if ($version -eq '8.0') {
|
|
||||||
Invoke-WebRequest -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$version`_$env:PHPTS`_$arch`_pcov.dll" -OutFile $php_dir"\ext\php`_pcov.dll"
|
|
||||||
}
|
|
||||||
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
|
|||||||
+5
-18
@@ -157,29 +157,12 @@ export async function getCodeceptionUri(
|
|||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
* @param php_version
|
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
export async function addPhive(
|
export async function addPhive(
|
||||||
version: string,
|
version: string,
|
||||||
php_version: string,
|
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
switch (true) {
|
|
||||||
case /5\.[3-5]/.test(php_version):
|
|
||||||
return await utils.addLog(
|
|
||||||
'$cross',
|
|
||||||
'phive',
|
|
||||||
'Phive is not supported on PHP ' + php_version,
|
|
||||||
os_version
|
|
||||||
);
|
|
||||||
case /5\.6|7\.0/.test(php_version):
|
|
||||||
version = version.replace('latest', '0.12.1');
|
|
||||||
break;
|
|
||||||
case /7\.1/.test(php_version):
|
|
||||||
version = version.replace('latest', '0.13.5');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
return (
|
return (
|
||||||
@@ -323,10 +306,14 @@ export async function getWpCliUrl(version: string): Promise<string> {
|
|||||||
export async function addComposer(tools_list: string[]): Promise<string[]> {
|
export async function addComposer(tools_list: string[]): Promise<string[]> {
|
||||||
const regex_any = /^composer($|:.*)/;
|
const regex_any = /^composer($|:.*)/;
|
||||||
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
||||||
|
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
|
||||||
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool));
|
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool));
|
||||||
let composer = 'composer';
|
let composer = 'composer';
|
||||||
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case regex_composer1_tools.test(tools_list.join(' ')):
|
||||||
|
composer = 'composer:1';
|
||||||
|
break;
|
||||||
case matches[0] == undefined:
|
case matches[0] == undefined:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -556,7 +543,7 @@ export async function addTools(
|
|||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case 'phive':
|
||||||
script += await addPhive(version, php_version, os_version);
|
script += await addPhive(version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-config':
|
case 'php-config':
|
||||||
case 'phpize':
|
case 'phpize':
|
||||||
|
|||||||
+18
-35
@@ -1,6 +1,4 @@
|
|||||||
import {IncomingMessage} from 'http';
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as https from 'https';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
@@ -43,35 +41,15 @@ export async function getInput(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to fetch an URL
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
*/
|
|
||||||
export async function fetch(url: string): Promise<string> {
|
|
||||||
const fetch_promise: Promise<string> = new Promise(resolve => {
|
|
||||||
const req = https.get(url, (res: IncomingMessage) => {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
let body = '';
|
|
||||||
res.on('data', chunk => (body += chunk));
|
|
||||||
res.on('end', () => resolve(body));
|
|
||||||
});
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
return await fetch_promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to parse PHP version.
|
* Function to parse PHP version.
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
export async function parseVersion(version: string): Promise<string> {
|
export async function parseVersion(version: string): Promise<string> {
|
||||||
const manifest =
|
switch (version) {
|
||||||
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
case 'latest':
|
||||||
switch (true) {
|
return '7.4';
|
||||||
case /latest|\d.x/.test(version):
|
|
||||||
return JSON.parse(await fetch(manifest))[version];
|
|
||||||
default:
|
default:
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case version.length > 1:
|
case version.length > 1:
|
||||||
@@ -250,7 +228,8 @@ export async function extensionArray(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/^php[-_]/, '');
|
.replace('php-', '')
|
||||||
|
.replace('php_', '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -269,12 +248,9 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
|
|||||||
return [];
|
return [];
|
||||||
default:
|
default:
|
||||||
return values_csv
|
return values_csv
|
||||||
.split(/,(?=(?:(?:[^"']*["']){2})*[^"']*$)/)
|
.split(',')
|
||||||
.map(function (value) {
|
.map(function (value: string) {
|
||||||
return value
|
return value.trim();
|
||||||
.trim()
|
|
||||||
.replace(/^["']|["']$|(?<==)["']/g, '')
|
|
||||||
.replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'");
|
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -286,11 +262,18 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
|
|||||||
* @param extension
|
* @param extension
|
||||||
*/
|
*/
|
||||||
export async function getExtensionPrefix(extension: string): Promise<string> {
|
export async function getExtensionPrefix(extension: string): Promise<string> {
|
||||||
switch (true) {
|
const zend: Array<string> = [
|
||||||
|
'xdebug',
|
||||||
|
'xdebug3',
|
||||||
|
'opcache',
|
||||||
|
'ioncube',
|
||||||
|
'eaccelerator'
|
||||||
|
];
|
||||||
|
switch (zend.indexOf(extension)) {
|
||||||
default:
|
default:
|
||||||
return 'extension';
|
|
||||||
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
|
||||||
return 'zend_extension';
|
return 'zend_extension';
|
||||||
|
case -1:
|
||||||
|
return 'extension';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user