Compare commits

...

40 Commits
2.0.0 ... 2.1.0

Author SHA1 Message Date
b7d68d8225 Merge pull request #196 from shivammathur/develop
Hotfix 2.1.0
2020-03-02 20:11:17 +05:30
9252820289 Fix logs of blackfire setup 2020-03-02 19:56:53 +05:30
a5cc9fab25 Merge pull request #195 from shivammathur/develop
2.1.0
2020-02-29 22:30:50 +05:30
4e5685a75d Bump version to 2.1.0 2020-02-29 21:38:22 +05:30
d475227ba5 Improve README 2020-02-29 21:38:22 +05:30
38cb8b924d Use shivammathur/php5-darwin for PHP5 on darwin 2020-02-29 01:17:20 +05:30
fdd83e94df Update tools in README 2020-02-29 00:26:00 +05:30
ad112b7981 Fix support for symfony/flex 2020-02-28 16:51:00 +05:30
2b0d6e221f Improve blackfire examples 2020-02-28 15:42:17 +05:30
acee5b203f Add support for blackfire client, agent and player 2020-02-28 14:43:57 +05:30
84e88e382f Fix and refactor ext-blackfire 2020-02-27 19:27:11 +05:30
bbdc4e3b67 Merge pull request #193 from jaapio/feature/ext-blackfire
🎉 Add blackfire extenstion
2020-02-27 15:50:29 +05:30
311eb9f3ba Add example 2020-02-27 11:12:57 +01:00
3dfd7a648b Add blackfire support on windows 2020-02-27 11:12:56 +01:00
943f491830 Add blackfire on OSX 2020-02-27 11:12:52 +01:00
dc9461a053 Add blackfire to linux install
Add logging about install process

Fix formating of semversion blackfire

Only add version when needed

Pass phpversion
2020-02-27 10:38:52 +01:00
f2720d7b82 Update examples to start mysql service 2020-02-26 22:15:27 +05:30
99161b7790 Add perimission for composer self-update 2020-02-25 23:01:49 +05:30
5de6285e1f Fix composer version 2020-02-25 22:05:48 +05:30
14d702e830 Fix test name 2020-02-25 17:58:15 +05:30
9539b27b4a Add symfony/flex to supported tools 2020-02-25 10:00:07 +05:30
a4f7326577 Move dependency setup to cache-extensions 2020-02-25 09:38:53 +05:30
9b297384e1 Fix versioned extensions 2020-02-24 21:14:54 +05:30
9d77946f60 Switch to liip for old PHP on darwin 2020-02-24 20:24:08 +05:30
6d21e6dc05 Revert instllaing libicu64 2020-02-23 01:46:35 +05:30
68c827cfcf Fix wp-cli support 2020-02-23 01:19:07 +05:30
d95ca49e8d WP-CLI tool support added 2020-02-23 01:18:24 +05:30
03fd0b8719 Merge pull request #190 from shivammathur/develop
Hotfix: Force install libicu64 for PHP 8.0
2020-02-23 00:43:53 +05:30
ebe1c12c21 Hotfix: Force install libicu64 for PHP 8.0 2020-02-23 00:28:35 +05:30
b46021d870 Merge pull request #186 from shivammathur/develop
Update ppa before installing PHP
2020-02-22 00:30:07 +05:30
64ba54fc1b Hotfix: Force update ppa 2020-02-22 00:16:22 +05:30
71571f685a Merge pull request #185 from shivammathur/develop
2.0.2
2020-02-21 14:19:53 +05:30
10f86cb1a1 Bump version to 2.0.2 2020-02-21 14:06:08 +05:30
0f694c5087 Update README 2020-02-21 14:06:08 +05:30
9dfebd1adb Refactor scripts 2020-02-21 11:33:58 +05:30
3781acab4b Fix link in README 2020-02-20 04:15:24 +05:30
cdfbf6d0f0 Merge pull request #184 from shivammathur/develop
2.0.1
2020-02-19 09:08:04 +05:30
0ccb02802f Bump version to 2.0.1 2020-02-19 08:50:15 +05:30
a4572586dc Fix linux.sh 2020-02-19 07:22:01 +05:30
cb3c752d1f Remove update input, it is env 2020-02-17 15:50:44 +05:30
27 changed files with 898 additions and 590 deletions

View File

@ -58,7 +58,7 @@ jobs:
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
uses: shivammathur/cache-extensions@develop
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}

View File

@ -56,7 +56,7 @@ jobs:
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
uses: shivammathur/cache-extensions@develop
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}

View File

