Merge pull request #313 from shivammathur/develop

2.7.0
This commit is contained in:
Shivam Mathur 2020-10-19 18:26:33 +05:30 committed by GitHub
commit 3c0527bec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 963 additions and 695 deletions

View File

@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
env:
extensions: xml, opcache, xdebug, pcov
key: cache-v3

135
README.md
View File

@ -18,7 +18,7 @@
<a href="https://setup-php.statuspage.io/" title="setup-php status"><img alt="setup-php status" src="https://img.shields.io/badge/status-subscribe-28A745?logo=statuspage&logoColor=28A745&labelColor=555555"></a>
</p>
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to set up the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
## Contents
@ -34,6 +34,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
- [Disable Coverage](#disable-coverage)
- [Usage](#memo-usage)
- [Inputs](#inputs)
- [Flags](#flags)
- [Basic Setup](#basic-setup)
- [Matrix Setup](#matrix-setup)
- [Nightly Build Setup](#nightly-build-setup)
@ -69,12 +70,14 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|`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.
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT`, `Union Types v2` and other [new features](https://wiki.php.net/rfc#php_80 "New features implemented in PHP 8"). See [nightly build setup](#nightly-build-setup) for more information.
## :cloud: OS/Platform Support
Both `GitHub-hosted` runners and `self-hosted` runners are supported on the following operating systems.
The action supports both `GitHub-hosted` runners and `self-hosted` runners on the following operating systems.
### GitHub-Hosted Runners
@ -85,6 +88,7 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
|Ubuntu 20.04|`ubuntu-20.04`|`PHP 7.4`|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 7.4`|
|macOS Catalina 10.15|`macos-latest` or `macos-10.15`|`PHP 7.4`|
|macOS Big Sur 11.0|`macos-11.0`|`PHP 7.4`|
### Self-Hosted Runners
@ -96,6 +100,7 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
|Windows 7 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 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.
@ -160,10 +165,20 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
extensions: intl-67.1
```
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `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`.
```yaml
- name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: oci8
env:
fail-fast: true
```
## :wrench: Tools Support
These tools can be setup globally using the `tools` input.
@ -178,8 +193,7 @@ These tools can be setup globally using the `tools` input.
tools: php-cs-fixer, phpunit
```
To setup a particular version of a tool, specify it in the form `tool:version`.
Latest stable version of `composer` is setup by default. You can setup the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
- To set up a particular version of a tool, specify it in the form `tool:version`. The latest stable version of `composer` is set up by default. You can set up the required version by specifying `v1`, `v2`, `snapshot` or `preview` as version.
```yaml
- name: Setup PHP with composer v2
@ -189,11 +203,9 @@ Latest stable version of `composer` is setup by default. You can setup the requi
tools: composer:v2
```
Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
- 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.
Version for other tools should be in `semver` format and a valid release of the tool.
This is useful for installing tools for older versions of PHP.
For example to setup `PHPUnit` on `PHP 7.2`.
- Version for other tools should be in `semver` format and a valid release of the tool. This is useful for installing tools for older versions of PHP. For example to set up `PHPUnit` on `PHP 7.2`.
```yaml
- name: Setup PHP with tools
@ -203,10 +215,22 @@ For example to setup `PHPUnit` on `PHP 7.2`.
tools: phpunit:8.5.8
```
- By default, tools which cannot be set up 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`.
```yaml
- name: Setup PHP with fail-fast
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: deployer
env:
fail-fast: true
```
**Notes**
- This is useful to set up tools which you only use in GitHub Actions, thus keeping your `composer.json` tidy.
- If you have a tool in your `composer.json`, do not setup it globally using this action as the two instances of the tool might conflict.
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
- Input `tools` is useful to set up tools which you only use in GitHub Actions, thus keeping your `composer.json` tidy.
- If you do not want to use all your dev-dependencies in GitHub Actions workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
- If you have a tool in your `composer.json`, do not setup it with `tools` input as the two instances of the tool might conflict.
## :signal_strength: Coverage Support
@ -272,9 +296,11 @@ Consider disabling the coverage using this PHP action for these reasons.
### Inputs
> Specify using `with` keyword
#### `php-version` (required)
- Specify the PHP version you want to setup.
- Specify the PHP version you want to set up.
- Accepts a `string`. For example `'7.4'`.
- Accepts `latest` to set up the latest stable PHP version.
- See [PHP support](#tada-php-support) for supported PHP versions.
@ -293,16 +319,41 @@ Consider disabling the coverage using this PHP action for these reasons.
#### `coverage` (optional)
- Specify the code coverage driver you want to setup.
- Specify the code coverage driver you want to set up.
- Accepts `xdebug`, `pcov` or `none`.
- See [coverage support](#signal_strength-coverage-support) for more info.
#### `tools` (optional)
- Specify the tools you want to setup.
- Accepts a `string` in csv-format. For example `phpunit, phpcs`
- Specify the tools you want to set up.
- Accepts a `string` in csv-format. For example: `phpunit, phpcs`
- See [tools Support](#wrench-tools-support) for tools supported.
### Flags
> Specify using `env` keyword
#### `fail-fast` (optional)
- Specify to mark the workflow as failed if an extension or tool fails to set up.
- This changes the default mode from graceful warnings to fail-fast.
- By default, it is set to `false`.
- Accepts `true` and `false`.
#### `phpts` (optional)
- Specify to set up thread-safe version of PHP on windows.
- Accepts `ts` and `nts`.
- By default, it is set to `nts`.
- See [thread safe setup](#thread-safe-setup) for more info.
#### `update` (optional)
- Specify to update PHP on the runner to the latest patch version.
- Accepts `true` and `false`.
- By default, it is set to `false`.
- See [force update](#force-update) for more info.
See below for more info.
### Basic Setup
@ -353,13 +404,13 @@ jobs:
### Nightly Build Setup
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
> Setup a nightly build of `PHP 8.0` or `PHP 8.1`.
- This version is currently in development.
- `PECL` is installed by default with this version on `ubuntu` and `macOS`.
- Some user space extensions might not support this version currently.
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on this version.
- Refer to this [list of RFCs](https://wiki.php.net/rfc#php_80 "List of RFCs implemented in PHP8") implemented in this version.
- 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:
@ -369,7 +420,7 @@ steps:
- name: Setup nightly PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.1'
extensions: mbstring
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
coverage: pcov
@ -380,8 +431,8 @@ steps:
> Setup PHP on a self-hosted runner.
- To setup a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to setup in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to setup in a `Windows` container.
- To setup the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
- To set up a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to set up in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to set up in a `Windows` container.
- To set up the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
- If your workflow uses [services](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then setup the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
@ -407,7 +458,7 @@ jobs:
```
**Notes**
- Do not setup multiple self-hosted runners on the a single server instance as parallel workflow will conflict with each other.
- Do not setup multiple self-hosted runners on a single server instance as parallel workflow will conflict with each other.
- Do not setup self-hosted runners on the side on your development environment or your production server.
### Local Testing Setup
@ -447,7 +498,7 @@ act -P ubuntu-16.04=shivammathur/node:xenial
### Thread Safe Setup
> Setup both `TS` and `NTS` PHP on `Windows`.
> Setup `TS` or `NTS` PHP on `Windows`.
- `NTS` versions are setup by default.
- On `Ubuntu` and `macOS` only `NTS` versions are supported.
@ -472,7 +523,7 @@ jobs:
### Force Update
> Update to latest patch of PHP versions.
> 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.
@ -501,12 +552,12 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
### Cache Extensions
You can cache PHP extensions using `shivammathur/cache-extensions` and `action/cache` GitHub Actions. Extensions which take very long to setup when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
You can cache PHP extensions using `shivammathur/cache-extensions` and `action/cache` GitHub Actions. Extensions which take very long to set up when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
Refer to [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") for details.
### Cache Composer Dependencies
If your project uses composer, you can persist composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
If your project uses composer, you can persist the composer's internal cache directory. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
```yaml
- name: Get composer cache directory
@ -525,7 +576,7 @@ If your project uses composer, you can persist composer's internal cache directo
```
**Notes**
- Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
- Please do not cache `vendor` directory using `action/cache` as that will have side effects.
- In the above example, if you support a range of `composer` dependencies and do not commit `composer.lock`, you can use the hash of `composer.json` as the key for your cache.
```yaml
@ -534,7 +585,7 @@ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
### Cache Node.js Dependencies
If your project has node.js dependencies, you can persist npm's or yarn's cache directory. The cached files are available across check-runs and will reduce the workflow execution time.
If your project has node.js dependencies, you can persist NPM or yarn cache directory. The cached files are available across check-runs and will reduce the workflow execution time.
```yaml
- name: Get node.js cache directory
@ -549,7 +600,7 @@ If your project has node.js dependencies, you can persist npm's or yarn's cache
restore-keys: ${{ runner.os }}-node-
```
**Note:** Please do not cache `node_modules` directory as that will have side-effects.
**Note:** Please do not cache `node_modules` directory as that will have side effects.
### Composer GitHub OAuth
@ -566,7 +617,7 @@ If you have a number of workflows which setup multiple tools or have many compos
### Problem Matchers
Problem matchers are `json` configurations which identify errors and warnings in your logs and surface that information prominently in the GitHub Actions UI by highlighting them and creating code annotations.
Problem matchers are `json` configurations which identify errors and warnings in your logs and surface them prominently in the GitHub Actions UI by highlighting them and creating code annotations.
#### PHP
@ -588,7 +639,7 @@ Setup problem matchers for your `PHPUnit` output by adding this step after the `
#### PHPStan
PHPStan supports error reporting in GitHub Actions, so no problem matchers are required.
PHPStan supports error reporting in GitHub Actions, so it does not require problem matchers.
```yaml
- name: Setup PHP
@ -666,15 +717,15 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
## :bookmark: Versioning
- It is highly recommended to use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with latest minor and patch releases. With `v2` you automatically get the bug fixes, new features and support for latest PHP releases. For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- Use the `v2` tag as `setup-php` version. It is a rolling tag and is synced with the latest minor and patch releases. With `v2` you automatically get the bug fixes, new features and support for latest PHP releases. For debugging any issues `verbose` tag can be used temporarily. It outputs all the logs and is also synced with the latest releases.
- Semantic release versions can also be used. It is recommended to [use dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot "Setup Dependabot with GitHub Actions") with semantic versioning to keep the actions in your workflows up to date.
- Commit SHA can also be used, but are not recommended. They have to be updated with every release manually, without which you will not get any bug fixes or new features.
- Using the `master` branch as version is highly discouraged, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, it is recommended that you [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
- It is highly discouraged to use the `master` branch as version, it might break your workflow after major releases as they have breaking changes.
- If you are using the `v1` tag or a `1.x.y` version, you should [switch to v2](https://github.com/shivammathur/setup-php/wiki/Switch-to-v2 "Guide for switching from setup-php v1 to v2") as `v1` only gets critical bug fixes. Maintenance support for `v1` will be dropped with the last `PHP 8.0` release.
## :scroll: License
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
- The scripts and documentation in this project are under the [MIT License](LICENSE "License for shivammathur/setup-php").
- This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
@ -689,7 +740,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
<p align="center">
<a href="https://github.com/shivammathur/setup-php/graphs/contributors">
<img src="https://opencollective.com/setup-php/contributors.svg?width=1024&button=false" alt="setup-php contributers" width="100%">
<img src="https://opencollective.com/setup-php/contributors.svg?width=1024&button=false" alt="setup-php contributors" width="100%">
</a>
</p>

View File

@ -53,6 +53,18 @@ describe('Config tests', () => {
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 () => {
const darwin: string = await coverage.addCoverage(
'xdebug',

View File

@ -70,7 +70,7 @@ describe('Extension tests', () => {
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
);
expect(linux).toContain('remove_extension intl');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-ast');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-ast');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php-uopz');
expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pdo_extension mysql');
@ -129,13 +129,15 @@ describe('Extension tests', () => {
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'Xdebug, pcov, grpc, 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',
'darwin'
);
expect(darwin).toContain('add_brew_extension xdebug');
expect(darwin).toContain('add_brew_extension pcov');
expect(darwin).toContain('add_brew_extension grpc');
expect(darwin).toContain('add_brew_extension igbinary');
expect(darwin).toContain('add_brew_extension imagick');
expect(darwin).toContain('add_brew_extension protobuf');
expect(darwin).toContain('add_brew_extension swoole');
expect(darwin).toContain('pecl_install sqlite3');
@ -179,11 +181,7 @@ describe('Extension tests', () => {
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('pecl_install redis');
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('pecl_install imagick');
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
darwin = await extensions.addExtension('imagick', '5.5', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('pecl_install imagick');

View File

@ -165,5 +165,11 @@ describe('Install', () => {
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 8.0 ' + __dirname);
setEnv(8.1, 'darwin', '', '', '', '');
script = '' + (await install.run());
expect(script).toContain('initial script');
expect(script).toContain('bash darwin.sh 8.1 ' + __dirname);
});
});

View File

@ -349,12 +349,12 @@ describe('Tools tests', () => {
script = await tools.addDevTools('phpize', 'win32');
expect(script).toContain(
'Add-Log "$cross" "phpize" "phpize is not a windows tool"'
'Add-Log "$tick" "phpize" "phpize is not a windows tool"'
);
script = await tools.addDevTools('php-config', 'win32');
expect(script).toContain(
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
'Add-Log "$tick" "php-config" "php-config is not a windows tool"'
);
script = await tools.addDevTools('tool', 'openbsd');

39
dist/index.js vendored
View File

@ -2084,7 +2084,7 @@ async function addDevTools(tool, os_version) {
case 'darwin':
return 'add_devtools ' + tool;
case 'win32':
return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
return await utils.addLog('$tick', tool, tool + ' is not a windows tool', 'win32');
default:
return await utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
@ -2314,7 +2314,7 @@ async function addCoverageXdebug(extension, version, os_version, pipe) {
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
switch (true) {
case /^xdebug3$/.test(extension):
case /^8\.0$/.test(version):
case /^8\.\d$/.test(version):
return '\n' + xdebug + '\n' + ini + '\n' + log;
case /^xdebug$/.test(extension):
default:
@ -2583,7 +2583,8 @@ async function run() {
const tool = await utils.scriptTool(os_version);
const script = os_version + (await utils.scriptExtension(os_version));
const location = await getScript(script, version, os_version);
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
const fail_fast = await utils.readEnv('fail-fast');
await exec_1.exec(await utils.joins(tool, location, version, __dirname, fail_fast));
}
catch (error) {
core.setFailed(error.message);
@ -2862,7 +2863,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
@ -2884,11 +2885,11 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
return;
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
// match 7.1pcov to 8.0pcov
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
// match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
// 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):
command = 'add_brew_extension ' + ext_name;
break;
@ -2896,8 +2897,8 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
case /5\.6redis/.test(version_extension):
command = command_prefix + 'redis-2.2.8';
break;
// match imagick
case /^imagick$/.test(extension):
// match 5.4imagick and 5.5imagick
case /^5\.[4-5]imagick$/.test(version_extension):
command = await utils.joins('brew install pkg-config imagemagick' + pipe, '&& ' + command_prefix + 'imagick' + pipe);
break;
// match sqlite
@ -2934,7 +2935,7 @@ async function addExtensionWindows(extension_csv, version) {
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
break;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
@ -2968,9 +2969,9 @@ async function addExtensionWindows(extension_csv, version) {
add_script +=
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match 7.0mysql..8.0mysql
// match 7.0mysqli..8.0mysqli
// match 7.0mysqlnd..8.0mysqlnd
// match 7.0mysql..8.9mysql
// match 7.0mysqli..8.9mysqli
// match 7.0mysqlnd..8.9mysqlnd
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
@ -3010,7 +3011,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// 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 pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
@ -3042,7 +3043,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
add_script +=
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
return;
// match 8.0xdebug3
// match 8.0xdebug3...8.9xdebug3
case /^8\.[0-9]xdebug3$/.test(version_extension):
extension = 'xdebug';
command = command_prefix + version + '-' + extension + pipe;
@ -3052,8 +3053,8 @@ async function addExtensionLinux(extension_csv, version, pipe) {
extension = extension.replace(/pdo[_-]|3/, '');
add_script += '\nadd_pdo_extension ' + extension;
return;
// match ast and uopz
case /^(ast|uopz)$/.test(extension):
// match uopz
case /^(uopz)$/.test(extension):
command = command_prefix + '-' + extension + pipe;
break;
// match sqlite

1290
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.6.0",
"version": "2.7.0",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
@ -31,18 +31,18 @@
},
"devDependencies": {
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"@types/node": "^14.11.10",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"@zeit/ncc": "^0.22.3",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.13.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.3.0",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"jest": "^26.6.0",
"jest-circus": "^26.6.0",
"prettier": "^2.1.2",
"ts-jest": "^26.4.1",
"typescript": "^4.0.3"

View File

@ -32,7 +32,7 @@ export async function addCoverageXdebug(
);
switch (true) {
case /^xdebug3$/.test(extension):
case /^8\.0$/.test(version):
case /^8\.\d$/.test(version):
return '\n' + xdebug + '\n' + ini + '\n' + log;
case /^xdebug$/.test(extension):
default:

View File

@ -27,7 +27,7 @@ export async function addExtensionDarwin(
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
@ -66,11 +66,13 @@ export async function addExtensionDarwin(
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
return;
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
// match 7.1pcov to 8.0pcov
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
// match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
// 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):
command = 'add_brew_extension ' + ext_name;
break;
@ -78,8 +80,8 @@ export async function addExtensionDarwin(
case /5\.6redis/.test(version_extension):
command = command_prefix + 'redis-2.2.8';
break;
// match imagick
case /^imagick$/.test(extension):
// match 5.4imagick and 5.5imagick
case /^5\.[4-5]imagick$/.test(version_extension):
command = await utils.joins(
'brew install pkg-config imagemagick' + pipe,
'&& ' + command_prefix + 'imagick' + pipe
@ -127,7 +129,7 @@ export async function addExtensionWindows(
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
break;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
@ -186,9 +188,9 @@ export async function addExtensionWindows(
add_script +=
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
// match 7.0mysql..8.0mysql
// match 7.0mysqli..8.0mysqli
// match 7.0mysqlnd..8.0mysqlnd
// match 7.0mysql..8.9mysql
// match 7.0mysqli..8.9mysqli
// match 7.0mysqlnd..8.9mysqlnd
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
break;
@ -232,7 +234,7 @@ export async function addExtensionLinux(
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// 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 pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
@ -285,7 +287,7 @@ export async function addExtensionLinux(
add_script +=
'\nadd_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension';
return;
// match 8.0xdebug3
// match 8.0xdebug3...8.9xdebug3
case /^8\.[0-9]xdebug3$/.test(version_extension):
extension = 'xdebug';
command = command_prefix + version + '-' + extension + pipe;
@ -295,8 +297,8 @@ export async function addExtensionLinux(
extension = extension.replace(/pdo[_-]|3/, '');
add_script += '\nadd_pdo_extension ' + extension;
return;
// match ast and uopz
case /^(ast|uopz)$/.test(extension):
// match uopz
case /^(uopz)$/.test(extension):
command = command_prefix + '-' + extension + pipe;
break;
// match sqlite

View File

@ -60,7 +60,10 @@ export async function run(): Promise<void> {
const tool = await utils.scriptTool(os_version);
const script = os_version + (await utils.scriptExtension(os_version));
const location = await getScript(script, version, os_version);
await exec(await utils.joins(tool, location, version, __dirname));
const fail_fast = await utils.readEnv('fail-fast');
await exec(
await utils.joins(tool, location, version, __dirname, fail_fast)
);
} catch (error) {
core.setFailed(error.message);
}

View File

@ -13,6 +13,7 @@ add_log() {
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
[ "$fail_fast" = "true" ] && exit 1;
fi
}
@ -67,7 +68,7 @@ check_extension() {
fi
}
# Fuction to get the PECL version.
# Function to get the PECL version.
get_pecl_version() {
extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
@ -224,7 +225,7 @@ add_composertool() {
prefix=$3
(
composer global require "$prefix$release" >/dev/null 2>&1 &&
json=$(grep "$prefix$tool" /Users/$USER/.composer/composer.json) &&
json=$(grep "$prefix$tool" /Users/"$USER"/.composer/composer.json) &&
tool_version=$(get_tool_version 'echo' "$json") &&
add_log "$tick" "$tool" "Added $tool $tool_version"
) || add_log "$cross" "$tool" "Could not setup $tool"
@ -268,6 +269,7 @@ tick="✓"
cross="✗"
version=$1
dist=$2
fail_fast=$3
nodot_version=${1/./}
old_versions="5.[3-5]"
tool_path_dir="/usr/local/bin"
@ -306,5 +308,5 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo mkdir -p "$ext_dir"
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -9,10 +9,11 @@ add_license_log() {
# Function to get the tag for a php version.
get_tag() {
master_version='8.0'
tag='master'
if [ ! "${version:?}" = "$master_version" ]; then
if ! [[ ${version:?} =~ $nightly_versions ]]; then
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
elif [ "${version:?}" = '8.0' ]; then
tag="PHP-8.0"
fi
echo "$tag"
}
@ -72,18 +73,23 @@ restore_phpize() {
# Function to patch pdo_oci.
patch_pdo_oci_config() {
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/master/ext/pdo_oci/config.m4
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
if [[ ${version:?} =~ 5.[3-6] ]]; then
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
fi
}
# Function to install the dependencies.
add_dependencies() {
if [ "$os" = 'Linux' ]; then
if [ "${runner:?}" = "self-hosted" ]; then
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
if ! [[ ${version:?} =~ $nightly_versions ]]; then
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake libaio-dev gcc g++ php"$version"-dev
else
update_lists
${apt_install:?} php"$version"-dev
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake libaio-dev gcc g++
fi
else
! [[ ${version:?} =~ $nightly_versions ]] && update_lists && ${apt_install:?} --no-upgrade --no-install-recommends php"$version"-dev
fi
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
@ -117,6 +123,7 @@ add_oci() {
oracle_home='/opt/oracle'
oracle_client=$oracle_home/instantclient
os=$(uname -s)
nightly_versions='8.[0-1]'
add_client >/dev/null 2>&1
add_dependencies >/dev/null 2>&1
add_oci_helper >/dev/null 2>&1

View File

@ -3,7 +3,11 @@ add_phalcon_helper() {
status='Installed and enabled'
if [ "$os_name" = "Linux" ]; then
update_lists
if [ "$extension" = "phalcon4" ]; then
${apt_install:?} "php${version:?}-psr" "php${version:?}-$extension"
else
${apt_install:?} "php${version:?}-$extension"
fi
else
phalcon_ini_file=${ini_file:?}
sed -i '' '/extension.*psr/d' "${ini_file:?}"

View File

@ -13,6 +13,7 @@ add_log() {
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
[ "$fail_fast" = "true" ] && exit 1;
fi
}
@ -42,7 +43,7 @@ cleanup_lists() {
sudo mkdir /etc/apt/sources.list.d
sudo mv /etc/apt/sources.list.d.save/*ondrej*.list /etc/apt/sources.list.d/
sudo mv /etc/apt/sources.list.d.save/*dotdeb*.list /etc/apt/sources.list.d/ 2>/dev/null || true
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/" exit
trap "sudo mv /etc/apt/sources.list.d.save/*.list /etc/apt/sources.list.d/ 2>/dev/null" exit
fi
}
@ -69,7 +70,6 @@ update_lists() {
# Function to setup environment for self-hosted runners.
self_hosted_setup() {
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
fi
@ -89,7 +89,7 @@ configure_pecl() {
fi
}
# Fuction to get the PECL version of an extension.
# Function to get the PECL version of an extension.
get_pecl_version() {
extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
@ -153,7 +153,7 @@ enable_extension() {
fi
}
# Funcion to add PDO extension.
# Function to add PDO extension.
add_pdo_extension() {
pdo_ext="pdo_$1"
if check_extension "$pdo_ext"; then
@ -322,7 +322,7 @@ add_composertool() {
prefix=$3
(
composer global require "$prefix$release" >/dev/null 2>&1 &&
json=$(grep "$prefix$tool" /home/$USER/.composer/composer.json) &&
json=$(grep "$prefix$tool" /home/"$USER"/.composer/composer.json) &&
tool_version=$(get_tool_version 'echo' "$json") &&
add_log "$tick" "$tool" "Added $tool $tool_version"
) || add_log "$cross" "$tool" "Could not setup $tool"
@ -340,9 +340,9 @@ add_devtools() {
add_log "$tick" "$tool" "Added $tool $semver"
}
# Function to setup the nightly build from master branch.
setup_master() {
curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner"
# Function to setup the nightly build from shivammathur/php-builder
setup_nightly() {
curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner" "$version"
}
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
@ -374,7 +374,7 @@ switch_version() {
# Function to get PHP version in semver format.
php_semver() {
if [ ! "$version" = "$master_version" ]; then
if ! [[ "$version" =~ $nightly_versions ]]; then
php"$version" -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-'
else
php -v | head -n 1 | cut -f 2 -d ' '
@ -407,8 +407,8 @@ update_php() {
# Function to install PHP.
add_php() {
if [ "$version" = "$master_version" ]; then
setup_master
if [[ "$version" =~ $nightly_versions ]]; then
setup_nightly
elif [[ "$version" =~ $old_versions ]]; then
setup_old_versions
else
@ -423,12 +423,13 @@ cross="✗"
pecl_config="false"
version=$1
dist=$2
master_version="8.0"
fail_fast=$3
nightly_versions="8.[0-1]"
old_versions="5.[3-5]"
debconf_fix="DEBIAN_FRONTEND=noninteractive"
github="https://github.com/shivammathur"
apt_install="sudo $debconf_fix apt-fast install -y"
apt_remove="sudo $debconf_fix apt-fast remove -y"
apt_install="sudo $debconf_fix apt-get install -y"
apt_remove="sudo $debconf_fix apt-get remove -y"
tool_path_dir="/usr/local/bin"
curl_opts=(-sL)
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
@ -464,7 +465,7 @@ else
update_php >/dev/null 2>&1
else
status="Found"
if [ "$version" = "$master_version" ]; then
if [[ "$version" =~ $nightly_versions ]]; then
switch_version >/dev/null 2>&1
fi
fi
@ -478,5 +479,5 @@ pecl_file="$scan_dir"/99-pecl.ini
echo '' | sudo tee "$pecl_file" >/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 mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -8,7 +8,10 @@ param (
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$dist
$dist,
[Parameter(Position = 2, Mandatory = $false)]
[string]
$fail_fast = 'false'
)
# Function to log start of a operation.
@ -18,8 +21,14 @@ Function Step-Log($message) {
# Function to log result of a operation.
Function Add-Log($mark, $subject, $message) {
$code = if ($mark -eq $cross) { "31" } else { "32" }
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message
if ($mark -eq $tick) {
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
} else {
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
if($fail_fast -eq 'true') {
exit 1;
}
}
}
# Function to add a line to a powershell profile safely.
@ -91,9 +100,8 @@ Function Get-CleanPSProfile {
Function Install-PhpManager() {
$module_path = "$bin_dir\PhpManager\PhpManager.psm1"
if(-not (Test-Path $module_path -PathType Leaf)) {
$release = Invoke-RestMethod https://api.github.com/repos/mlocati/powershell-phpmanager/releases/latest
$zip_file = "$bin_dir\PhpManager.zip"
Invoke-WebRequest -UseBasicParsing -Uri $release.assets[0].browser_download_url -OutFile $zip_file
Invoke-WebRequest -UseBasicParsing -Uri 'https://github.com/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip' -OutFile $zip_file
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
}
Import-Module $module_path
@ -310,7 +318,7 @@ $ext_dir = "$php_dir\ext"
$bin_dir = $php_dir
$current_profile = "$env:TEMP\setup-php.ps1"
$ProgressPreference = 'SilentlyContinue'
$master_version = '8.0'
$nightly_version = '8.[0-9]'
$cert_source='CurrentUser'
$arch = 'x64'
@ -365,10 +373,9 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') {
Install-Module -Name VcRedist -Force
}
if ($version -eq $master_version) {
$version = 'master'
Invoke-WebRequest -UseBasicParsing -Uri https://dl.bintray.com/shivammathur/php/Install-PhpMaster.ps1 -OutFile $php_dir\Install-PhpMaster.ps1 > $null 2>&1
& $php_dir\Install-PhpMaster.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir
if ($version -match $nightly_version) {
Invoke-WebRequest -UseBasicParsing -Uri https://dl.bintray.com/shivammathur/php/Install-PhpNightly.ps1 -OutFile $php_dir\Install-PhpNightly.ps1 > $null 2>&1
& $php_dir\Install-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
} else {
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
}
@ -393,5 +400,5 @@ if($version -lt "5.5") {
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
}
Update-PhpCAInfo -Path $php_dir -Source $cert_source
Move-Item -path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"

View File

@ -378,7 +378,7 @@ export async function addDevTools(
return 'add_devtools ' + tool;
case 'win32':
return await utils.addLog(
'$cross',
'$tick',
tool,
tool + ' is not a windows tool',
'win32'