@ -35,6 +35,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
- [Verbose Setup](#verbose-setup)
- [Cache Extensions](#cache-extensions)
- [Cache Composer Dependencies](#cache-composer-dependencies)
- [Cache Node.js Dependencies](#cache-nodejs-dependencies)
- [Problem Matchers](#problem-matchers)
- [Examples](#examples)
- [License](#scroll-license)
@ -70,7 +71,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|macOS X Catalina 10.15|`macos-latest` or `macOS-10.15`|
## :heavy_plus_sign: PHP Extension Support
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
- 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
uses: shivammathur/setup-php@v2
@ -80,23 +81,23 @@ with:
extensions: swoole
```
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
- On `windows` PECL extensions which have the `DLL` binary can be installed.
- On `macOS` extensions which are on `PECL` can be installed.
- On `macOS` PECL extensions can be installed.
- Extensions which are installed along with PHP if specified are enabled.
- Extensions installed along with PHP if specified are enabled.
- Specific versions of PECL extensions can be installed by suffixing the extension 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
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '5.4'
tools: pecl
extensions: pcov-1.0.6
extensions: swoole-1.9.3
```
- Pre-release versions of PECL extensions can be installed by suffixing the extension 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
uses: shivammathur/setup-php@v2
@ -106,13 +107,15 @@ with:
extensions: xdebug-beta
```
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
- Extensions which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
- These extensions have custom support - `gearman` on ubuntu, `blackfire`, `phalcon3` and `phalcon4` on all supported OS.
## :wrench: Tools Support
These tools can be setup globally using the `tools` input.
`codeception`, `composer`, `composer-prefetcher`, `cs2pr`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-prefetcher`, `cs2pr`, `deployer`, `flex`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
```yaml
uses: shivammathur/setup-php@v2
@ -121,7 +124,7 @@ with:
tools: php-cs-fixer, phpunit
```
To setup a particular version of a tool, specify it in the form `tool:version`.
To setup a particular version of a tool, specify it in this form `tool:version`.
Version should be in semver format and a valid release of the tool.
```yaml
@ -131,9 +134,10 @@ with:
tools: php-cs-fixer:2.15.5, phpunit:8.5.1
```
**Note**
**Notes**
- `composer` is setup by default.
- Specifying version for `composer` and `pecl` has no effect, latest versions of both tools which are compatible with the PHP version will be setup.
- Both agent and client will be setup when `blackfire` is specified.
- If the version specified for the tool is not in semver format, latest version of the tool will be setup.
- Tools which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
@ -174,6 +178,7 @@ Consider disabling the coverage using this PHP action for these reasons.
- You are not generating coverage reports while testing.
- It will remove `Xdebug`, which will have a positive impact on PHP performance.
- You are using `phpdbg` for running your tests.
- You are profiling your code using `blackfire`.
```yaml
uses: shivammathur/setup-php@v2
@ -291,7 +296,7 @@ steps:
### Thread Safe Setup
- `NTS` versions are setup by default.
- On `ubuntu` and `macOS` only NTS versions are supported.
- On `ubuntu` and `macOS` only `NTS` versions are supported.
- On `windows` both `TS` and `NTS` versions are supported.
```yaml
@ -313,7 +318,7 @@ jobs:
### Force Update
- PHP versions which are pre-installed on the GitHub Actions runner are not updated to their latest patch release by default.
- 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
@ -327,7 +332,7 @@ jobs:
### Verbose Setup
- To debug any issues, you can use the `verbose` tag instead of `v2`.
To debug any issues, you can use the `verbose` tag instead of `v2`.
```yaml
- name: Setup PHP
@ -338,7 +343,7 @@ jobs:
### Cache Extensions
You can persist PHP extensions you setup using the [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup if cached are available in the next workflow run and enabled directly which reduces the workflow execution time.
You can cache PHP extensions using [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup if cached are available in the next workflow run and enabled directly which reduces the workflow execution time.
```yaml
runs-on: ${{ matrix.operating-system }}
@ -376,14 +381,14 @@ steps:
extensions: ${{ env.extensions }}
```
**Note:** If you setup both `TS` and `NTS` PHP versions on `windows`, add `${{ env.PHPTS }}` to `key` and `restore-keys` inputs in `actions/cache` step.
### Cache Composer Dependencies
You can persist composer's internal cache directory using the [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Action. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
**Note:** Please do not cache `vendor` directory using `action/cache` as that will have side-effects.
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.
```yaml
- name: Get Composer Cache Directory
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
@ -394,15 +399,36 @@ You can persist composer's internal cache directory using the [`action/cache`](h
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
- name: Install dependencies
run: composer install --prefer-dist
```
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.
**Notes**
- 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
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
```
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.
```yaml
- name: Get node.js cache directory
id: node-cache-dir
run: echo "::set-output name=dir::$(npm config get cache)" # Use $(yarn cache dir) for yarn
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.node-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Use '**/yarn.lock' for yarn
restore-keys: ${{ runner.os }}-node-
```
**Note:** Please do not cache `node_modules` directory as that will have side-effects.
### Problem Matchers
@ -411,7 +437,7 @@ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Setup problem matchers for your `PHP` output by adding this step after the `setup-php` step. This will scan the logs for PHP errors and warnings, and surface them prominently in the GitHub Actions UI by creating annotations and log file decorations.
```yaml
- name: Setup Problem Matchers for PHP
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
```
@ -420,7 +446,7 @@ Setup problem matchers for your `PHP` output by adding this step after the `setu
Setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
```yaml
- name: Setup Problem Matchers for PHPUnit
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
```
@ -448,6 +474,8 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|Framework/Package|Runs on|Workflow|
|--- |--- |--- |
|Blackfire|`macOS`, `ubuntu` and `windows`|[blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire")|
|Blackfire Player|`macOS`, `ubuntu` and `windows`|[blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player")|
|CakePHP with `MySQL` and `Redis`|`ubuntu`|[cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis")|
|CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
|CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
@ -472,7 +500,7 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
## :scroll: License
The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php"). This project has multiple [dependencies](#dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php"). This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
## :+1: Contributions
@ -482,9 +510,9 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
If this action helped you.
- To support this project subscribe on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or sponsor using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
- Please star the project and share it with the community.
- If you blog, write about your experience while using this action.
- I maintain this in my free time, please support me with a [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") subscription or a one time contribution using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
- If you blog, write about your experience of using this action.
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
## :bookmark: Dependencies
@ -496,7 +524,8 @@ If this action helped you.
- [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions")
- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to setup PHP5 versions on darwin")
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu")
## :bookmark_tabs: Further Reading

View File

@ -25,6 +25,12 @@ describe('Extension tests', () => {
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(win32).toContain('Platform fedora is not supported');
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
expect(win32).toContain('blackfire.ps1 7.3 1.31.0');
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
expect(win32).toContain('blackfire.ps1 7.3 1.31.0');
});
it('checking addExtensionOnLinux', async () => {
@ -38,7 +44,7 @@ describe('Extension tests', () => {
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
);
expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pecl_extension grpc 1.2.3');
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
expect(linux).toContain(
'add_unstable_extension xdebug alpha zend_extension'
);
@ -63,6 +69,12 @@ describe('Extension tests', () => {
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('phalcon.sh phalcon3 7.3');
expect(linux).toContain('phalcon.sh phalcon4 7.3');
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
expect(linux).toContain('blackfire.sh 7.3 1.31.0');
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
expect(linux).toContain('blackfire.sh 7.3 1.31.0');
});
it('checking addExtensionOnDarwin', async () => {
@ -74,7 +86,7 @@ describe('Extension tests', () => {
expect(darwin).toContain('sudo pecl install -f xdebug');
expect(darwin).toContain('sudo pecl install -f pcov');
expect(darwin).toContain('add_unstable_extension ast beta extension');
expect(darwin).toContain('sudo pecl install -f grpc-1.2.3');
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
@ -120,6 +132,12 @@ describe('Extension tests', () => {
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
expect(darwin).toContain('blackfire_darwin.sh 7.3 1.31.0');
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
expect(darwin).toContain('blackfire_darwin.sh 7.3 1.31.0');
darwin = await extensions.addExtension(
'does_not_exist',
'7.2',

View File

@ -2,28 +2,10 @@ import * as tools from '../src/tools';
describe('Tools tests', () => {
it('checking getCommand', async () => {
expect(await tools.getArchiveCommand('linux')).toBe('add_tool ');
expect(await tools.getArchiveCommand('darwin')).toBe('add_tool ');
expect(await tools.getArchiveCommand('win32')).toBe('Add-Tool ');
expect(await tools.getArchiveCommand('fedora')).toContain(
'Platform fedora is not supported'
);
});
it('checking getCommand', async () => {
expect(await tools.getPackageCommand('linux')).toBe('add_composer_tool ');
expect(await tools.getPackageCommand('darwin')).toBe('add_composer_tool ');
expect(await tools.getPackageCommand('win32')).toBe('Add-Composer-Tool ');
expect(await tools.getPackageCommand('fedora')).toContain(
'Platform fedora is not supported'
);
});
it('checking getPECLCommand', async () => {
expect(await tools.getPECLCommand('linux')).toBe('add_pecl ');
expect(await tools.getPECLCommand('darwin')).toBe('add_pecl ');
expect(await tools.getPECLCommand('win32')).toBe('Add-PECL ');
expect(await tools.getPECLCommand('fedora')).toContain(
expect(await tools.getCommand('linux', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('darwin', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('win32', 'tool')).toBe('Add-Tool ');
expect(await tools.getCommand('fedora', 'tool')).toContain(
'Platform fedora is not supported'
);
});
@ -205,12 +187,12 @@ describe('Tools tests', () => {
);
});
it('checking getPhpunitUri', async () => {
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
'https://phar.phpunit.de/tool.phar'
it('checking getPharUri', async () => {
expect(await tools.getPharUrl('domain', 'tool', '', 'latest')).toBe(
'domain/tool.phar'
);
expect(await tools.getPhpunitUrl('tool', '1.2.3')).toBe(
'https://phar.phpunit.de/tool-1.2.3.phar'
expect(await tools.getPharUrl('domain', 'tool', 'v', '1.2.3')).toBe(
'domain/tool-v1.2.3.phar'
);
});
@ -223,7 +205,7 @@ describe('Tools tests', () => {
);
});
it('checking getDeployerUri', async () => {
it('checking addComposer', async () => {
expect(await tools.addComposer(['a', 'b'])).toStrictEqual([
'composer',
'a',
@ -276,6 +258,15 @@ describe('Tools tests', () => {
]);
});
it('checking getWpCliUri', async () => {
expect(await tools.getWpCliUrl('latest')).toBe(
'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'
);
expect(await tools.getWpCliUrl('2.4.0')).toBe(
'wp-cli/wp-cli/releases/download/v2.4.0/wp-cli-2.4.0.phar'
);
});
it('checking addArchive', async () => {
let script: string = await tools.addArchive(
'tool',
@ -344,13 +335,13 @@ describe('Tools tests', () => {
'user/',
'linux'
);
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/');
expect(script).toContain('add_composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'darwin');
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/');
expect(script).toContain('add_composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32');
expect(script).toContain('Add-Composer-Tool tool tool:1.2.3 user/');
expect(script).toContain('Add-Composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora');
expect(script).toContain('Platform fedora is not supported');
@ -358,12 +349,16 @@ describe('Tools tests', () => {
it('checking addTools on linux', async () => {
const script: string = await tools.addTools(
'cs2pr, php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
'7.4',
'linux'
);
expect(script).toContain('add_blackfire');
expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@ -383,21 +378,29 @@ describe('Tools tests', () => {
expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
);
expect(script).toContain(
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
expect(script).toContain('add_pecl');
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_composertool flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_devtools');
expect(script).toContain('add_log "$tick" "php-config" "Added"');
expect(script).toContain('add_log "$tick" "phpize" "Added"');
});
it('checking addTools on darwin', async () => {
const script: string = await tools.addTools(
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
'blackfire, blackfire-player, flex, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli',
'7.4',
'darwin'
);
expect(script).toContain('add_blackfire');
expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
@ -417,12 +420,13 @@ describe('Tools tests', () => {
expect(script).toContain(
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
);
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
expect(script).toContain('add_composertool flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
);
expect(script).toContain(
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
);
expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
@ -430,37 +434,46 @@ describe('Tools tests', () => {
expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
);
expect(script).toContain(
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
expect(script).toContain('add_log "$tick" "phpize" "Added"');
expect(script).toContain('add_log "$tick" "php-config" "Added"');
});
it('checking addTools on windows', async () => {
const script: string = await tools.addTools(
'codeception, cs2pr, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exit',
'blackfire, blackfire-player:1.8.1, codeception, cs2pr, deployer, flex, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, wp-cli, does_not_exit',
'7.4',
'win32'
);
expect(script).toContain('Add-Blackfire 1.32.0');
expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
);
expect(script).toContain(
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
);
expect(script).toContain('Add-Composertool flex flex symfony/');
expect(script).toContain(
'Add-Tool https://deployer.org/deployer.phar deployer'
);
expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/'
);
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain(
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
);
expect(script).toContain(
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony'
);
expect(script).toContain(
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
);
expect(script).toContain('phpize is not a windows tool');
expect(script).toContain('php-config is not a windows tool');
expect(script).toContain('Tool does_not_exit is not supported');
@ -473,14 +486,12 @@ describe('Tools tests', () => {
'win32'
);
expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer'
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Composer-Tool composer-prefetcher composer-prefetcher narrowspark/automatic-'
'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
);
});
});

View File

@ -161,4 +161,14 @@ describe('Utils tests', () => {
'Platform fedora is not supported'
);
});
it('checking getBlackfireVersion', async () => {
expect(await utils.getBlackfireVersion('')).toEqual('1.31.0');
expect(await utils.getBlackfireVersion(undefined)).toEqual('1.31.0');
expect(await utils.getBlackfireVersion(null)).toEqual('1.31.0');
expect(await utils.getBlackfireVersion('1.32.0')).toEqual('1.32.0');
});
it('checking getBlackfireAgentVersion', async () => {
expect(await utils.getBlackfireAgentVersion()).toEqual('1.32.0');
});
});

View File

@ -3,6 +3,7 @@ author: shivammathur
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
branding:
color: 'purple'
icon: 'play-circle'
inputs:
php-version:
description: 'Setup PHP version.'
@ -20,9 +21,6 @@ inputs:
tools:
description: 'Setup popular tools globally.'
required: false
update:
description: 'Update PHP if already installed.'
required: false
runs:
using: 'node12'
main: 'dist/index.js'

186
dist/index.js vendored
View File

@ -1247,6 +1247,33 @@ function suppressOutput(os_version) {
});
}
exports.suppressOutput = suppressOutput;
/**
* Function to get Blackfire version
*
* @param blackfire_version
*/
function getBlackfireVersion(blackfire_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (blackfire_version) {
case null:
case undefined:
case '':
return '1.31.0';
default:
return blackfire_version;
}
});
}
exports.getBlackfireVersion = getBlackfireVersion;
/**
* Function to get Blackfire Agent version
*/
function getBlackfireAgentVersion() {
return __awaiter(this, void 0, void 0, function* () {
return '1.32.0';
});
}
exports.getBlackfireAgentVersion = getBlackfireAgentVersion;
/***/ }),
@ -1453,6 +1480,13 @@ exports.setFailed = setFailed;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/**
* Gets whether Actions Step Debug is on or not
*/
function isDebug() {
return process.env['RUNNER_DEBUG'] === '1';
}
exports.isDebug = isDebug;
/**
* Writes debug message to user log
* @param message debug message
@ -1576,63 +1610,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const utils = __importStar(__webpack_require__(163));
/**
* Function to get command to setup tool
* Function to get command to setup tools
*
* @param os_version
*/
function getArchiveCommand(os_version) {
function getCommand(os_version, suffix) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_tool ';
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-Tool ';
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.getArchiveCommand = getArchiveCommand;
/**
* Function to get command to setup tools using composer
*
* @param os_version
*/
function getPackageCommand(os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_composer_tool ';
case 'win32':
return 'Add-Composer-Tool ';
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.getPackageCommand = getPackageCommand;
/**
*
* Function to get command to setup PECL
*
* @param os_version
*/
function getPECLCommand(os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_pecl ';
case 'win32':
return 'Add-PECL ';
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.getPECLCommand = getPECLCommand;
exports.getCommand = getCommand;
/**
* Function to get tool version
*
@ -1787,10 +1782,10 @@ function addPhive(version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (version) {
case 'latest':
return ((yield getArchiveCommand(os_version)) +
return ((yield getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive');
default:
return ((yield getArchiveCommand(os_version)) +
return ((yield getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
@ -1801,22 +1796,21 @@ function addPhive(version, os_version) {
}
exports.addPhive = addPhive;
/**
* Function to get the PHPUnit url
* Function to get the phar url in domain/tool-version.phar format
*
* @param version
*/
function getPhpunitUrl(tool, version) {
function getPharUrl(domain, tool, prefix, version) {
return __awaiter(this, void 0, void 0, function* () {
const phpunit = 'https://phar.phpunit.de';
switch (version) {
case 'latest':
return phpunit + '/' + tool + '.phar';
return domain + '/' + tool + '.phar';
default:
return phpunit + '/' + tool + '-' + version + '.phar';
return domain + '/' + tool + '-' + prefix + version + '.phar';
}
});
}
exports.getPhpunitUrl = getPhpunitUrl;
exports.getPharUrl = getPharUrl;
/**
* Function to get the Deployer url
*
@ -1863,6 +1857,22 @@ function getSymfonyUri(version, os_version) {
});
}
exports.getSymfonyUri = getSymfonyUri;
/**
* Function to get the WP-CLI url
*
* @param version
*/
function getWpCliUrl(version) {
return __awaiter(this, void 0, void 0, function* () {
switch (version) {
case 'latest':
return 'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true';
default:
return yield getUri('wp-cli', '-' + version + '.phar', version, 'wp-cli/wp-cli/releases', 'v', 'download');
}
});
}
exports.getWpCliUrl = getWpCliUrl;
/**
* Function to add/move composer in the tools list
*
@ -1897,7 +1907,7 @@ function getCleanedToolsList(tools_csv) {
.map(function (extension) {
return extension
.trim()
.replace(/robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
.replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
})
.filter(Boolean);
return [...new Set(tools_list)];
@ -1914,7 +1924,7 @@ exports.getCleanedToolsList = getCleanedToolsList;
*/
function addArchive(tool, version, url, os_version) {
return __awaiter(this, void 0, void 0, function* () {
return (yield getArchiveCommand(os_version)) + url + ' ' + tool;
return (yield getCommand(os_version, 'tool')) + url + ' ' + tool;
});
}
exports.addArchive = addArchive;
@ -1951,7 +1961,7 @@ exports.addDevTools = addDevTools;
*/
function addPackage(tool, release, prefix, os_version) {
return __awaiter(this, void 0, void 0, function* () {
const tool_command = yield getPackageCommand(os_version);
const tool_command = yield getCommand(os_version, 'composertool');
return tool_command + tool + ' ' + release + ' ' + prefix;
});
}
@ -1976,6 +1986,14 @@ function addTools(tools_csv, php_version, os_version) {
script += '\n';
let url = '';
switch (tool) {
case 'blackfire':
case 'blackfire-agent':
script += yield getCommand(os_version, 'blackfire ' + (yield utils.getBlackfireAgentVersion()));
break;
case 'blackfire-player':
url = yield getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += yield addArchive(tool, version, url, os_version);
break;
case 'cs2pr':
uri = yield getUri(tool, '', version, 'releases', '', 'download');
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
@ -2007,8 +2025,10 @@ function addTools(tools_csv, php_version, os_version) {
script += yield addArchive(tool, version, url, os_version);
break;
case 'composer':
url =
github + 'composer/composer/releases/latest/download/composer.phar';
// If RC is released as latest release, switch to getcomposer.
// Prefered source is GitHub as it is faster.
// url = github + 'composer/composer/releases/latest/download/composer.phar';
url = 'https://getcomposer.org/composer-stable.phar';
script += yield addArchive(tool, version, url, os_version);
break;
case 'codeception':
@ -2019,13 +2039,16 @@ function addTools(tools_csv, php_version, os_version) {
break;
case 'phpcpd':
case 'phpunit':
url = yield getPhpunitUrl(tool, version);
url = yield getPharUrl('https://phar.phpunit.de', tool, '', version);
script += yield addArchive(tool, version, url, os_version);
break;
case 'deployer':
url = yield getDeployerUrl(version);
script += yield addArchive(tool, version, url, os_version);
break;
case 'flex':
script += yield addPackage(tool, release, 'symfony/', os_version);
break;
case 'phinx':
script += yield addPackage(tool, release, 'robmorgan/', os_version);
break;
@ -2036,7 +2059,7 @@ function addTools(tools_csv, php_version, os_version) {
script += yield addPackage(tool, release, 'narrowspark/automatic-', os_version);
break;
case 'pecl':
script += yield getPECLCommand(os_version);
script += yield getCommand(os_version, 'pecl');
break;
case 'php-config':
case 'phpize':
@ -2048,6 +2071,10 @@ function addTools(tools_csv, php_version, os_version) {
url = github + 'symfony/cli/' + uri;
script += yield addArchive('symfony', version, url, os_version);
break;
case 'wp-cli':
url = github + (yield getWpCliUrl(version));
script += yield addArchive(tool, version, url, os_version);
break;
default:
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
break;
@ -2681,6 +2708,17 @@ function addExtensionDarwin(extension_csv, version, pipe) {
const prefix = yield utils.getExtensionPrefix(ext_name);
let install_command = '';
switch (true) {
// 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
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
install_command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
' ' +
version +
' ' +
(yield utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
@ -2691,6 +2729,11 @@ function addExtensionDarwin(extension_csv, version, pipe) {
' ' +
prefix;
return;
// match exact versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
return;
case /5\.3xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.2.7' + pipe;
break;
@ -2757,6 +2800,17 @@ function addExtensionWindows(extension_csv, version, pipe) {
const version_extension = version + extension;
let matches;
switch (true) {
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
' ' +
version +
' ' +
(yield utils.getBlackfireVersion(ext_version));
return;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
@ -2810,6 +2864,17 @@ function addExtensionLinux(extension_csv, version, pipe) {
const prefix = yield utils.getExtensionPrefix(ext_name);
let install_command = '';
switch (true) {
// 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
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
install_command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
' ' +
version +
' ' +
(yield utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
@ -2822,7 +2887,8 @@ function addExtensionLinux(extension_csv, version, pipe) {
return;
// match exact versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script += '\nadd_pecl_extension ' + ext_name + ' ' + ext_version;
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
return;
// match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):

View File

@ -0,0 +1,31 @@
# GitHub Action for Blackfire Player
name: Play a Blackfire Scenario
on: [push, pull_request]
jobs:
blackfire-player:
name: Blackfire (PHP ${{ matrix.php-versions }})
# Add your Blackfire credentials securely using GitHub Secrets
env:
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }}
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }}
BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }}
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
# blackfire-player supports PHP >= 5.5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire
tools: blackfire, blackfire-player #Setup Blackfire client, agent and player
coverage: none
- name: Play the scenario
run: blackfire-player run scenario.bkf # Refer to https://blackfire.io/docs/player/index#usage

31
examples/blackfire.yml Normal file
View File

@ -0,0 +1,31 @@
# GitHub Action for Blackfire
name: Profiling with blackfire
on: [push, pull_request]
jobs:
blackfire:
name: Blackfire (PHP ${{ matrix.php-versions }})
# Add your Blackfire credentials securely using GitHub Secrets
env:
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }}
BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }}
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }}
BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }}
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
# Blackfire supports PHP >= 5.3 on ubuntu and macos and PHP >= 5.4 on windows
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire
tools: blackfire #Setup Blackfire client and agent
coverage: none
- name: Profile
run: blackfire run php my-script.php # Refer to https://blackfire.io/docs/cookbooks/profiling-cli

View File

@ -34,6 +34,8 @@ jobs:
# Install memcached if using ext-memcached
extensions: mbstring, intl, redis, pdo_mysql
coverage: pcov
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -41,6 +41,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -41,6 +41,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -41,6 +41,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -28,6 +28,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

View File

@ -38,6 +38,8 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

308
package-lock.json generated
View File

@ -1,13 +1,13 @@
{
"name": "setup-php",
"version": "2.0.0",
"version": "2.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
},
"@actions/exec": {
"version": "1.0.3",
@ -32,18 +32,18 @@
}
},
"@babel/core": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.4.tgz",
"integrity": "sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.6.tgz",
"integrity": "sha512-Sheg7yEJD51YHAvLEV/7Uvw95AeWqYPL3Vk3zGujJKIhJ+8oLw2ALaf3hbucILhKsgSoADOvtKRJuNVdcJkOrg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.8.4",
"@babel/generator": "^7.8.6",
"@babel/helpers": "^7.8.4",
"@babel/parser": "^7.8.4",
"@babel/template": "^7.8.3",
"@babel/traverse": "^7.8.4",
"@babel/types": "^7.8.3",
"@babel/parser": "^7.8.6",
"@babel/template": "^7.8.6",
"@babel/traverse": "^7.8.6",
"@babel/types": "^7.8.6",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
@ -69,12 +69,12 @@
}
},
"@babel/generator": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.4.tgz",
"integrity": "sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.6.tgz",
"integrity": "sha512-4bpOR5ZBz+wWcMeVtcf7FbjcFzCp+817z2/gHNncIRcM9MmKzUhtWCYAq27RAfUrAFwb+OCG1s9WEaVxfi6cjg==",
"dev": true,
"requires": {
"@babel/types": "^7.8.3",
"@babel/types": "^7.8.6",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0"
@ -198,9 +198,9 @@
}
},
"@babel/parser": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz",
"integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.6.tgz",
"integrity": "sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g==",
"dev": true
},
"@babel/plugin-syntax-bigint": {
@ -231,28 +231,28 @@
}
},
"@babel/template": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz",
"integrity": "sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz",
"integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/parser": "^7.8.3",
"@babel/types": "^7.8.3"
"@babel/parser": "^7.8.6",
"@babel/types": "^7.8.6"
}
},
"@babel/traverse": {
"version": "7.8.4",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.4.tgz",
"integrity": "sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.6.tgz",
"integrity": "sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.8.4",
"@babel/generator": "^7.8.6",
"@babel/helper-function-name": "^7.8.3",
"@babel/helper-split-export-declaration": "^7.8.3",
"@babel/parser": "^7.8.4",
"@babel/types": "^7.8.3",
"@babel/parser": "^7.8.6",
"@babel/types": "^7.8.6",
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "^4.17.13"
@ -267,9 +267,9 @@
}
},
"@babel/types": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz",
"integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==",
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.6.tgz",
"integrity": "sha512-wqz7pgWMIrht3gquyEFPVXeXCti72Rm8ep9b5tQKz9Yg9LzJA3HxosF1SB3Kc81KD1A3XBkkVYtJvCKS2Z/QrA==",
"dev": true,
"requires": {
"esutils": "^2.0.2",
@ -575,18 +575,18 @@
}
},
"@sinonjs/commons": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.0.tgz",
"integrity": "sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg==",
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz",
"integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==",
"dev": true,
"requires": {
"type-detect": "4.0.8"
}
},
"@types/babel__core": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.4.tgz",
"integrity": "sha512-c/5MuRz5HM4aizqL5ViYfW4iEnmfPcfbH4Xa6GgLT21dMc1NGeNnuS6egHheOmP+kCJ9CAzC4pv4SDCWTnRkbg==",
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.6.tgz",
"integrity": "sha512-tTnhWszAqvXnhW7m5jQU9PomXSiKXk2sFxpahXvI20SZKu9ylPi8WtIxueZ6ehDWikPT0jeFujMj3X4ZHuf3Tg==",
"dev": true,
"requires": {
"@babel/parser": "^7.1.0",
@ -616,9 +616,9 @@
}
},
"@types/babel__traverse": {
"version": "7.0.8",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.8.tgz",
"integrity": "sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw==",
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.9.tgz",
"integrity": "sha512-jEFQ8L1tuvPjOI8lnpaf73oCJe+aoxL6ygqSy6c8LcW98zaC+4mzWuQIRCEvKeCOu+lbqdXcg4Uqmm1S8AP1tw==",
"dev": true,
"requires": {
"@babel/types": "^7.3.0"
@ -662,9 +662,9 @@
}
},
"@types/jest": {
"version": "25.1.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.2.tgz",
"integrity": "sha512-EsPIgEsonlXmYV7GzUqcvORsSS9Gqxw/OvkGwHfAdpjduNRxMlhsav0O5Kb0zijc/eXSO/uW6SJt9nwull8AUQ==",
"version": "25.1.3",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz",
"integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==",
"dev": true,
"requires": {
"jest-diff": "^25.1.0",
@ -678,9 +678,9 @@
"dev": true
},
"@types/node": {
"version": "13.7.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.1.tgz",
"integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA==",
"version": "13.7.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.7.tgz",
"integrity": "sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==",
"dev": true
},
"@types/parse-json": {
@ -696,9 +696,9 @@
"dev": true
},
"@types/yargs": {
"version": "15.0.3",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.3.tgz",
"integrity": "sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ==",
"version": "15.0.4",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.4.tgz",
"integrity": "sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
@ -711,12 +711,12 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "2.19.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.19.2.tgz",
"integrity": "sha512-HX2qOq2GOV04HNrmKnTpSIpHjfl7iwdXe3u/Nvt+/cpmdvzYvY0NHSiTkYN257jHnq4OM/yo+OsFgati+7LqJA==",
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.21.0.tgz",
"integrity": "sha512-b5jjjDMxzcjh/Sbjuo7WyhrQmVJg0WipTHQgXh5Xwx10uYm6nPWqN1WGOsaNq4HR3Zh4wUx4IRQdDkCHwyewyw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "2.19.2",
"@typescript-eslint/experimental-utils": "2.21.0",
"eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -724,32 +724,32 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "2.19.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.19.2.tgz",
"integrity": "sha512-B88QuwT1wMJR750YvTJBNjMZwmiPpbmKYLm1yI7PCc3x0NariqPwqaPsoJRwU9DmUi0cd9dkhz1IqEnwfD+P1A==",
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.21.0.tgz",
"integrity": "sha512-olKw9JP/XUkav4lq0I7S1mhGgONJF9rHNhKFn9wJlpfRVjNo3PPjSvybxEldvCXnvD+WAshSzqH5cEjPp9CsBA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.19.2",
"@typescript-eslint/typescript-estree": "2.21.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/parser": {
"version": "2.19.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.19.2.tgz",
"integrity": "sha512-8uwnYGKqX9wWHGPGdLB9sk9+12sjcdqEEYKGgbS8A0IvYX59h01o8os5qXUHMq2na8vpDRaV0suTLM7S8wraTA==",
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.21.0.tgz",
"integrity": "sha512-VrmbdrrrvvI6cPPOG7uOgGUFXNYTiSbnRq8ZMyuGa4+qmXJXVLEEz78hKuqupvkpwJQNk1Ucz1TenrRP90gmBg==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.19.2",
"@typescript-eslint/typescript-estree": "2.19.2",
"@typescript-eslint/experimental-utils": "2.21.0",
"@typescript-eslint/typescript-estree": "2.21.0",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.19.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.19.2.tgz",
"integrity": "sha512-Xu/qa0MDk6upQWqE4Qy2X16Xg8Vi32tQS2PR0AvnT/ZYS4YGDvtn2MStOh5y8Zy2mg4NuL06KUHlvCh95j9C6Q==",
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.21.0.tgz",
"integrity": "sha512-NC/nogZNb9IK2MEFQqyDBAciOT8Lp8O3KgAfvHx2Skx6WBo+KmDqlU3R9KxHONaijfTIKtojRe3SZQyMjr3wBw==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@ -774,9 +774,9 @@
"dev": true
},
"acorn": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
"dev": true
},
"acorn-globals": {
@ -798,9 +798,9 @@
}
},
"acorn-jsx": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz",
"integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz",
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
"dev": true
},
"acorn-walk": {
@ -810,9 +810,9 @@
"dev": true
},
"ajv": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz",
"integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==",
"version": "6.12.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
"integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@ -822,12 +822,20 @@
}
},
"ansi-escapes": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz",
"integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==",
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz",
"integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==",
"dev": true,
"requires": {
"type-fest": "^0.8.1"
"type-fest": "^0.11.0"
},
"dependencies": {
"type-fest": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
"integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==",
"dev": true
}
}
},
"ansi-regex": {
@ -1875,9 +1883,9 @@
}
},
"eslint-plugin-jest": {
"version": "23.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.7.0.tgz",
"integrity": "sha512-zkiyGlvJeHNjAEz8FaIxTXNblJJ/zj3waNbYbgflK7K6uy0cpE5zJBt/JpJtOBGM/UGkC6BqsQ4n0y7kQ2HA8w==",
"version": "23.8.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.1.tgz",
"integrity": "sha512-OycLNqPo/2EfO6kTqnmsu1khz1gTIOxGl3ThIVwL5/oycDF4pm5uNDyvFelNLdpr4COUuM8PVi3963NEG1Efpw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^2.5.0"
@ -2198,9 +2206,9 @@
}
},
"figures": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz",
"integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
"integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.5"
@ -2498,9 +2506,9 @@
}
},
"hosted-git-info": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
"html-encoding-sniffer": {
@ -2731,74 +2739,33 @@
"dev": true
},
"inquirer": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz",
"integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==",
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.5.tgz",
"integrity": "sha512-6Z5cP+LAO0rzNE7xWjWtT84jxKa5ScLEGLgegPXeO3dGeU8lNe5Ii7SlXH6KVtLGlDuaEhsvsFjrjWjw8j5lFg==",
"dev": true,
"requires": {
"ansi-escapes": "^4.2.1",
"chalk": "^2.4.2",
"chalk": "^3.0.0",
"cli-cursor": "^3.1.0",
"cli-width": "^2.0.0",
"external-editor": "^3.0.3",
"figures": "^3.0.0",
"lodash": "^4.17.15",
"mute-stream": "0.0.8",
"run-async": "^2.2.0",
"run-async": "^2.4.0",
"rxjs": "^6.5.3",
"string-width": "^4.1.0",
"strip-ansi": "^5.1.0",
"strip-ansi": "^6.0.0",
"through": "^2.3.6"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
"ansi-regex": "^5.0.0"
}
}
}
@ -3827,9 +3794,9 @@
}
},
"make-error": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",
"integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==",
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"dev": true
},
"makeerror": {
@ -4427,9 +4394,9 @@
"dev": true
},
"react-is": {
"version": "16.12.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz",
"integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==",
"version": "16.13.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.0.tgz",
"integrity": "sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA==",
"dev": true
},
"read-pkg": {
@ -4656,9 +4623,9 @@
"dev": true
},
"run-async": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
"integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz",
"integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==",
"dev": true,
"requires": {
"is-promise": "^2.1.0"
@ -5517,9 +5484,9 @@
}
},
"ts-jest": {
"version": "25.2.0",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.2.0.tgz",
"integrity": "sha512-VaRdb0da46eorLfuHEFf0G3d+jeREcV+Wb/SvW71S4y9Oe8SHWU+m1WY/3RaMknrBsnvmVH0/rRjT8dkgeffNQ==",
"version": "25.2.1",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.2.1.tgz",
"integrity": "sha512-TnntkEEjuXq/Gxpw7xToarmHbAafgCaAzOpnajnFC6jI7oo1trMzAHA04eWpc3MhV6+yvhE8uUBAmN+teRJh0A==",
"dev": true,
"requires": {
"bs-logger": "0.x",
@ -5531,36 +5498,21 @@
"mkdirp": "0.x",
"resolve": "1.x",
"semver": "^5.5",
"yargs-parser": "10.x"
"yargs-parser": "^16.1.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
"dev": true
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"yargs-parser": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
"integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
"dev": true,
"requires": {
"camelcase": "^4.1.0"
}
}
}
},
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
"dev": true
},
"tsutils": {
@ -5618,9 +5570,9 @@
}
},
"typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
},
"union-value": {
@ -5886,9 +5838,9 @@
}
},
"write-file-atomic": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.1.tgz",
"integrity": "sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
"integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
"dev": true,
"requires": {
"imurmurhash": "^0.1.4",

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.0.0",
"version": "2.1.0",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
@ -24,28 +24,28 @@
"author": "shivammathur",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.2",
"@actions/core": "^1.2.3",
"@actions/exec": "^1.0.3",
"@actions/io": "^1.0.2",
"fs": "0.0.1-security"
},
"devDependencies": {
"@types/jest": "^25.1.2",
"@types/node": "^13.7.1",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"@types/jest": "^25.1.3",
"@types/node": "^13.7.7",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"@zeit/ncc": "^0.21.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-jest": "^23.8.1",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"jest": "^25.1.0",
"jest-circus": "^25.1.0",
"prettier": "^1.19.1",
"ts-jest": "^25.2.0",
"typescript": "^3.7.5"
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
},
"husky": {
"skipCI": true,

View File

@ -22,6 +22,19 @@ export async function addExtensionDarwin(
const prefix = await utils.getExtensionPrefix(ext_name);
let install_command = '';
switch (true) {
// 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
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
install_command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
' ' +
version +
' ' +
(await utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
@ -32,6 +45,11 @@ export async function addExtensionDarwin(
' ' +
prefix;
return;
// match exact versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
return;
case /5\.3xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.2.7' + pipe;
break;
@ -98,6 +116,19 @@ export async function addExtensionWindows(
const version_extension: string = version + extension;
let matches: RegExpExecArray;
switch (true) {
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
script +=
'\n& ' +
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
' ' +
version +
' ' +
(await utils.getBlackfireVersion(ext_version));
return;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
@ -155,6 +186,19 @@ export async function addExtensionLinux(
const prefix = await utils.getExtensionPrefix(ext_name);
let install_command = '';
switch (true) {
// 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
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
install_command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
' ' +
version +
' ' +
(await utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
@ -167,7 +211,8 @@ export async function addExtensionLinux(
return;
// match exact versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script += '\nadd_pecl_extension ' + ext_name + ' ' + ext_version;
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
return;
// match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):

View File

@ -20,28 +20,14 @@ add_log() {
remove_extension() {
extension=$1
sudo sed -i '' "/$extension/d" "$ini_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
}
# Function to setup extensions
add_extension() {
# Function to test if extension is loaded
check_extension() {
extension=$1
install_command=$2
prefix=$3
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q -w "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q -w "$extension"; then
if [[ "$version" =~ $old_versions ]]; then
(sudo port install php"$nodot_version"-"$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
(eval "$install_command" >/dev/null 2>&1 && echo "$prefix=$ext_dir/$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
else
(eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
fi
php -m | grep -i -q -w "$extension"
}
# Fuction to get the PECL version
@ -57,68 +43,87 @@ get_pecl_version() {
echo "$pecl_version"
}
# Function to install a PECL version
add_pecl_extension() {
extension=$1
pecl_version=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
fi
}
# Function to setup extensions
add_extension() {
extension=$1
install_command=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
(
eval "$install_command" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
}
# Function to pre-release extensions using PECL
add_unstable_extension() {
extension=$1
stability=$2
prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability")
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
extension_version=$(php -d="$prefix=$extension" -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
elif php -m | grep -i -q -w "$extension"; then
extension_version=$(php -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
else
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
add_pecl_extension "$extension" "$pecl_version" "$prefix"
}
# Function to setup a remote tool
add_tool() {
url=$1
tool=$2
if [ "$tool" = "composer" ]; then
brew install composer >/dev/null 2>&1
composer -q global config process-timeout 0
tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
if [ "$status_code" = "200" ]; then
sudo chmod a+x "$tool_path"
if [ "$tool" = "composer" ]; then
composer -q global config process-timeout 0
elif [ "$tool" = "phive" ]; then
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
elif [ "$tool" = "cs2pr" ]; then
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
tr -d '\r' <"$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
sudo chmod a+x "$tool_path"
elif [ "$tool" = "wp-cli" ]; then
sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi
add_log "$tick" "$tool" "Added"
else
tool_path=/usr/local/bin/"$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
if [ "$status_code" = "200" ]; then
sudo chmod a+x "$tool_path"
if [ "$tool" = "phive" ]; then
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
elif [ "$tool" = "cs2pr" ]; then
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
sudo chmod a+x "$tool_path"
fi
add_log "$tick" "$tool" "Added"
else
add_log "$cross" "$tool" "Could not setup $tool"
fi
add_log "$cross" "$tool" "Could not setup $tool"
fi
}
# Function to add a tool using composer
add_composer_tool() {
add_composertool() {
tool=$1
release=$2
prefix=$3
@ -129,15 +134,24 @@ add_composer_tool() {
) || add_log "$cross" "$tool" "Could not setup $tool"
}
add_blackfire() {
sudo mkdir -p usr/local/var/run
brew tap blackfireio/homebrew-blackfire >/dev/null 2>&1
brew install blackfire-agent >/dev/null 2>&1
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
brew services start blackfire-agent >/dev/null 2>&1
sudo blackfire --config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
add_log "$tick" "blackfire" "Added"
add_log "$tick" "blackfire-agent" "Added"
}
# Function to configure PECL
configure_pecl() {
if [[ ! "$version" =~ $old_versions ]]; then
for tool in pear pecl; do
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
sudo "$tool" config-set auto_discover 1 >/dev/null 2>&1
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
done
fi
for tool in pear pecl; do
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
sudo "$tool" config-set auto_discover 1 >/dev/null 2>&1
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
done
}
# Function to log PECL, it is installed along with PHP
@ -145,81 +159,46 @@ add_pecl() {
add_log "$tick" "PECL" "Added"
}
# Function to add PECL when macports is used
add_pecl_old() {
pecl_version='master'
if [ "$1" = "53" ]; then
pecl_version='v1.9.5'
fi
curl -o pear.phar -sSL https://github.com/pear/pearweb_phars/raw/$pecl_version/install-pear-nozlib.phar
sudo php pear.phar -d /opt/local/lib/php$1 -b /usr/local/bin && rm -rf pear.phar
}
add_macports() {
uri=$(curl -sSL https://github.com/macports/macports-base/releases | grep -Eo "(\/.*Catalina.pkg)" | head -n 1)
curl -o port.pkg -sSL https://github.com"$uri"
sudo installer -pkg port.pkg -target / && rm -rf port.pkg
}
sync_macports() {
while true; do
status=0
sudo port sync || status=$?
if [[ "$status" -eq 0 ]]; then
break
fi
sleep 2
done
}
port_setup_php() {
sudo port install php$1 php$1-curl php$1-mbstring php$1-xmlrpc php$1-openssl php$1-opcache
sudo cp /opt/local/etc/php$1/php.ini-development /opt/local/etc/php$1/php.ini
sudo port select --set php php$1
sudo ln -sf /opt/local/bin/* /usr/local/bin
add_pecl_old "$1"
# Function to setup PHP >=5.6
setup_php() {
action=$1
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE >/dev/null 2>&1
brew tap shivammathur/homebrew-php >/dev/null 2>&1
brew "$action" shivammathur/php/php@"$version" >/dev/null 2>&1
brew link --force --overwrite php@"$version" >/dev/null 2>&1
}
# Variables
tick="✓"
cross="✗"
version=$1
nodot_version=${1/./}
old_versions="5.[3-5]"
tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version | cut -c 1-3)
[[ -z "${update}" ]] && update='false' || update="${update}"
# Setup PHP
step_log "Setup PHP"
if [[ "$version" =~ $old_versions ]]; then
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
export TERM=xterm
step_log "Setup Macports"
add_macports >/dev/null 2>&1
add_log "$tick" "Macports" "Installed"
sync_macports >/dev/null 2>&1
add_log "$tick" "Macports" "Synced"
step_log "Setup PHP"
port_setup_php $nodot_version >/dev/null 2>&1
script="https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh"
curl -sSL "$script" | bash -s "$version" >/dev/null 2>&1 &&
status="Installed"
elif [ "$existing_version" != "$version" ] || [ "$update" = "true" ]; then
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE >/dev/null 2>&1
brew tap shivammathur/homebrew-php >/dev/null 2>&1
brew install shivammathur/php/php@"$version" >/dev/null 2>&1
brew link --force --overwrite php@"$version" >/dev/null 2>&1
if [ "$update" = "true" ]; then
status="Updated to"
else
status="Installed"
fi
elif [ "$existing_version" != "$version" ]; then
setup_php "install"
status="Installed"
elif [ "$existing_version" = "$version" ] && [ "$update" = "true" ]; then
setup_php "upgrade"
status="Updated to"
else
status="Found"
fi
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 "$ini_file"
sudo chmod 777 "$ini_file" "$tool_path_dir"
echo "date.timezone=UTC" >>"$ini_file"
ext_dir=$(php -i | grep -Ei "extension_dir => /(usr|opt)" | sed -e "s|.*=> s*||")
echo "detect_unicode=Off" >>"$ini_file"
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
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 ' ')
configure_pecl
add_log "$tick" "PHP" "$status PHP $semver"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -0,0 +1,30 @@
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[string]
$version,
[Parameter(Position = 2, Mandatory = $false)]
[ValidateNotNull()]
[string]
$extension_version
)
$tick = ([char]8730)
$php_dir = 'C:\tools\php'
$ext_dir = $php_dir + '\ext'
$arch='x64'
if ($version -lt '7.0') { $arch='x86' }
$version = $version.replace('.', '')
if (Test-Path $ext_dir\blackfire.dll) {
Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Enabled"
} else {
$installed = Get-Php -Path $php_dir
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
Enable-PhpExtension -Extension blackfire -Path $php_dir
$status="Installed and enabled"
}
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "blackfire" "$status"

View File

@ -0,0 +1,7 @@
version=${1/./}
extension_version=$2
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file="$scan_dir/50-blackfire.ini"
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-linux_amd64-php-$version.so
echo "extension=blackfire.so" | sudo tee -a "$ini_file"

View File

@ -0,0 +1,7 @@
version=${1/./}
extension_version=$2
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file="$scan_dir/50-blackfire.ini"
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-darwin_amd64-php-$version.so
echo "extension=blackfire.so" | sudo tee -a "$ini_file"

View File

@ -25,7 +25,7 @@ update_ppa() {
ppa="ondrej-ubuntu-php*.list"
fi
find /etc/apt/sources.list.d -type f -name "$ppa" -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
echo "true"
ppa_updated="true"
fi
}
@ -54,27 +54,10 @@ get_pecl_version() {
echo "$pecl_version"
}
# Function to setup extensions
add_extension() {
# Function to test if extension is loaded
check_extension() {
extension=$1
install_command=$2
prefix=$3
if [[ "$version" =~ $old_versions ]]; then
install_command="ppa_updated=$(update_ppa) && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
fi
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
# shellcheck disable=SC2046
$apt_install $(apt-cache depends php"$version"-"$extension" 2>/dev/null | awk '/Depends:/{print$2}') >/dev/null 2>&1
echo "$prefix=$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q -w "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q -w "$extension"; then
(eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
(ppa_updated=$(update_ppa) && eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
(sudo pecl install -f "$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
sudo chmod 777 "$ini_file"
php -m | grep -i -q -w "$extension"
}
# Function to delete extensions
@ -88,20 +71,53 @@ delete_extension() {
# Function to disable and delete extensions
remove_extension() {
extension=$1
if [ -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"
fi
delete_extension "$extension"
}
# Function to setup extensions
add_extension() {
extension=$1
install_command=$2
prefix=$3
if [[ "$version" =~ $old_versions ]]; then
install_command="update_ppa && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
fi
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
eval "$install_command" >/dev/null 2>&1 ||
(update_ppa && eval "$install_command" >/dev/null 2>&1) ||
sudo pecl install -f "$extension" >/dev/null 2>&1
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
sudo chmod 777 "$ini_file"
}
# Function to install a PECL version
add_pecl_extension() {
extension=$1
pecl_version=$2
delete_extension "$extension"
(sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
fi
}
# Function to pre-release extensions using PECL
@ -110,25 +126,7 @@ add_unstable_extension() {
stability=$2
prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability")
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
extension_version=$(php -d="$prefix=$extension" -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
echo "$prefix=$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
add_pecl_extension "$extension" "$pecl_version"
fi
elif php -m | grep -i -q -w "$extension"; then
extension_version=$(php -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
add_pecl_extension "$extension" "$pecl_version"
fi
else
add_pecl_extension "$extension" "$pecl_version"
fi
add_pecl_extension "$extension" "$pecl_version" "$prefix"
}
# Function to update extension
@ -140,7 +138,7 @@ update_extension() {
if [ "$final_version" != "$current_version" ]; then
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
if [ -z "$version_exists" ]; then
ppa_updated=$(update_ppa)
update_ppa
fi
$apt_install php"$version"-"$extension"
fi
@ -150,7 +148,7 @@ update_extension() {
add_tool() {
url=$1
tool=$2
tool_path=/usr/local/bin/"$tool"
tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
@ -165,6 +163,8 @@ add_tool() {
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
elif [ "$tool" = "wp-cli" ]; then
sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi
add_log "$tick" "$tool" "Added"
else
@ -173,7 +173,7 @@ add_tool() {
}
# Function to setup a tool using composer
add_composer_tool() {
add_composertool() {
tool=$1
release=$2
prefix=$3
@ -194,12 +194,26 @@ add_devtools() {
configure_pecl
}
add_blackfire() {
sudo mkdir -p /var/run/blackfire
sudo curl -o /tmp/blackfire-gpg.key -sSL https://packages.blackfire.io/gpg.key >/dev/null 2>&1
sudo apt-key add /tmp/blackfire-gpg.key >/dev/null 2>&1
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list >/dev/null 2>&1
find /etc/apt/sources.list.d -type f -name blackfire.list -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
$apt_install blackfire-agent >/dev/null 2>&1
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
sudo /etc/init.d/blackfire-agent restart >/dev/null 2>&1
sudo blackfire --config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
add_log "$tick" "blackfire" "Added"
add_log "$tick" "blackfire-agent" "Added"
}
# Function to setup the nightly build from master branch
setup_master() {
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
install_dir=~/php/"$version"
sudo mkdir -m 777 -p ~/php
$apt_install libicu-dev >/dev/null 2>&1
update_ppa && $apt_install libicu-dev >/dev/null 2>&1
curl -SLO https://dl.bintray.com/shivammathur/php/"$tar_file" >/dev/null 2>&1
sudo tar xf "$tar_file" -C ~/php >/dev/null 2>&1
rm -rf "$tar_file"
@ -242,6 +256,28 @@ switch_version() {
done
}
# Function to get PHP version in semver format
php_semver() {
if [ ! "$version" = "8.0" ]; 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 ' '
fi
}
# Function to update PHP
update_php() {
update_ppa
initial_version=$(php_semver)
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
updated_version=$(php_semver)
if [ "$updated_version" != "$initial_version" ]; then
status="Updated to"
else
status="Switched to"
fi
}
# Variables
tick="✓"
cross="✗"
@ -251,6 +287,7 @@ version=$1
old_versions="5.[4-5]"
debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y"
tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version | cut -c 1-3)
[[ -z "${update}" ]] && update='false' || update="${update}"
@ -265,17 +302,13 @@ if [ "$existing_version" != "$version" ]; then
elif [[ "$version" =~ $old_versions ]] || [ "$version" = "5.3" ]; then
setup_old_versions
else
version_exists=$(apt-cache policy -- php"$version" | grep "$version")
if [ -z "$version_exists" ]; then
ppa_updated=$(update_ppa)
fi
update_ppa
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
fi
status="Installed"
else
if [ "$update" = "true" ]; then
$apt_install php"$version" >/dev/null 2>&1
status="Updated to"
update_php
else
status="Switched to"
fi
@ -288,20 +321,15 @@ if [ "$existing_version" != "$version" ]; then
else
if [ "$update" = "true" ]; then
$apt_install php"$version" >/dev/null 2>&1
status="Updated to"
update_php
else
status="Found"
fi
fi
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
if [ ! "$version" = "8.0" ]; then
semver=$(echo "$semver" | cut -f 1 -d '-')
fi
semver=$(php_semver)
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo chmod 777 "$ini_file"
sudo chmod 777 "$ini_file" "$tool_path_dir"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -103,7 +103,7 @@ Function Add-Tool() {
}
if ($tool -eq "symfony") {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1
} else {
try {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
@ -113,7 +113,7 @@ Function Add-Tool() {
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
$bat_content += "php %BIN_TARGET% %*"
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
} catch { }
}
if($tool -eq "phive") {
@ -124,6 +124,8 @@ Function Add-Tool() {
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
} elseif($tool -eq "composer") {
composer -q global config process-timeout 0
} elseif($tool -eq "wp-cli") {
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
}
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
Add-Log $tick $tool "Added"
@ -132,7 +134,7 @@ Function Add-Tool() {
}
}
Function Add-Composer-Tool() {
Function Add-Composertool() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
@ -160,10 +162,33 @@ Function Add-Composer-Tool() {
}
}
Function Add-PECL() {
Function Add-Pecl() {
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
}
Function Add-Blackfire() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$agent_version
)
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\blackfire.zip >$null 2>&1
7z e $php_dir\blackfire.zip -o"$php_dir" -y >$null 2>&1
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias blackfire $php_dir\blackfire.exe"
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias blackfire-agent $php_dir\blackfire-agent.exe"
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
blackfire-agent --register --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
}
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
blackfire --config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
}
Add-Log $tick "blackfire" "Added"
Add-Log $tick "blackfire-agent" "Added"
}
# Variables
$tick = ([char]8730)
$cross = ([char]10007)
@ -172,6 +197,7 @@ $ext_dir = $php_dir + '\ext'
$ProgressPreference = 'SilentlyContinue'
$master_version = '8.0'
$arch = 'x64'
$arch_name='amd64'
$ts = $false
if((Test-Path env:PHPTS) -and $env:PHPTS -eq 'ts') {
$ts = $true
@ -195,6 +221,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
if ($version -lt '7.0') {
Install-Module -Name VcRedist -Force
$arch='x86'
$arch_name='386'
}
if ($version -eq $master_version) {
$version = 'master'
@ -203,7 +230,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
} else {
if((Test-Path env:update) -and $env:update -eq 'true') {
Update-Php $php_dir > $null 2>&1
Update-Php $php_dir >$null 2>&1
$status = "Updated to"
} else {
$status = "Found"

View File

@ -1,60 +1,20 @@
import * as utils from './utils';
/**
* Function to get command to setup tool
* Function to get command to setup tools
*
* @param os_version
*/
export async function getArchiveCommand(os_version: string): Promise<string> {
export async function getCommand(
os_version: string,
suffix: string
): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_tool ';
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-Tool ';
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}
/**
* Function to get command to setup tools using composer
*
* @param os_version
*/
export async function getPackageCommand(os_version: string): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_composer_tool ';
case 'win32':
return 'Add-Composer-Tool ';
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}
/**
*
* Function to get command to setup PECL
*
* @param os_version
*/
export async function getPECLCommand(os_version: string): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_pecl ';
case 'win32':
return 'Add-PECL ';
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
@ -226,12 +186,12 @@ export async function addPhive(
switch (version) {
case 'latest':
return (
(await getArchiveCommand(os_version)) +
(await getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive'
);
default:
return (
(await getArchiveCommand(os_version)) +
(await getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
@ -242,20 +202,21 @@ export async function addPhive(
}
/**
* Function to get the PHPUnit url
* Function to get the phar url in domain/tool-version.phar format
*
* @param version
*/
export async function getPhpunitUrl(
export async function getPharUrl(
domain: string,
tool: string,
prefix: string,
version: string
): Promise<string> {
const phpunit = 'https://phar.phpunit.de';
switch (version) {
case 'latest':
return phpunit + '/' + tool + '.phar';
return domain + '/' + tool + '.phar';
default:
return phpunit + '/' + tool + '-' + version + '.phar';
return domain + '/' + tool + '-' + prefix + version + '.phar';
}
}
@ -308,6 +269,27 @@ export async function getSymfonyUri(
}
}
/**
* Function to get the WP-CLI url
*
* @param version
*/
export async function getWpCliUrl(version: string): Promise<string> {
switch (version) {
case 'latest':
return 'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true';
default:
return await getUri(
'wp-cli',
'-' + version + '.phar',
version,
'wp-cli/wp-cli/releases',
'v',
'download'
);
}
}
/**
* Function to add/move composer in the tools list
*
@ -341,7 +323,7 @@ export async function getCleanedToolsList(
.map(function(extension: string) {
return extension
.trim()
.replace(/robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
.replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
})
.filter(Boolean);
return [...new Set(tools_list)];
@ -361,7 +343,7 @@ export async function addArchive(
url: string,
os_version: string
): Promise<string> {
return (await getArchiveCommand(os_version)) + url + ' ' + tool;
return (await getCommand(os_version, 'tool')) + url + ' ' + tool;
}
/**
@ -413,7 +395,7 @@ export async function addPackage(
prefix: string,
os_version: string
): Promise<string> {
const tool_command = await getPackageCommand(os_version);
const tool_command = await getCommand(os_version, 'composertool');
return tool_command + tool + ' ' + release + ' ' + prefix;
}
@ -446,6 +428,17 @@ export async function addTools(
script += '\n';
let url = '';
switch (tool) {
case 'blackfire':
case 'blackfire-agent':
script += await getCommand(
os_version,
'blackfire ' + (await utils.getBlackfireAgentVersion())
);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, version, url, os_version);
break;
case 'cs2pr':
uri = await getUri(tool, '', version, 'releases', '', 'download');
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
@ -477,8 +470,10 @@ export async function addTools(
script += await addArchive(tool, version, url, os_version);
break;
case 'composer':
url =
github + 'composer/composer/releases/latest/download/composer.phar';
// If RC is released as latest release, switch to getcomposer.
// Prefered source is GitHub as it is faster.
// url = github + 'composer/composer/releases/latest/download/composer.phar';
url = 'https://getcomposer.org/composer-stable.phar';
script += await addArchive(tool, version, url, os_version);
break;
case 'codeception':
@ -489,13 +484,16 @@ export async function addTools(
break;
case 'phpcpd':
case 'phpunit':
url = await getPhpunitUrl(tool, version);
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
script += await addArchive(tool, version, url, os_version);
break;
case 'deployer':
url = await getDeployerUrl(version);
script += await addArchive(tool, version, url, os_version);
break;
case 'flex':
script += await addPackage(tool, release, 'symfony/', os_version);
break;
case 'phinx':
script += await addPackage(tool, release, 'robmorgan/', os_version);
break;
@ -511,7 +509,7 @@ export async function addTools(
);
break;
case 'pecl':
script += await getPECLCommand(os_version);
script += await getCommand(os_version, 'pecl');
break;
case 'php-config':
case 'phpize':
@ -523,6 +521,10 @@ export async function addTools(
url = github + 'symfony/cli/' + uri;
script += await addArchive('symfony', version, url, os_version);
break;
case 'wp-cli':
url = github + (await getWpCliUrl(version));
script += await addArchive(tool, version, url, os_version);
break;
default:
script += await utils.addLog(
'$cross',

View File

@ -261,3 +261,28 @@ export async function suppressOutput(os_version: string): Promise<string> {
);
}
}
/**
* Function to get Blackfire version
*
* @param blackfire_version
*/
export async function getBlackfireVersion(
blackfire_version: null | undefined | string
): Promise<string> {
switch (blackfire_version) {
case null:
case undefined:
case '':
return '1.31.0';
default:
return blackfire_version;
}
}
/**
* Function to get Blackfire Agent version
*/
export async function getBlackfireAgentVersion(): Promise<string> {
return '1.32.0';
}