mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 21:33:06 +07:00
commit
9dae796baf
2
.github/SECURITY.md
vendored
2
.github/SECURITY.md
vendored
@ -7,7 +7,7 @@ The following versions of this project are supported for security updates.
|
|||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 1.9.x | :white_check_mark: |
|
| 1.9.x | :white_check_mark: |
|
||||||
| 2.3.x | :white_check_mark: |
|
| 2.4.x | :white_check_mark: |
|
||||||
|
|
||||||
## Supported PHP Versions
|
## Supported PHP Versions
|
||||||
|
|
||||||
|
2
.github/workflows/node-workflow.yml
vendored
2
.github/workflows/node-workflow.yml
vendored
@ -48,4 +48,4 @@ jobs:
|
|||||||
- name: Send Coverage
|
- name: Send Coverage
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
|
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}
|
||||||
|
@ -149,7 +149,7 @@ with:
|
|||||||
|
|
||||||
These tools can be setup globally using the `tools` input.
|
These tools can be setup globally using the `tools` input.
|
||||||
|
|
||||||
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`, `vapor-cli`
|
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@ -544,7 +544,7 @@ If your project has node.js dependencies, you can persist npm's or yarn's cache
|
|||||||
|
|
||||||
### Composer GitHub OAuth
|
### Composer GitHub OAuth
|
||||||
|
|
||||||
If you have a number of workflows which setup multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. To avoid that you can add a `OAuth` token to the composer's config by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
|
If you have a number of workflows which setup multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. To avoid that you can add an `OAuth` token to the composer's config by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
@ -634,7 +634,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
|||||||
## :scroll: License
|
## :scroll: License
|
||||||
|
|
||||||
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
|
- The scripts and documentation in this project are 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.
|
- This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
|
||||||
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
|
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
|
||||||
|
|
||||||
## :+1: Contributions
|
## :+1: Contributions
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
import * as extensions from '../src/extensions';
|
import * as extensions from '../src/extensions';
|
||||||
|
|
||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking getXdebugVersion', async () => {
|
|
||||||
expect(await extensions.getXdebugVersion('5.3')).toContain('2.2.7');
|
|
||||||
expect(await extensions.getXdebugVersion('5.4')).toContain('2.4.1');
|
|
||||||
expect(await extensions.getXdebugVersion('5.5')).toContain('2.5.5');
|
|
||||||
expect(await extensions.getXdebugVersion('5.6')).toContain('2.5.5');
|
|
||||||
expect(await extensions.getXdebugVersion('7.0')).toContain('2.7.2');
|
|
||||||
expect(await extensions.getXdebugVersion('7.2')).toContain('2.9.6');
|
|
||||||
});
|
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
||||||
@ -19,14 +11,19 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Add-Extension pcov');
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
expect(win32).toContain('Add-Extension sqlite3');
|
expect(win32).toContain('Add-Extension sqlite3');
|
||||||
expect(win32).toContain('Remove-Extension intl');
|
expect(win32).toContain('Remove-Extension intl');
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||||
expect(win32).toContain('ioncube.ps1 7.4');
|
expect(win32).toContain('Add-Ioncube');
|
||||||
expect(win32).toContain('oci.ps1 oci8 7.4');
|
expect(win32).toContain('Add-OCI oci8');
|
||||||
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
|
expect(win32).toContain('Add-OCI pdo_oci');
|
||||||
expect(win32).toContain('Add-Extension ast beta');
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
|
||||||
|
expect(win32).toContain(
|
||||||
|
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
@ -46,17 +43,17 @@ describe('Extension tests', () => {
|
|||||||
'win32',
|
'win32',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon3');
|
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||||
expect(win32).toContain('Add-Extension does_not_exist');
|
expect(win32).toContain('Add-Extension does_not_exist');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||||
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
|
expect(win32).toContain('Add-Blackfire blackfire');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||||
expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0');
|
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
@ -65,7 +62,6 @@ describe('Extension tests', () => {
|
|||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('update_extension xdebug 2.9.6');
|
|
||||||
expect(linux).toContain(
|
expect(linux).toContain(
|
||||||
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
|
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
|
||||||
);
|
);
|
||||||
@ -89,39 +85,35 @@ describe('Extension tests', () => {
|
|||||||
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
|
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('pcov', '5.6', 'linux');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('add_gearman');
|
||||||
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
|
||||||
expect(linux).toContain('gearman.sh 7.1');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
|
||||||
expect(linux).toContain('gearman.sh 7.2');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
|
||||||
expect(linux).toContain('gearman.sh 7.3');
|
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.4');
|
expect(linux).toContain('add_gearman');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(linux).toContain('Platform fedora is not supported');
|
expect(linux).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||||
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
expect(linux).toContain('add_phalcon phalcon3');
|
||||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
expect(linux).toContain('add_phalcon phalcon4');
|
||||||
|
|
||||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
||||||
expect(linux).toContain('ioncube.sh 7.3');
|
expect(linux).toContain('add_ioncube');
|
||||||
|
|
||||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||||
expect(linux).toContain('oci.sh oci8 7.3');
|
expect(linux).toContain('add_oci oci8');
|
||||||
expect(linux).toContain('oci.sh pdo_oci 7.3');
|
expect(linux).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
||||||
expect(linux).toContain('blackfire.sh 7.3 blackfire');
|
expect(linux).toContain('add_blackfire blackfire');
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
|
||||||
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
|
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
@ -135,39 +127,32 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('add_brew_extension grpc');
|
expect(darwin).toContain('add_brew_extension grpc');
|
||||||
expect(darwin).toContain('add_brew_extension protobuf');
|
expect(darwin).toContain('add_brew_extension protobuf');
|
||||||
expect(darwin).toContain('add_brew_extension swoole');
|
expect(darwin).toContain('add_brew_extension swoole');
|
||||||
expect(darwin).toContain('sudo pecl install -f sqlite3');
|
expect(darwin).toContain('pecl_install sqlite3');
|
||||||
expect(darwin).toContain('remove_extension intl');
|
expect(darwin).toContain('remove_extension intl');
|
||||||
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
expect(darwin).toContain('add_unstable_extension ast beta extension');
|
||||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
expect(darwin).toContain('add_phalcon phalcon3');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
expect(darwin).toContain('add_phalcon phalcon4');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('ioncube.sh 7.3');
|
expect(darwin).toContain('add_ioncube');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('oci.sh oci8 7.3');
|
expect(darwin).toContain('add_oci oci8');
|
||||||
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
expect(darwin).toContain('add_oci pdo_oci');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install -f pcov');
|
expect(darwin).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
|
|
||||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
|
|
||||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.4.1');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
|
|
||||||
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
@ -178,24 +163,24 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
|
expect(darwin).toContain('pecl_install redis-2.2.8');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install -f redis');
|
expect(darwin).toContain('pecl_install redis');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
expect(darwin).toContain('pecl_install imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
|
expect(darwin).toContain('add_blackfire blackfire');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
||||||
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0');
|
expect(darwin).toContain('add_blackfire blackfire-1.31.0');
|
||||||
|
|
||||||
darwin = await extensions.addExtension(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
|
@ -402,9 +402,20 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain('Platform fedora is not supported');
|
expect(script).toContain('Platform fedora is not supported');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking addCustomTool', async () => {
|
||||||
|
let script: string = await tools.addCustomTool('tool', '1.2.3', 'linux');
|
||||||
|
expect(script).toContain('tool.sh\nadd_tool 1.2.3');
|
||||||
|
|
||||||
|
script = await tools.addCustomTool('tool', '1.2.3', 'darwin');
|
||||||
|
expect(script).toContain('tool.sh\nadd_tool 1.2.3');
|
||||||
|
|
||||||
|
script = await tools.addCustomTool('tool', '1.2.3', 'win32');
|
||||||
|
expect(script).toContain('tool.ps1\nAdd-Tool 1.2.3');
|
||||||
|
});
|
||||||
|
|
||||||
it('checking addTools on linux', async () => {
|
it('checking addTools on linux', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
|
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, protoc, symfony, wp-cli',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -436,6 +447,8 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain('add_protoc latest');
|
||||||
|
expect(script).toContain('add_grpc_php_plugin latest');
|
||||||
expect(script).toContain('add_pecl');
|
expect(script).toContain('add_pecl');
|
||||||
expect(script).toContain('add_composertool flex flex symfony/');
|
expect(script).toContain('add_composertool flex flex symfony/');
|
||||||
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||||
@ -455,6 +468,7 @@ describe('Tools tests', () => {
|
|||||||
'composer-unused',
|
'composer-unused',
|
||||||
'cs2pr:1.2.3',
|
'cs2pr:1.2.3',
|
||||||
'flex',
|
'flex',
|
||||||
|
'grpc_php_plugin:1.2.3',
|
||||||
'infection',
|
'infection',
|
||||||
'phan',
|
'phan',
|
||||||
'phan:2.7.2',
|
'phan:2.7.2',
|
||||||
@ -466,6 +480,7 @@ describe('Tools tests', () => {
|
|||||||
'phpcs',
|
'phpcs',
|
||||||
'phpize',
|
'phpize',
|
||||||
'phpmd',
|
'phpmd',
|
||||||
|
'protoc:v1.2.3',
|
||||||
'psalm',
|
'psalm',
|
||||||
'symfony',
|
'symfony',
|
||||||
'symfony:1.2.3',
|
'symfony:1.2.3',
|
||||||
@ -519,6 +534,8 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain('add_grpc_php_plugin 1.2.3');
|
||||||
|
expect(script).toContain('add_protoc 1.2.3');
|
||||||
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
|
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
|
||||||
expect(script).toContain('add_composertool flex flex symfony/');
|
expect(script).toContain('add_composertool flex flex symfony/');
|
||||||
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||||
|
@ -167,4 +167,23 @@ describe('Utils tests', () => {
|
|||||||
'Platform fedora is not supported'
|
'Platform fedora is not supported'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking getUnsupportedLog', async () => {
|
||||||
|
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
||||||
|
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking joins', async () => {
|
||||||
|
expect(await utils.joins('a', 'b', 'c')).toBe('a b c');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking scriptExtension', async () => {
|
||||||
|
expect(await utils.scriptExtension('linux')).toBe('.sh');
|
||||||
|
expect(await utils.scriptExtension('darwin')).toBe('.sh');
|
||||||
|
expect(await utils.scriptExtension('win32')).toBe('.ps1');
|
||||||
|
expect(await utils.scriptExtension('fedora')).toContain(
|
||||||
|
'Platform fedora is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
352
dist/index.js
vendored
352
dist/index.js
vendored
@ -1314,7 +1314,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
|
exports.scriptExtension = exports.joins = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
@ -1529,6 +1529,45 @@ async function suppressOutput(os_version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.suppressOutput = suppressOutput;
|
exports.suppressOutput = suppressOutput;
|
||||||
|
/**
|
||||||
|
* Function to get script to log unsupported extensions.
|
||||||
|
*
|
||||||
|
* @param extension
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
async function getUnsupportedLog(extension, version, os_version) {
|
||||||
|
return ('\n' +
|
||||||
|
(await addLog('$cross', extension, [extension, 'is not supported on PHP', version].join(' '), os_version)) +
|
||||||
|
'\n');
|
||||||
|
}
|
||||||
|
exports.getUnsupportedLog = getUnsupportedLog;
|
||||||
|
/**
|
||||||
|
* Function to join strings with space
|
||||||
|
*
|
||||||
|
* @param str
|
||||||
|
*/
|
||||||
|
async function joins(...str) {
|
||||||
|
return [...str].join(' ');
|
||||||
|
}
|
||||||
|
exports.joins = joins;
|
||||||
|
/**
|
||||||
|
* Function to get script extensions
|
||||||
|
*
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
async function scriptExtension(os_version) {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'win32':
|
||||||
|
return '.ps1';
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
return '.sh';
|
||||||
|
default:
|
||||||
|
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.scriptExtension = scriptExtension;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -1908,9 +1947,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getPharUrl = exports.addPhive = exports.getCodeceptionUri = exports.getCodeceptionUriBuilder = exports.getUri = exports.parseTool = exports.getToolVersion = exports.getCommand = void 0;
|
exports.addTools = exports.addCustomTool = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getPharUrl = exports.addPhive = exports.getCodeceptionUri = exports.getCodeceptionUriBuilder = exports.getUri = exports.parseTool = exports.getToolVersion = exports.getCommand = void 0;
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
const httpm = __importStar(__webpack_require__(539));
|
const httpm = __importStar(__webpack_require__(539));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
* Function to get command to setup tools
|
* Function to get command to setup tools
|
||||||
*
|
*
|
||||||
@ -1940,6 +1980,8 @@ async function getToolVersion(version) {
|
|||||||
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||||
version = version.replace(/[><=^]*/, '');
|
version = version.replace(/[><=^]*/, '');
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case version.charAt(0) == 'v':
|
||||||
|
return version.replace('v', '');
|
||||||
case composer_regex.test(version):
|
case composer_regex.test(version):
|
||||||
case semver_regex.test(version):
|
case semver_regex.test(version):
|
||||||
return version;
|
return version;
|
||||||
@ -2217,7 +2259,7 @@ async function getCleanedToolsList(tools_csv) {
|
|||||||
.map(function (extension) {
|
.map(function (extension) {
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
.replace(/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
return [...new Set(tools_list)];
|
return [...new Set(tools_list)];
|
||||||
@ -2269,6 +2311,20 @@ async function addPackage(tool, release, prefix, os_version) {
|
|||||||
return tool_command + tool + ' ' + release + ' ' + prefix;
|
return tool_command + tool + ' ' + release + ' ' + prefix;
|
||||||
}
|
}
|
||||||
exports.addPackage = addPackage;
|
exports.addPackage = addPackage;
|
||||||
|
/**
|
||||||
|
* Function to get script to add tools with custom support.
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
async function addCustomTool(tool, version, os_version) {
|
||||||
|
const script_extension = await utils.scriptExtension(os_version);
|
||||||
|
const script = path.join(__dirname, '../src/scripts/tools/' + tool + script_extension);
|
||||||
|
const command = await getCommand(os_version, tool);
|
||||||
|
return '. ' + script + '\n' + command + version;
|
||||||
|
}
|
||||||
|
exports.addCustomTool = addCustomTool;
|
||||||
/**
|
/**
|
||||||
* Setup tools
|
* Setup tools
|
||||||
*
|
*
|
||||||
@ -2289,8 +2345,9 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'grpc_php_plugin':
|
||||||
script += await getCommand(os_version, 'blackfire');
|
case 'protoc':
|
||||||
|
script += await addCustomTool(tool, version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
@ -3568,30 +3625,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.getXdebugVersion = void 0;
|
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.customExtension = void 0;
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
/**
|
/**
|
||||||
* Function to get Xdebug version compatible with php versions
|
* Function to get script to install custom extensions
|
||||||
*
|
*
|
||||||
* @param version
|
* @param script
|
||||||
|
* @param command
|
||||||
*/
|
*/
|
||||||
async function getXdebugVersion(version) {
|
async function customExtension(script, ...command) {
|
||||||
switch (version) {
|
return ('\n. ' +
|
||||||
case '5.3':
|
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||||
return '2.2.7';
|
'\n' +
|
||||||
case '5.4':
|
(await utils.joins(...command)));
|
||||||
return '2.4.1';
|
|
||||||
case '5.5':
|
|
||||||
case '5.6':
|
|
||||||
return '2.5.5';
|
|
||||||
case '7.0':
|
|
||||||
return '2.7.2';
|
|
||||||
default:
|
|
||||||
return '2.9.6';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.getXdebugVersion = getXdebugVersion;
|
exports.customExtension = customExtension;
|
||||||
/**
|
/**
|
||||||
* Install and enable extensions for darwin
|
* Install and enable extensions for darwin
|
||||||
*
|
*
|
||||||
@ -3607,7 +3656,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
const [ext_name, ext_version] = extension.split('-');
|
const [ext_name, ext_version] = extension.split('-');
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
const command_prefix = 'sudo pecl install -f ';
|
const command_prefix = 'pecl_install ';
|
||||||
let command = '';
|
let command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match :extension
|
// match :extension
|
||||||
@ -3617,44 +3666,37 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
// match 5.3blackfire-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):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
command =
|
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||||
'bash ' +
|
return;
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
// match pdo_oci and oci8
|
||||||
' ' +
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
version +
|
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||||
' ' +
|
return;
|
||||||
extension;
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
break;
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
|
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||||
|
return;
|
||||||
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
|
||||||
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script +=
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
'\nadd_unstable_extension ' +
|
|
||||||
ext_name +
|
|
||||||
' ' +
|
|
||||||
ext_version +
|
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
add_script +=
|
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||||
'\nadd_pecl_extension ' +
|
return;
|
||||||
ext_name +
|
// match 5.3pcov to 7.0pcov
|
||||||
' ' +
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
ext_version +
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
return;
|
||||||
// match 5.3xdebug...5.5xdebug
|
|
||||||
case /5\.[3-5]xdebug/.test(version_extension):
|
|
||||||
command =
|
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
|
||||||
break;
|
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + ext_name;
|
command = 'add_brew_extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
@ -3664,53 +3706,18 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
break;
|
break;
|
||||||
// match imagick
|
// match imagick
|
||||||
case /^imagick$/.test(extension):
|
case /^imagick$/.test(extension):
|
||||||
command =
|
command = await utils.joins('brew install pkg-config imagemagick' + pipe, '&& ' + command_prefix + 'imagick' + pipe);
|
||||||
'brew install pkg-config imagemagick' +
|
|
||||||
pipe +
|
|
||||||
' && ' +
|
|
||||||
command_prefix +
|
|
||||||
'imagick' +
|
|
||||||
pipe;
|
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
// match pdo_oci and oci8
|
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script += await utils.joins('\nadd_extension', extension, '"' + command + '"', ext_prefix);
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
@ -3733,32 +3740,41 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
return;
|
break;
|
||||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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
|
// 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):
|
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
add_script +=
|
add_script += await customExtension('blackfire.ps1', 'Add-Blackfire', extension);
|
||||||
'\n& ' +
|
break;
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
// match pdo_oci and oci8
|
||||||
' ' +
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
version +
|
add_script += await customExtension('oci.ps1', 'Add-OCI', extension);
|
||||||
' ' +
|
break;
|
||||||
extension;
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
return;
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
|
add_script += await customExtension('ioncube.ps1', 'Add-Ioncube');
|
||||||
|
break;
|
||||||
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
add_script += await customExtension('phalcon.ps1', 'Add-Phalcon', extension);
|
||||||
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
||||||
return;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
||||||
add_script +=
|
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2], matches[1]);
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
break;
|
||||||
return;
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3mysql..5.6mysql
|
||||||
// match 5.3mysqli..5.6mysqli
|
// match 5.3mysqli..5.6mysqli
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
// match 5.3mysqlnd..5.6mysqlnd
|
||||||
@ -3775,38 +3791,7 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||||
break;
|
|
||||||
// match pdo_oci and oci8
|
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.ps1') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.ps1') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.ps1') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + extension;
|
||||||
@ -3841,70 +3826,35 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||||
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
|
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
|
||||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
command =
|
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||||
'bash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
' ' +
|
|
||||||
extension;
|
|
||||||
break;
|
|
||||||
// match pre-release versions. For example - xdebug-beta
|
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nadd_unstable_extension ' +
|
|
||||||
ext_name +
|
|
||||||
' ' +
|
|
||||||
ext_version +
|
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nadd_pecl_extension ' +
|
|
||||||
ext_name +
|
|
||||||
' ' +
|
|
||||||
ext_version +
|
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
|
||||||
// match 5.6gearman..7.4gearman
|
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
|
||||||
command =
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
pipe;
|
|
||||||
break;
|
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
add_script +=
|
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
return;
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
add_script +=
|
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
return;
|
||||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
add_script +=
|
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
|
||||||
'\nbash ' +
|
return;
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
// match 5.6gearman..7.4gearman
|
||||||
' ' +
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
extension +
|
add_script += await customExtension('gearman.sh', 'add_gearman');
|
||||||
' ' +
|
return;
|
||||||
version;
|
// match pre-release versions. For example - xdebug-beta
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
|
return;
|
||||||
|
// match semver versions
|
||||||
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
|
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||||
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug3..7.4xdebug3
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
@ -3916,20 +3866,9 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
extension = 'xdebug';
|
extension = 'xdebug';
|
||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match 7.1xdebug..7.4xdebug
|
|
||||||
case /^7\.[1-4]xdebug$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nupdate_extension xdebug 2.9.6' +
|
|
||||||
pipe +
|
|
||||||
'\n' +
|
|
||||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
|
||||||
return;
|
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
.replace('pdo_', '')
|
|
||||||
.replace('pdo-', '')
|
|
||||||
.replace('sqlite3', 'sqlite');
|
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match ast and uopz
|
||||||
@ -3945,8 +3884,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script += await utils.joins('\nadd_extension', extension, '"' + command + '"', ext_prefix);
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
|
1105
package-lock.json
generated
1105
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -31,21 +31,21 @@
|
|||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.5",
|
"@types/jest": "^26.0.8",
|
||||||
"@types/node": "^14.0.23",
|
"@types/node": "^14.0.27",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
"@typescript-eslint/eslint-plugin": "^3.7.1",
|
||||||
"@typescript-eslint/parser": "^3.6.1",
|
"@typescript-eslint/parser": "^3.7.1",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^7.5.0",
|
"eslint": "^7.6.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.22.0",
|
||||||
"eslint-plugin-jest": "^23.18.0",
|
"eslint-plugin-jest": "^23.20.0",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jest": "^26.1.0",
|
"jest": "^26.2.2",
|
||||||
"jest-circus": "^26.1.0",
|
"jest-circus": "^26.2.2",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"ts-jest": "^26.1.3",
|
"ts-jest": "^26.1.4",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.7"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
|
@ -2,24 +2,21 @@ import * as path from 'path';
|
|||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get Xdebug version compatible with php versions
|
* Function to get script to install custom extensions
|
||||||
*
|
*
|
||||||
* @param version
|
* @param script
|
||||||
|
* @param command
|
||||||
*/
|
*/
|
||||||
export async function getXdebugVersion(version: string): Promise<string> {
|
export async function customExtension(
|
||||||
switch (version) {
|
script: string,
|
||||||
case '5.3':
|
...command: string[]
|
||||||
return '2.2.7';
|
): Promise<string> {
|
||||||
case '5.4':
|
return (
|
||||||
return '2.4.1';
|
'\n. ' +
|
||||||
case '5.5':
|
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||||
case '5.6':
|
'\n' +
|
||||||
return '2.5.5';
|
(await utils.joins(...command))
|
||||||
case '7.0':
|
);
|
||||||
return '2.7.2';
|
|
||||||
default:
|
|
||||||
return '2.9.6';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +38,7 @@ export async function addExtensionDarwin(
|
|||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
const command_prefix = 'sudo pecl install -f ';
|
const command_prefix = 'pecl_install ';
|
||||||
let command = '';
|
let command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
// match :extension
|
// match :extension
|
||||||
@ -53,44 +50,55 @@ export async function addExtensionDarwin(
|
|||||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
command =
|
add_script += await customExtension(
|
||||||
'bash ' +
|
'blackfire.sh',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
'add_blackfire',
|
||||||
' ' +
|
extension
|
||||||
version +
|
);
|
||||||
' ' +
|
return;
|
||||||
extension;
|
// match pdo_oci and oci8
|
||||||
break;
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
|
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||||
|
return;
|
||||||
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
|
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||||
|
return;
|
||||||
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
add_script += await customExtension(
|
||||||
|
'phalcon.sh',
|
||||||
|
'add_phalcon',
|
||||||
|
extension
|
||||||
|
);
|
||||||
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script +=
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension ' +
|
'\nadd_unstable_extension',
|
||||||
ext_name +
|
ext_name,
|
||||||
' ' +
|
ext_version,
|
||||||
ext_version +
|
ext_prefix
|
||||||
' ' +
|
);
|
||||||
ext_prefix;
|
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
add_script +=
|
add_script += await utils.joins(
|
||||||
'\nadd_pecl_extension ' +
|
'\nadd_pecl_extension',
|
||||||
ext_name +
|
ext_name,
|
||||||
' ' +
|
ext_version,
|
||||||
ext_version +
|
ext_prefix
|
||||||
' ' +
|
);
|
||||||
ext_prefix;
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.3xdebug...5.5xdebug
|
|
||||||
case /5\.[3-5]xdebug/.test(version_extension):
|
|
||||||
command =
|
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
|
||||||
break;
|
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + ext_name;
|
command = 'add_brew_extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
@ -100,53 +108,26 @@ export async function addExtensionDarwin(
|
|||||||
break;
|
break;
|
||||||
// match imagick
|
// match imagick
|
||||||
case /^imagick$/.test(extension):
|
case /^imagick$/.test(extension):
|
||||||
command =
|
command = await utils.joins(
|
||||||
'brew install pkg-config imagemagick' +
|
'brew install pkg-config imagemagick' + pipe,
|
||||||
pipe +
|
'&& ' + command_prefix + 'imagick' + pipe
|
||||||
' && ' +
|
);
|
||||||
command_prefix +
|
|
||||||
'imagick' +
|
|
||||||
pipe;
|
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
// match pdo_oci and oci8
|
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon_darwin.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
command = command_prefix + extension;
|
command = command_prefix + extension;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script += await utils.joins(
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension',
|
||||||
|
extension,
|
||||||
|
'"' + command + '"',
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
@ -172,28 +153,51 @@ export async function addExtensionWindows(
|
|||||||
// Match :extension
|
// Match :extension
|
||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||||
return;
|
break;
|
||||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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
|
// 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(
|
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
add_script +=
|
add_script += await customExtension(
|
||||||
'\n& ' +
|
'blackfire.ps1',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
'Add-Blackfire',
|
||||||
' ' +
|
extension
|
||||||
version +
|
);
|
||||||
' ' +
|
break;
|
||||||
extension;
|
// match pdo_oci and oci8
|
||||||
return;
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
|
add_script += await customExtension('oci.ps1', 'Add-OCI', extension);
|
||||||
|
break;
|
||||||
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
|
add_script += await customExtension('ioncube.ps1', 'Add-Ioncube');
|
||||||
|
break;
|
||||||
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
|
add_script += await customExtension(
|
||||||
|
'phalcon.ps1',
|
||||||
|
'Add-Phalcon',
|
||||||
|
extension
|
||||||
|
);
|
||||||
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
add_script += await utils.joins(
|
||||||
|
'\nAdd-Extension',
|
||||||
|
ext_name,
|
||||||
|
ext_version
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
add_script += await utils.joins(
|
||||||
return;
|
'\nAdd-Extension',
|
||||||
|
ext_name,
|
||||||
|
'stable',
|
||||||
|
ext_version
|
||||||
|
);
|
||||||
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
||||||
version_extension
|
version_extension
|
||||||
@ -201,9 +205,17 @@ export async function addExtensionWindows(
|
|||||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
|
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
|
||||||
version_extension
|
version_extension
|
||||||
) as RegExpExecArray;
|
) as RegExpExecArray;
|
||||||
add_script +=
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
'\nAdd-Extension',
|
||||||
return;
|
ext_name,
|
||||||
|
matches[2],
|
||||||
|
matches[1]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3mysql..5.6mysql
|
||||||
// match 5.3mysqli..5.6mysqli
|
// match 5.3mysqli..5.6mysqli
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
// match 5.3mysqlnd..5.6mysqlnd
|
||||||
@ -220,38 +232,7 @@ export async function addExtensionWindows(
|
|||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||||
break;
|
|
||||||
// match pdo_oci and oci8
|
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.ps1') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.ps1') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\n& ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.ps1') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + extension;
|
||||||
@ -292,70 +273,53 @@ export async function addExtensionLinux(
|
|||||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
command =
|
add_script += await customExtension(
|
||||||
'bash ' +
|
'blackfire.sh',
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
|
'add_blackfire',
|
||||||
' ' +
|
extension
|
||||||
version +
|
);
|
||||||
' ' +
|
|
||||||
extension;
|
|
||||||
break;
|
|
||||||
// match pre-release versions. For example - xdebug-beta
|
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nadd_unstable_extension ' +
|
|
||||||
ext_name +
|
|
||||||
' ' +
|
|
||||||
ext_version +
|
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nadd_pecl_extension ' +
|
|
||||||
ext_name +
|
|
||||||
' ' +
|
|
||||||
ext_version +
|
|
||||||
' ' +
|
|
||||||
ext_prefix;
|
|
||||||
return;
|
|
||||||
// match 5.6gearman..7.4gearman
|
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
|
||||||
command =
|
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
pipe;
|
|
||||||
break;
|
|
||||||
// match pdo_oci and oci8
|
// match pdo_oci and oci8
|
||||||
case /^pdo_oci$|^oci8$/.test(extension):
|
case /^pdo_oci$|^oci8$/.test(extension):
|
||||||
add_script +=
|
add_script += await customExtension('oci.sh', 'add_oci', extension);
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
|
||||||
' ' +
|
|
||||||
extension +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
return;
|
||||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||||
add_script +=
|
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||||
'\nbash ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
|
||||||
' ' +
|
|
||||||
version;
|
|
||||||
return;
|
return;
|
||||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
add_script +=
|
add_script += await customExtension(
|
||||||
'\nbash ' +
|
'phalcon.sh',
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
'add_phalcon',
|
||||||
' ' +
|
extension
|
||||||
extension +
|
);
|
||||||
' ' +
|
return;
|
||||||
version;
|
// match 5.6gearman..7.4gearman
|
||||||
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
|
add_script += await customExtension('gearman.sh', 'add_gearman');
|
||||||
|
return;
|
||||||
|
// match pre-release versions. For example - xdebug-beta
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
add_script += await utils.joins(
|
||||||
|
'\nadd_unstable_extension',
|
||||||
|
ext_name,
|
||||||
|
ext_version,
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
// match semver versions
|
||||||
|
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||||
|
add_script += await utils.joins(
|
||||||
|
'\nadd_pecl_extension',
|
||||||
|
ext_name,
|
||||||
|
ext_version,
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug3..7.4xdebug3
|
// match 7.2xdebug3..7.4xdebug3
|
||||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||||
@ -367,20 +331,9 @@ export async function addExtensionLinux(
|
|||||||
extension = 'xdebug';
|
extension = 'xdebug';
|
||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
// match 7.1xdebug..7.4xdebug
|
|
||||||
case /^7\.[1-4]xdebug$/.test(version_extension):
|
|
||||||
add_script +=
|
|
||||||
'\nupdate_extension xdebug 2.9.6' +
|
|
||||||
pipe +
|
|
||||||
'\n' +
|
|
||||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
|
||||||
return;
|
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /.*pdo[_-].*/.test(version_extension):
|
||||||
extension = extension
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
.replace('pdo_', '')
|
|
||||||
.replace('pdo-', '')
|
|
||||||
.replace('sqlite3', 'sqlite');
|
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
// match ast and uopz
|
// match ast and uopz
|
||||||
@ -396,8 +349,12 @@ export async function addExtensionLinux(
|
|||||||
command = command_prefix + version + '-' + extension + pipe;
|
command = command_prefix + version + '-' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script += await utils.joins(
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension',
|
||||||
|
extension,
|
||||||
|
'"' + command + '"',
|
||||||
|
ext_prefix
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,16 @@ add_log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to log result of installing extension.
|
||||||
|
add_extension_log() {
|
||||||
|
extension=$1
|
||||||
|
status=$2
|
||||||
|
extension_name=$(echo "$extension" | cut -d '-' -f 1)
|
||||||
|
(
|
||||||
|
check_extension "$extension_name" && add_log "$tick" "$extension_name" "$status"
|
||||||
|
) || add_log "$cross" "$extension_name" "Could not install $extension on PHP $semver"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to read env inputs.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||||
@ -28,7 +38,7 @@ read_env() {
|
|||||||
self_hosted_setup() {
|
self_hosted_setup() {
|
||||||
if [[ $(command -v brew) == "" ]]; then
|
if [[ $(command -v brew) == "" ]]; then
|
||||||
step_log "Setup Brew"
|
step_log "Setup Brew"
|
||||||
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
|
curl "${curl_opts[@]}" https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1
|
||||||
add_log "$tick" "Brew" "Installed Homebrew"
|
add_log "$tick" "Brew" "Installed Homebrew"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -62,7 +72,7 @@ get_pecl_version() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
|
||||||
@ -70,6 +80,12 @@ get_pecl_version() {
|
|||||||
echo "$pecl_version"
|
echo "$pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to install PECL extensions and accept default options
|
||||||
|
pecl_install() {
|
||||||
|
local extension=$1
|
||||||
|
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install a specific version of PECL extension.
|
# Function to install a specific version of PECL extension.
|
||||||
add_pecl_extension() {
|
add_pecl_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -86,11 +102,8 @@ add_pecl_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
remove_extension "$extension" >/dev/null 2>&1
|
remove_extension "$extension" >/dev/null 2>&1
|
||||||
(
|
pecl_install "$extension-$pecl_version"
|
||||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
check_extension "$extension" &&
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +129,7 @@ add_extension() {
|
|||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
eval "$install_command" >/dev/null 2>&1 &&
|
eval "$install_command" >/dev/null 2>&1 &&
|
||||||
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,17 +149,13 @@ configure_composer() {
|
|||||||
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
add_log "$cross" "composer" "Could not download composer"
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
fi
|
fi
|
||||||
# TODO: Remove after composer 2.0 update, fixes peer fingerprint error
|
|
||||||
if [[ "$version" =~ $old_versions ]]; then
|
|
||||||
composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool.
|
# Function to setup a remote tool.
|
||||||
@ -159,18 +167,18 @@ add_tool() {
|
|||||||
rm -rf "$tool_path"
|
rm -rf "$tool_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
|
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
configure_composer "$tool_path"
|
configure_composer "$tool_path"
|
||||||
elif [ "$tool" = "phan" ]; then
|
elif [ "$tool" = "phan" ]; then
|
||||||
add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1
|
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
|
||||||
add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1
|
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
|
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
|
||||||
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
|
||||||
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
|
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
|
||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
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"
|
tr -d '\r' <"$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
||||||
@ -190,26 +198,10 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added"
|
||||||
add_log "$tick" "$tool" "Added"
|
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_blackfire() {
|
|
||||||
sudo mkdir -p usr/local/var/run
|
|
||||||
brew tap --shallow blackfireio/homebrew-blackfire >/dev/null 2>&1
|
|
||||||
brew install blackfire-agent >/dev/null 2>&1
|
|
||||||
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
|
||||||
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
add_log "$tick" "blackfire" "Added"
|
|
||||||
add_log "$tick" "blackfire-agent" "Added"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
for tool in pear pecl; do
|
for tool in pear pecl; do
|
||||||
@ -243,6 +235,7 @@ version=$1
|
|||||||
nodot_version=${1/./}
|
nodot_version=${1/./}
|
||||||
old_versions="5.[3-5]"
|
old_versions="5.[3-5]"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
|
curl_opts=(-sSL --retry 5 --retry-delay 1)
|
||||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||||
|
|
||||||
read_env
|
read_env
|
||||||
@ -258,7 +251,7 @@ fi
|
|||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
if [[ "$version" =~ $old_versions ]]; then
|
if [[ "$version" =~ $old_versions ]]; then
|
||||||
curl -sSL https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1 &&
|
curl "${curl_opts[@]}" https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1
|
||||||
status="Installed"
|
status="Installed"
|
||||||
elif [ "$existing_version" != "$version" ]; then
|
elif [ "$existing_version" != "$version" ]; then
|
||||||
setup_php "install" >/dev/null 2>&1
|
setup_php "install" >/dev/null 2>&1
|
||||||
|
@ -1,35 +1,28 @@
|
|||||||
Param (
|
# Function to install blackfire extension.
|
||||||
|
Function Add-Blackfire() {
|
||||||
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[string]
|
[string]
|
||||||
$version,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[string]
|
|
||||||
$extension
|
$extension
|
||||||
)
|
)
|
||||||
|
try {
|
||||||
$tick = ([char]8730)
|
$no_dot_version = $version.replace('.', '')
|
||||||
$php_dir = 'C:\tools\php'
|
$extension_version = $extension.split('-')[1]
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
if ($extension_version -notmatch "\S") {
|
||||||
$ext_dir = "$php_dir\ext"
|
$extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php
|
||||||
$arch='x64'
|
}
|
||||||
if ($version -lt '7.0') { $arch='x86' }
|
if (Test-Path $ext_dir\blackfire.dll) {
|
||||||
$version = $version.replace('.', '')
|
|
||||||
$extension_version = $extension.split('-')[1]
|
|
||||||
if ($extension_version -notmatch "\S") {
|
|
||||||
$ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 2 }
|
|
||||||
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
|
|
||||||
}
|
|
||||||
if (Test-Path $ext_dir\blackfire.dll) {
|
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Enabled"
|
$status="Enabled"
|
||||||
} else {
|
} else {
|
||||||
$installed = Get-Php -Path $php_dir
|
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$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
|
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${extension_version}/blackfire-php-windows_${arch}-php-${no_dot_version}${nts}.dll" -OutFile $ext_dir\blackfire.dll > $null 2>&1
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Installed and enabled"
|
$status="Installed and enabled"
|
||||||
|
}
|
||||||
|
Add-Log $tick $extension $status
|
||||||
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "blackfire" "$status"
|
|
||||||
|
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
version=${1/./}
|
# Function to install blackfire extension.
|
||||||
extension=${2}
|
add_blackfire() {
|
||||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
extension=$1
|
||||||
if [ "$extension_version" = "blackfire" ]; then
|
version=${version:?}
|
||||||
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e 's/<[^>]*>\| //g' | sed -n '3,3p')
|
no_dot_version=${version/./}
|
||||||
fi
|
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||||
ini_file="$scan_dir/50-blackfire.ini"
|
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||||
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-linux_amd64-php-$version.so
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
echo "extension=blackfire.so" | sudo tee -a "$ini_file"
|
extension_version=$(curl -sSL https://blackfire.io/api/v1/releases | grep -Eo 'php":"([0-9]+.[0-9]+.[0-9]+)' | cut -d '"' -f 3)
|
||||||
|
fi
|
||||||
|
sudo curl -o "${ext_dir:?}/blackfire.so" "${curl_opts[@]:?}" https://packages.blackfire.io/binaries/blackfire-php/"$extension_version"/blackfire-php-"$platform"_amd64-php-"$no_dot_version".so >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
echo "extension=blackfire.so" | sudo tee -a "$blackfire_ini_file" >/dev/null 2>&1
|
||||||
|
add_extension_log "$extension-$extension_version" "Installed and enabled"
|
||||||
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
version=${1/./}
|
|
||||||
extension=${2}
|
|
||||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
|
||||||
if [ "$extension_version" = "blackfire" ]; then
|
|
||||||
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
|
|
||||||
fi
|
|
||||||
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"
|
|
@ -1,9 +1,23 @@
|
|||||||
release_version=$(lsb_release -s -r)
|
# Helper function to add gearman extension.
|
||||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
add_gearman_helper() {
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
sudo "${debconf_fix:?}" add-apt-repository ppa:ondrej/pkg-gearman -y
|
||||||
|
if [ -e "${ext_dir:?}/gearman.so" ] && [ "$DISTRIB_RELEASE" != "16.04" ]; then
|
||||||
|
${apt_install:?} libgearman-dev
|
||||||
|
echo "extension=gearman.so" | sudo tee -a "${scan_dir:?}/20-gearman.ini" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
status="Installed and enabled"
|
||||||
|
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||||
|
sudo "${debconf_fix:?}" apt-get update -y
|
||||||
|
${apt_install:?} php"${version:?}"-gearman
|
||||||
|
else
|
||||||
|
${apt_install:?} libgearman-dev php"${version:?}"-gearman
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$release_version" = "18.04" ]; then
|
# Function to add gearman extension.
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
add_gearman() {
|
||||||
elif [ "$release_version" = "16.04" ]; then
|
status="Enabled"
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
add_gearman_helper >/dev/null 2>&1
|
||||||
fi
|
add_extension_log "gearman" "$status"
|
||||||
|
}
|
||||||
|
@ -1,48 +1,32 @@
|
|||||||
Param (
|
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
|
||||||
[string]
|
|
||||||
$version
|
|
||||||
)
|
|
||||||
|
|
||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
Function Add-Log($mark, $subject, $message) {
|
Function Add-LicenseLog() {
|
||||||
if ($mark -eq $tick) {
|
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
|
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
Get-Content $ext_dir\ioncube\LICENSE.txt
|
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||||
Write-Output "::endgroup::"
|
Write-Output "::endgroup::"
|
||||||
} else {
|
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tick = ([char]8730)
|
# Function to add ioncube extension.
|
||||||
$cross = ([char]10007)
|
Function Add-Ioncube() {
|
||||||
$status = 'Enabled'
|
try {
|
||||||
$php_dir = 'C:\tools\php'
|
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
|
||||||
$ext_dir = "$php_dir\ext"
|
|
||||||
$installed = Get-Php $php_dir
|
|
||||||
try {
|
|
||||||
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$arch = 'x86-64'
|
$arch_part = $arch
|
||||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
if ($arch -eq 'x64') {
|
||||||
$arch = 'x86'
|
$arch_part = 'x86-64'
|
||||||
}
|
}
|
||||||
$vc = $installed.VCVersion
|
$vc = $installed.VCVersion
|
||||||
$ts = ""
|
$ts_part = ""
|
||||||
if (-not($installed.ThreadSafe)) {
|
if (-not($installed.ThreadSafe)) {
|
||||||
$ts = "_nonts"
|
$ts_part = "_nonts"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts`_vc$vc`_$arch.zip" -OutFile $ext_dir\ioncube.zip
|
Invoke-WebRequest -UseBasicParsing -Uri "https://downloads.ioncube.com/loader_downloads/ioncube_loaders_win$ts_part`_vc$vc`_$arch_part.zip" -OutFile $ext_dir\ioncube.zip
|
||||||
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
Expand-Archive -Path $ext_dir\ioncube.zip -DestinationPath $ext_dir -Force
|
||||||
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
Copy-Item $ext_dir\ioncube\ioncube_loader_win_$version.dll $ext_dir\php_ioncube.dll
|
||||||
}
|
}
|
||||||
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
|
"zend_extension=$ext_dir\php_ioncube.dll`r`n" + (Get-Content $php_dir\php.ini -Raw) | Set-Content $php_dir\php.ini
|
||||||
Add-Log $tick "ioncube" $status
|
Add-Log $tick "ioncube" $status
|
||||||
} catch {
|
Add-LicenseLog
|
||||||
|
} catch {
|
||||||
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,41 +1,19 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
add_log() {
|
add_license_log() {
|
||||||
mark=$1
|
|
||||||
subject=$2
|
|
||||||
message=$3
|
|
||||||
if [ "$mark" = "$tick" ]; then
|
|
||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
cat /tmp/ioncube/LICENSE.txt
|
cat /tmp/ioncube/LICENSE.txt
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
else
|
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to test if extension is loaded.
|
|
||||||
check_extension() {
|
|
||||||
extension=$1
|
|
||||||
php -m | grep -i -q -w "$extension"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install ioncube.
|
# Function to install ioncube.
|
||||||
install_ioncube() {
|
add_ioncube() {
|
||||||
if [ ! -e "$ext_dir/ioncube.so" ]; then
|
if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
|
||||||
os_name='lin'
|
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
[ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
||||||
curl -sSL https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
curl "${curl_opts[@]:?}" https://downloads.ioncube.com/loader_downloads/ioncube_loaders_"$os_name"_x86-64.tar.gz | tar -xzf - -C /tmp
|
||||||
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"$version".so "$ext_dir/ioncube.so"
|
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"${version:?}".so "$ext_dir/ioncube.so"
|
||||||
fi
|
fi
|
||||||
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "$scan_dir/00-ioncube.ini"
|
echo "zend_extension=$ext_dir/ioncube.so" | sudo tee "${scan_dir:?}/00-ioncube.ini" >/dev/null 2>&1
|
||||||
|
add_extension_log "ioncube" "$status"
|
||||||
|
check_extension "ioncube" && add_license_log
|
||||||
}
|
}
|
||||||
|
|
||||||
version=$1
|
|
||||||
tick='✓'
|
|
||||||
cross='✗'
|
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
|
||||||
status='Enabled'
|
|
||||||
install_ioncube >/dev/null 2>&1
|
|
||||||
(check_extension "ioncube" && add_log "$tick" "ioncube" "$status") || add_log "$cross" "ioncube" "Could not install ioncube"
|
|
||||||
|
@ -1,60 +1,45 @@
|
|||||||
Param (
|
# Function to log license information.
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
Function Add-LicenseLog() {
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateSet('oci8', 'pdo_oci')]
|
|
||||||
[string]
|
|
||||||
$extension,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
|
||||||
[string]
|
|
||||||
$version
|
|
||||||
)
|
|
||||||
|
|
||||||
# Function to log result of a operation.
|
|
||||||
Function Add-Log($mark, $subject, $message) {
|
|
||||||
if ($mark -eq $tick) {
|
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $mark $subject $message
|
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
||||||
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
||||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
Write-Output "::endgroup::"
|
Write-Output "::endgroup::"
|
||||||
} else {
|
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "31" $mark $subject $message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tick = ([char]8730)
|
# Function to get instantclinet.
|
||||||
$cross = ([char]10007)
|
Function Add-InstantClient() {
|
||||||
$php_dir = 'C:\tools\php'
|
|
||||||
$status = 'Enabled'
|
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
|
||||||
$ext_dir = "$php_dir\ext"
|
|
||||||
$installed = Get-Php -Path $php_dir
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (-not(Test-Path $php_dir\oci.dll)) {
|
if (-not(Test-Path $php_dir\oci.dll)) {
|
||||||
$suffix = 'windows'
|
$suffix = 'windows'
|
||||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
|
if ($arch -eq 'x86') {
|
||||||
{
|
|
||||||
$suffix = 'nt'
|
$suffix = 'nt'
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
Invoke-WebRequest -UseBasicParsing -Uri https://download.oracle.com/otn_software/nt/instantclient/instantclient-basiclite-$suffix.zip -OutFile $php_dir\instantclient.zip
|
||||||
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
Expand-Archive -Path $php_dir\instantclient.zip -DestinationPath $php_dir -Force
|
||||||
Copy-Item $php_dir\instantclient*\* $php_dir
|
Copy-Item $php_dir\instantclient*\* $php_dir
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install oci8 and pdo_oci.
|
||||||
|
Function Add-OCI() {
|
||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateSet('oci8', 'pdo_oci')]
|
||||||
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
$status = 'Enabled'
|
||||||
|
Add-InstantClient
|
||||||
if ($extension -eq "pdo_oci") {
|
if ($extension -eq "pdo_oci") {
|
||||||
Enable-PhpExtension pdo_oci -Path $php_dir
|
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
$status = 'Installed and enabled'
|
$status = 'Installed and enabled'
|
||||||
$ociVersion = '2.2.0'
|
$ociVersion = '2.2.0'
|
||||||
if ($version -eq '7.0')
|
if ($version -eq '7.0') {
|
||||||
{
|
|
||||||
$ociVersion = '2.1.8'
|
$ociVersion = '2.1.8'
|
||||||
}
|
} elseif ($version -lt '7.0') {
|
||||||
elseif ($version -lt '7.0')
|
|
||||||
{
|
|
||||||
$ociVersion = '2.0.12'
|
$ociVersion = '2.0.12'
|
||||||
}
|
}
|
||||||
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
|
||||||
@ -63,6 +48,8 @@ try
|
|||||||
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
|
||||||
}
|
}
|
||||||
Add-Log $tick $extension $status
|
Add-Log $tick $extension $status
|
||||||
} catch {
|
Add-LicenseLog
|
||||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
} catch {
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,24 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
add_log() {
|
add_license_log() {
|
||||||
mark=$1
|
|
||||||
subject=$2
|
|
||||||
message=$3
|
|
||||||
if [ "$mark" = "$tick" ]; then
|
|
||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
||||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
else
|
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to test if extension is loaded.
|
|
||||||
check_extension() {
|
|
||||||
extension=$1
|
|
||||||
php -m | grep -i -q -w "$extension"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the tag for a php version.
|
# Function to get the tag for a php version.
|
||||||
get_tag() {
|
get_tag() {
|
||||||
master_version='8.0'
|
master_version='8.0'
|
||||||
tag='master'
|
tag='master'
|
||||||
if [ ! "$version" = "$master_version" ]; then
|
if [ ! "${version:?}" = "$master_version" ]; then
|
||||||
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
tag="php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
|
||||||
fi
|
fi
|
||||||
echo "$tag"
|
echo "$tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install instantclient and SDK.
|
# Function to install instantclient and SDK.
|
||||||
install_client() {
|
add_client() {
|
||||||
sudo mkdir -p -m 777 "$oracle_home"
|
sudo mkdir -p -m 777 "$oracle_home"
|
||||||
if [ ! -e "$oracle_client" ]; then
|
if [ ! -e "$oracle_client" ]; then
|
||||||
for package in basiclite sdk; do
|
for package in basiclite sdk; do
|
||||||
@ -47,7 +33,7 @@ install_client() {
|
|||||||
arch='macos'
|
arch='macos'
|
||||||
lib_ext='dylib'
|
lib_ext='dylib'
|
||||||
fi
|
fi
|
||||||
curl -o "/opt/oracle/$package.zip" -sSL "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
curl -o "/opt/oracle/$package.zip" "${curl_opts[@]:?}" "https://download.oracle.com/otn_software/$os_name/instantclient/instantclient-$package-$arch.zip"
|
||||||
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
|
unzip "/opt/oracle/$package.zip" -d "$oracle_home"
|
||||||
done
|
done
|
||||||
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
||||||
@ -57,7 +43,7 @@ install_client() {
|
|||||||
|
|
||||||
# Function to get PHP source.
|
# Function to get PHP source.
|
||||||
get_php() {
|
get_php() {
|
||||||
[ ! -d "/opt/oracle/php-src-$tag" ] && curl -sSL "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
|
[ ! -d "/opt/oracle/php-src-$tag" ] && curl "${curl_opts[@]}" "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get phpize location on darwin.
|
# Function to get phpize location on darwin.
|
||||||
@ -86,55 +72,54 @@ restore_phpize() {
|
|||||||
|
|
||||||
# Function to patch pdo_oci.
|
# Function to patch pdo_oci.
|
||||||
patch_pdo_oci_config() {
|
patch_pdo_oci_config() {
|
||||||
curl -sSLO https://raw.githubusercontent.com/php/php-src/master/ext/pdo_oci/config.m4
|
curl -O "${curl_opts[@]}" https://raw.githubusercontent.com/php/php-src/master/ext/pdo_oci/config.m4
|
||||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install the dependencies.
|
# Function to install the dependencies.
|
||||||
install_dependencies() {
|
add_dependencies() {
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
if [ "$runner" = "self-hosted" ] || [ "$RUNNER" = "self-hosted" ]; then
|
if [ "${runner:?}" = "self-hosted" ]; then
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y autoconf automake libaio-dev gcc g++ php"$version"-dev
|
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||||
else
|
else
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$version"-dev
|
update_lists
|
||||||
|
${apt_install:?} php"$version"-dev
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install the extension.
|
# Function to install oci8 and pdo_oci.
|
||||||
install_extension() {
|
add_oci_helper() {
|
||||||
if ! [ -e "$ext_dir/$ext.so" ]; then
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
(
|
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
phpize_orig=$(get_phpize)
|
phpize_orig=$(get_phpize)
|
||||||
tag=$(get_tag)
|
tag=$(get_tag)
|
||||||
get_php
|
get_php
|
||||||
patch_phpize
|
patch_phpize
|
||||||
|
(
|
||||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
||||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
||||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
||||||
sudo make -j"$(nproc)"
|
sudo make -j"$(nproc)"
|
||||||
sudo cp ./modules/* "$ext_dir/"
|
sudo cp ./modules/* "$ext_dir/"
|
||||||
restore_phpize
|
|
||||||
)
|
)
|
||||||
|
restore_phpize
|
||||||
fi
|
fi
|
||||||
echo "extension=$ext.so" | sudo tee "$scan_dir/99-$ext.ini"
|
echo "extension=$ext.so" | sudo tee "${scan_dir:?}/99-$ext.ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
ext=$1
|
# Function to add oci extension oci8 and pdo_oci.
|
||||||
version=$2
|
add_oci() {
|
||||||
tick='✓'
|
ext=$1
|
||||||
cross='✗'
|
status='Enabled'
|
||||||
status='Enabled'
|
oracle_home='/opt/oracle'
|
||||||
oracle_home='/opt/oracle'
|
oracle_client=$oracle_home/instantclient
|
||||||
oracle_client=$oracle_home/instantclient
|
os=$(uname -s)
|
||||||
runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
|
add_client >/dev/null 2>&1
|
||||||
os=$(uname -s)
|
add_dependencies >/dev/null 2>&1
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
add_oci_helper >/dev/null 2>&1
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
add_extension_log "$ext" "$status"
|
||||||
install_client >/dev/null 2>&1
|
check_extension "$ext" && add_license_log
|
||||||
install_dependencies >/dev/null 2>&1
|
}
|
||||||
install_extension >/dev/null 2>&1
|
|
||||||
(check_extension "$ext" && add_log "$tick" "$ext" "$status") || add_log "$cross" "$ext" "Could not install $ext"
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
cd ~ && git clone --depth=1 https://github.com/krakjoe/pcov.git
|
|
||||||
cd pcov && phpize
|
|
||||||
./configure --enable-pcov
|
|
||||||
make
|
|
||||||
sudo make install
|
|
@ -1,22 +1,9 @@
|
|||||||
Param (
|
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateSet('phalcon3', 'phalcon4')]
|
|
||||||
[string]
|
|
||||||
$extension,
|
|
||||||
[Parameter(Position = 1, Mandatory = $true)]
|
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
|
||||||
[string]
|
|
||||||
$version
|
|
||||||
)
|
|
||||||
|
|
||||||
# Function to install phalcon
|
# Function to install phalcon
|
||||||
Function Install-Phalcon() {
|
Function Add-PhalconHelper() {
|
||||||
if ($extension_version -eq '4') {
|
if ($extension_version -eq '4') {
|
||||||
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
$installed = Get-Php -Path $php_dir
|
$domain = 'https://github.com'
|
||||||
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
||||||
$zip_file = $match.Matches[0].Groups[1].Value
|
$zip_file = $match.Matches[0].Groups[1].Value
|
||||||
@ -25,33 +12,44 @@ Function Install-Phalcon() {
|
|||||||
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
}
|
}
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tick = ([char]8730)
|
Function Add-Phalcon() {
|
||||||
$domain = 'https://github.com'
|
Param (
|
||||||
$php_dir = 'C:\tools\php'
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
[ValidateNotNull()]
|
||||||
$ext_dir = "$php_dir\ext"
|
[ValidateSet('phalcon3', 'phalcon4')]
|
||||||
$extension_version = $extension.substring($extension.Length - 1)
|
[string]
|
||||||
|
$extension
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
$status = 'Enabled'
|
||||||
|
$extension_version = $extension.substring($extension.Length - 1)
|
||||||
|
|
||||||
if($extension_version -eq '4') {
|
if($extension_version -eq '4') {
|
||||||
if (Test-Path $ext_dir\php_psr.dll) {
|
if (Test-Path $ext_dir\php_psr.dll) {
|
||||||
Enable-PhpExtension -Extension psr -Path $php_dir
|
Enable-PhpExtension -Extension psr -Path $php_dir
|
||||||
} else {
|
} else {
|
||||||
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Test-Path $ext_dir\php_phalcon.dll) {
|
if(Test-Path $ext_dir\php_phalcon.dll) {
|
||||||
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
|
||||||
if($phalcon.Version[0] -eq $extension_version) {
|
if($phalcon.Version[0] -eq $extension_version) {
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Enabled"
|
|
||||||
} else {
|
} else {
|
||||||
|
$status = 'Installed and enabled'
|
||||||
Remove-Item $ext_dir\php_phalcon.dll
|
Remove-Item $ext_dir\php_phalcon.dll
|
||||||
Install-Phalcon
|
Add-PhalconHelper
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = 'Installed and enabled'
|
||||||
|
Add-PhalconHelper
|
||||||
|
}
|
||||||
|
Add-Log $tick $extension $status
|
||||||
|
} catch [Exception] {
|
||||||
|
Write-Output $_.Exception|format-list -force
|
||||||
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Install-Phalcon
|
|
||||||
}
|
}
|
@ -1,71 +1,65 @@
|
|||||||
# Function to log result of a operation
|
# Helper function to add phalcon.
|
||||||
add_log() {
|
add_phalcon_helper() {
|
||||||
mark=$1
|
status='Installed and enabled'
|
||||||
subject=$2
|
if [ "$os_name" = "Linux" ]; then
|
||||||
message=$3
|
update_lists
|
||||||
if [ "$mark" = "$tick" ]; then
|
${apt_install:?} "php${version:?}-$extension"
|
||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
else
|
else
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
phalcon_ini_file=${ini_file:?}
|
||||||
|
sed -i '' '/extension.*psr/d' "${ini_file:?}"
|
||||||
|
brew tap shivammathur/homebrew-phalcon
|
||||||
|
brew install phalcon@"${version:?}"_"$extension_major_version"
|
||||||
|
sudo cp /usr/local/opt/psr@"${version:?}"/psr.so "${ext_dir:?}"
|
||||||
|
sudo cp /usr/local/opt/phalcon@"${version:?}"_"$extension_major_version"/phalcon.so "${ext_dir:?}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update php ppa
|
# Function to add phalcon3.
|
||||||
update_ppa() {
|
add_phalcon3() {
|
||||||
if [ "$ppa_updated" = "false" ]; then
|
if [ -e "${ext_dir:?}/phalcon.so" ]; then
|
||||||
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
ppa_updated="true"
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
|
add_phalcon_helper
|
||||||
|
else
|
||||||
|
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install phalcon
|
# Function to add phalcon4.
|
||||||
install_phalcon() {
|
add_phalcon4() {
|
||||||
extension=$1
|
if [ -e "${ext_dir:?}/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||||
version=$2
|
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
||||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
}
|
|
||||||
|
|
||||||
ini_file="/etc/php/$2/cli/conf.d/50-phalcon.ini"
|
|
||||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
|
||||||
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
|
||||||
ppa_updated="false"
|
|
||||||
tick="✓"
|
|
||||||
cross="✗"
|
|
||||||
|
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
|
||||||
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
|
||||||
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
if php -m | grep -i -q -w psr; then
|
if php -m | grep -i -q -w psr; then
|
||||||
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
install_phalcon "$1" "$2"
|
add_phalcon_helper
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [ "$extension_major_version" = "3" ]; then
|
# Function to add phalcon.
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
add_phalcon() {
|
||||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
extension=$1
|
||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
status='Enabled'
|
||||||
install_phalcon "$1" "$2"
|
os_name=$(uname -s)
|
||||||
else
|
phalcon_ini_file="${scan_dir:?}/50-phalcon.ini"
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
extension_major_version=${extension: -1}
|
||||||
add_log "$tick" "$1" "Enabled"
|
if [ "$extension_major_version" = "4" ]; then
|
||||||
|
add_phalcon4 >/dev/null 2>&1
|
||||||
|
elif [ "$extension_major_version" = "3" ]; then
|
||||||
|
add_phalcon3 >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
else
|
add_extension_log "phalcon" "$status"
|
||||||
install_phalcon "$1" "$2"
|
}
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
# Function to log result of a operation
|
|
||||||
add_log() {
|
|
||||||
mark=$1
|
|
||||||
subject=$2
|
|
||||||
message=$3
|
|
||||||
if [ "$mark" = "$tick" ]; then
|
|
||||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
else
|
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install phalcon
|
|
||||||
install_phalcon() {
|
|
||||||
(
|
|
||||||
sed -i '' '/extension.*psr/d' "$ini_file"
|
|
||||||
brew tap shivammathur/homebrew-phalcon >/dev/null 2>&1
|
|
||||||
brew install phalcon@"$php_version"_"$extension_major" >/dev/null 2>&1
|
|
||||||
sudo cp /usr/local/opt/psr@"$php_version"/psr.so "$ext_dir" >/dev/null 2>&1
|
|
||||||
sudo cp /usr/local/opt/phalcon@"$php_version"_"$extension_major"/phalcon.so "$ext_dir" >/dev/null 2>&1
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
}
|
|
||||||
|
|
||||||
tick="✓"
|
|
||||||
cross="✗"
|
|
||||||
extension=$1
|
|
||||||
extension_major=${extension: -1}
|
|
||||||
php_version=$2
|
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
|
||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
|
||||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
|
||||||
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
|
|
||||||
phalcon_version=$(php -d="extension=psr.so" -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
|
|
||||||
if php -m | grep -i -q -w psr; then
|
|
||||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" 2>/dev/null | cut -d'.' -f 1)
|
|
||||||
fi
|
|
||||||
if [ "$phalcon_version" != "$extension_major" ]; then
|
|
||||||
install_phalcon
|
|
||||||
else
|
|
||||||
if ! php -m | grep -i -q -w psr; then echo "extension=psr.so" >>"$ini_file"; fi
|
|
||||||
echo "extension=phalcon.so" >>"$ini_file"
|
|
||||||
add_log "$tick" "$extension" "Enabled"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
install_phalcon
|
|
||||||
fi
|
|
@ -16,6 +16,16 @@ add_log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to log result of installing extension.
|
||||||
|
add_extension_log() {
|
||||||
|
extension=$1
|
||||||
|
status=$2
|
||||||
|
extension_name=$(echo "$extension" | cut -d '-' -f 1)
|
||||||
|
(
|
||||||
|
check_extension "$extension_name" && add_log "$tick" "$extension_name" "$status"
|
||||||
|
) || add_log "$cross" "$extension_name" "Could not install $extension on PHP $semver"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to read env inputs.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
@ -35,15 +45,6 @@ cleanup_lists() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update the package lists.
|
|
||||||
update_lists() {
|
|
||||||
if [ "$lists_updated" = "false" ]; then
|
|
||||||
cleanup_lists
|
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
|
||||||
lists_updated="true"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to add ppa:ondrej/php.
|
# Function to add ppa:ondrej/php.
|
||||||
add_ppa() {
|
add_ppa() {
|
||||||
if ! apt-cache policy | grep -q ondrej/php; then
|
if ! apt-cache policy | grep -q ondrej/php; then
|
||||||
@ -55,6 +56,16 @@ add_ppa() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to update the package lists.
|
||||||
|
update_lists() {
|
||||||
|
if [ ! -e /tmp/setup_php ]; then
|
||||||
|
[ "$DISTRIB_RELEASE" = "20.04" ] && add_ppa >/dev/null 2>&1
|
||||||
|
cleanup_lists
|
||||||
|
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
||||||
|
echo '' | sudo tee "/tmp/setup_php" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup environment for self-hosted runners.
|
# Function to setup environment for self-hosted runners.
|
||||||
self_hosted_setup() {
|
self_hosted_setup() {
|
||||||
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
|
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
|
||||||
@ -82,7 +93,7 @@ get_pecl_version() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
|
||||||
if [ ! "$pecl_version" ]; then
|
if [ ! "$pecl_version" ]; then
|
||||||
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
||||||
@ -90,6 +101,12 @@ get_pecl_version() {
|
|||||||
echo "$pecl_version"
|
echo "$pecl_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to install PECL extensions and accept default options
|
||||||
|
pecl_install() {
|
||||||
|
local extension=$1
|
||||||
|
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to check if an extension is loaded.
|
# Function to check if an extension is loaded.
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -148,8 +165,7 @@ add_pdo_extension() {
|
|||||||
fi
|
fi
|
||||||
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
||||||
enable_extension "$pdo_ext" "extension"
|
enable_extension "$pdo_ext" "extension"
|
||||||
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
|
add_extension_log "$pdo_ext" "Enabled"
|
||||||
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +182,8 @@ add_extension() {
|
|||||||
install_command="update_lists && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
|
install_command="update_lists && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
|
||||||
fi
|
fi
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
eval "$install_command" >/dev/null 2>&1 ||
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) ||
|
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||||
sudo pecl install -f "$extension" >/dev/null 2>&1
|
add_extension_log "$extension" "Installed and enabled"
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
}
|
}
|
||||||
@ -190,11 +204,8 @@ add_pecl_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
else
|
else
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(
|
pecl_install "$extension-$pecl_version"
|
||||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
check_extension "$extension" &&
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,21 +218,6 @@ add_unstable_extension() {
|
|||||||
add_pecl_extension "$extension" "$pecl_version" "$prefix"
|
add_pecl_extension "$extension" "$pecl_version" "$prefix"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update extension.
|
|
||||||
update_extension() {
|
|
||||||
extension=$1
|
|
||||||
latest_version=$2
|
|
||||||
current_version=$(php -r "echo phpversion('$extension');")
|
|
||||||
final_version=$(printf "%s\n%s" "$current_version" "$latest_version" | sort | tail -n 1)
|
|
||||||
if [ "$final_version" != "$current_version" ]; then
|
|
||||||
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
|
|
||||||
if [ -z "$version_exists" ]; then
|
|
||||||
update_lists
|
|
||||||
fi
|
|
||||||
$apt_install php"$version"-"$extension"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install extension from source
|
# Function to install extension from source
|
||||||
add_extension_from_source() {
|
add_extension_from_source() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -232,15 +228,13 @@ add_extension_from_source() {
|
|||||||
(
|
(
|
||||||
add_devtools
|
add_devtools
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
curl -o /tmp/"$extension".tar.gz -sSL https://github.com/"$repo"/archive/"$release".tar.gz
|
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
|
||||||
tar xf /tmp/"$extension".tar.gz -C /tmp
|
tar xf /tmp/"$extension".tar.gz -C /tmp
|
||||||
cd /tmp/"$extension-$release" || exit 1
|
cd /tmp/"$extension-$release" || exit 1
|
||||||
phpize && ./configure "$args" && make && sudo make install
|
phpize && ./configure "$args" && make && sudo make install
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
(
|
add_extension_log "$extension-$release" "Installed and enabled"
|
||||||
check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$release on PHP $semver"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to configure composer
|
# Function to configure composer
|
||||||
@ -257,10 +251,6 @@ configure_composer() {
|
|||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||||
fi
|
fi
|
||||||
# TODO: Remove after composer 2.0 update, fixes peer fingerprint error
|
|
||||||
if [[ "$version" =~ $old_versions ]]; then
|
|
||||||
composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool.
|
# Function to setup a remote tool.
|
||||||
@ -271,7 +261,7 @@ add_tool() {
|
|||||||
if [ ! -e "$tool_path" ]; then
|
if [ ! -e "$tool_path" ]; then
|
||||||
rm -rf "$tool_path"
|
rm -rf "$tool_path"
|
||||||
fi
|
fi
|
||||||
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
|
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
@ -315,32 +305,14 @@ add_devtools() {
|
|||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add blackfire and blackfire-agent.
|
|
||||||
add_blackfire() {
|
|
||||||
sudo mkdir -p /var/run/blackfire
|
|
||||||
sudo curl -sSL https://packages.blackfire.io/gpg.key | sudo apt-key add - >/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
|
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
|
||||||
$apt_install blackfire-agent >/dev/null 2>&1
|
|
||||||
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
|
||||||
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
add_log "$tick" "blackfire" "Added"
|
|
||||||
add_log "$tick" "blackfire-agent" "Added"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to setup the nightly build from master branch.
|
# Function to setup the nightly build from master branch.
|
||||||
setup_master() {
|
setup_master() {
|
||||||
curl -sSL "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner"
|
curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
||||||
setup_old_versions() {
|
setup_old_versions() {
|
||||||
curl -sSL "$github"/php5-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
curl "${curl_opts[@]}" "$github"/php5-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
||||||
configure_pecl
|
configure_pecl
|
||||||
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
||||||
}
|
}
|
||||||
@ -349,7 +321,7 @@ setup_old_versions() {
|
|||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools >/dev/null 2>&1
|
add_devtools >/dev/null 2>&1
|
||||||
if [ ! -e /usr/bin/pecl ]; then
|
if [ ! -e /usr/bin/pecl ]; then
|
||||||
$apt_install php-pear >/dev/null 2>&1
|
$apt_install php-pear >/dev/null 2>&1 || update_lists && $apt_install php-pear >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
@ -375,14 +347,19 @@ php_semver() {
|
|||||||
|
|
||||||
# Function to install packaged PHP
|
# Function to install packaged PHP
|
||||||
add_packaged_php() {
|
add_packaged_php() {
|
||||||
|
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
|
||||||
update_lists
|
update_lists
|
||||||
IFS=' ' read -r -a packages <<< "$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
IFS=' ' read -r -a packages <<< "$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
||||||
$apt_install "${packages[@]}"
|
$apt_install "${packages[@]}"
|
||||||
|
else
|
||||||
|
curl "${curl_opts[@]}" "$github"/php-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update PHP.
|
# Function to update PHP.
|
||||||
update_php() {
|
update_php() {
|
||||||
initial_version=$(php_semver)
|
initial_version=$(php_semver)
|
||||||
|
use_package_cache="false"
|
||||||
add_packaged_php
|
add_packaged_php
|
||||||
updated_version=$(php_semver)
|
updated_version=$(php_semver)
|
||||||
if [ "$updated_version" != "$initial_version" ]; then
|
if [ "$updated_version" != "$initial_version" ]; then
|
||||||
@ -407,7 +384,6 @@ add_php() {
|
|||||||
# Variables
|
# Variables
|
||||||
tick="✓"
|
tick="✓"
|
||||||
cross="✗"
|
cross="✗"
|
||||||
lists_updated="false"
|
|
||||||
pecl_config="false"
|
pecl_config="false"
|
||||||
version=$1
|
version=$1
|
||||||
master_version="8.0"
|
master_version="8.0"
|
||||||
@ -416,6 +392,7 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|||||||
github="https://github.com/shivammathur"
|
github="https://github.com/shivammathur"
|
||||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
apt_install="sudo $debconf_fix apt-fast install -y"
|
||||||
tool_path_dir="/usr/local/bin"
|
tool_path_dir="/usr/local/bin"
|
||||||
|
curl_opts=(-sSL --retry 5 --retry-delay 1)
|
||||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||||
|
|
||||||
read_env
|
read_env
|
||||||
@ -426,8 +403,6 @@ if [ "$runner" = "self-hosted" ]; then
|
|||||||
else
|
else
|
||||||
self_hosted_setup >/dev/null 2>&1
|
self_hosted_setup >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
|
|
||||||
add_ppa >/dev/null 2>&1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup PHP
|
# Setup PHP
|
||||||
|
17
src/scripts/tools/blackfire.ps1
Normal file
17
src/scripts/tools/blackfire.ps1
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Function to add blackfire and blackfire-agent.
|
||||||
|
Function Add-Blackfire() {
|
||||||
|
$agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
|
||||||
|
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||||
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||||
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
|
Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_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"
|
||||||
|
}
|
34
src/scripts/tools/blackfire.sh
Normal file
34
src/scripts/tools/blackfire.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
add_blackfire_linux() {
|
||||||
|
sudo mkdir -p /var/run/blackfire
|
||||||
|
sudo curl "${curl_opts[@]:?}" https://packages.blackfire.io/gpg.key | sudo apt-key add -
|
||||||
|
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
|
||||||
|
sudo "${debconf_fix:?}" apt-get update
|
||||||
|
${apt_install:?} blackfire-agent
|
||||||
|
}
|
||||||
|
|
||||||
|
add_blackfire_darwin() {
|
||||||
|
sudo mkdir -p /usr/local/var/run
|
||||||
|
brew tap --shallow blackfireio/homebrew-blackfire
|
||||||
|
brew install blackfire-agent
|
||||||
|
}
|
||||||
|
|
||||||
|
blackfire_config() {
|
||||||
|
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
||||||
|
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN"
|
||||||
|
[ "$os" = "Linux" ] && sudo /etc/init.d/blackfire-agent restart
|
||||||
|
[ "$os" = "Darwin" ] && brew services start blackfire-agent
|
||||||
|
fi
|
||||||
|
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
||||||
|
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add blackfire and blackfire-agent.
|
||||||
|
add_blackfire() {
|
||||||
|
os="$(uname -s)"
|
||||||
|
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
||||||
|
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
||||||
|
blackfire_config >/dev/null 2>&1
|
||||||
|
add_log "${tick:?}" "blackfire" "Added"
|
||||||
|
add_log "${tick:?}" "blackfire-agent" "Added"
|
||||||
|
}
|
20
src/scripts/tools/grpc_php_plugin.ps1
Normal file
20
src/scripts/tools/grpc_php_plugin.ps1
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Function Add-Msys2() {
|
||||||
|
$msys_location = 'C:\msys64'
|
||||||
|
if (-not(Test-Path $msys_location)) {
|
||||||
|
choco install msys2 -y >$null 2>&1
|
||||||
|
$msys_location = 'C:\tools\msys64'
|
||||||
|
}
|
||||||
|
return $msys_location
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Grpc_php_plugin() {
|
||||||
|
$msys_location = Add-Msys2
|
||||||
|
. $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
||||||
|
Write-Output "::add-path::$msys_location\mingw64\bin"
|
||||||
|
Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
|
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
|
Add-Log $tick "grpc_php_plugin" "Added"
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
||||||
|
Write-Output "::endgroup::"
|
||||||
|
}
|
51
src/scripts/tools/grpc_php_plugin.sh
Normal file
51
src/scripts/tools/grpc_php_plugin.sh
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
add_bazel() {
|
||||||
|
if [ ! "$(command -v bazel)" ]; then
|
||||||
|
os=$(uname -s)
|
||||||
|
if [ "$os" = "Linux" ]; then
|
||||||
|
${apt_install:?} curl gnupg
|
||||||
|
curl "${curl_opts[@]:?}" https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
||||||
|
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
|
||||||
|
sudo "${debconf_fix:?}" apt-get update -y
|
||||||
|
${apt_install:?} bazel
|
||||||
|
elif [ "$os" = "Darwin" ]; then
|
||||||
|
brew install bazel
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_grpc_tag() {
|
||||||
|
if [ "$grpc_tag" = "latest" ]; then
|
||||||
|
grpc_tag=$(curl "${curl_opts[@]:?}" https://grpc.io/release)
|
||||||
|
else
|
||||||
|
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/grpc.tmp "${curl_opts[@]:?}" "https://github.com/grpc/grpc/releases/tag/v$grpc_tag")
|
||||||
|
if [ "$status_code" = "200" ]; then
|
||||||
|
grpc_tag="v$grpc_tag"
|
||||||
|
else
|
||||||
|
grpc_tag=$(curl "${curl_opts[@]:?}" https://grpc.io/release)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_grpc_php_plugin() {
|
||||||
|
grpc_tag=$1
|
||||||
|
get_grpc_tag
|
||||||
|
(
|
||||||
|
curl "${curl_opts[@]:?}" "https://github.com/grpc/grpc/archive/$grpc_tag.tar.gz" | tar -xz -C /tmp
|
||||||
|
cd "/tmp/grpc-${grpc_tag:1}" || exit
|
||||||
|
add_bazel
|
||||||
|
echo "os: $os"
|
||||||
|
echo "release: $DISTRIB_RELEASE"
|
||||||
|
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
|
||||||
|
CC="$(command -v gcc)" CXX="$(command -v g++)" ./tools/bazel build src/compiler:grpc_php_plugin
|
||||||
|
else
|
||||||
|
./tools/bazel build src/compiler:grpc_php_plugin
|
||||||
|
fi
|
||||||
|
sudo mv ./bazel-bin/src/compiler/grpc_php_plugin /usr/local/bin/grpc_php_plugin
|
||||||
|
sudo chmod a+x /usr/local/bin/grpc_php_plugin
|
||||||
|
) >/dev/null 2>&1
|
||||||
|
echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin"
|
||||||
|
add_log "${tick:?}" "grpc_php_plugin" "Added"
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
|
cat "/tmp/grpc-${grpc_tag:1}/LICENSE"
|
||||||
|
echo "::endgroup::"
|
||||||
|
}
|
38
src/scripts/tools/protoc.ps1
Normal file
38
src/scripts/tools/protoc.ps1
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Function Get-ProtobufTag() {
|
||||||
|
if("$protobuf_tag" -eq "latest") {
|
||||||
|
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
[net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
||||||
|
$req.Method = "HEAD"
|
||||||
|
[net.httpWebResponse] $response = $request.getResponse()
|
||||||
|
$response.Close()
|
||||||
|
$protobuf_tag = "v$protobuf_tag"
|
||||||
|
} catch {
|
||||||
|
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $protobuf_tag
|
||||||
|
}
|
||||||
|
|
||||||
|
Function Add-Protoc() {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The PHP version to be installed')]
|
||||||
|
[ValidatePattern('^latest$|^(v?)\d+\.\d+\.\d+$')]
|
||||||
|
[string] $protobuf_tag
|
||||||
|
)
|
||||||
|
$protobuf_tag = Get-ProtobufTag
|
||||||
|
$arch_num = '64'
|
||||||
|
if(-not([Environment]::Is64BitOperatingSystem)) {
|
||||||
|
$arch_num = '32'
|
||||||
|
}
|
||||||
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
||||||
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
||||||
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
|
Add-Log $tick "protoc" "Added"
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
||||||
|
Write-Output "::endgroup::"
|
||||||
|
}
|
28
src/scripts/tools/protoc.sh
Normal file
28
src/scripts/tools/protoc.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
get_protobuf_tag() {
|
||||||
|
if [ "$protobuf_tag" = "latest" ]; then
|
||||||
|
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1)
|
||||||
|
else
|
||||||
|
status_code=$(sudo curl -s -w "%{http_code}" -o /tmp/protobuf.tmp "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
||||||
|
if [ "$status_code" = "200" ]; then
|
||||||
|
protobuf_tag="v$protobuf_tag"
|
||||||
|
else
|
||||||
|
protobuf_tag=$(curl "${curl_opts[@]:?}" https://github.com/protocolbuffers/protobuf/releases/latest 2<&1 | grep -m 1 -Eo "(v[0-9]+.[0-9]+.[0-9]+)" | head -n 1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_protoc() {
|
||||||
|
protobuf_tag=$1
|
||||||
|
get_protobuf_tag
|
||||||
|
(
|
||||||
|
platform='linux'
|
||||||
|
[ "$(uname -s)" = "Darwin" ] && platform='osx'
|
||||||
|
curl -o /tmp/protobuf.zip "${curl_opts[@]:?}" "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-${protobuf_tag:1}-$platform-x86_64.zip"
|
||||||
|
sudo unzip /tmp/protobuf.zip -d /usr/local/
|
||||||
|
sudo chmod a+x /usr/local/bin/protoc
|
||||||
|
) >/dev/null 2>&1
|
||||||
|
add_log "${tick:?}" "protoc" "Added"
|
||||||
|
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
||||||
|
echo "::endgroup::"
|
||||||
|
}
|
@ -180,10 +180,6 @@ Function Edit-ComposerConfig() {
|
|||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN
|
||||||
}
|
}
|
||||||
# TODO: Remove after composer 2.0 update, fixes peer fingerprint error
|
|
||||||
if ($version -lt 5.6) {
|
|
||||||
composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add tools.
|
# Function to add tools.
|
||||||
@ -269,25 +265,6 @@ Function Add-Pecl() {
|
|||||||
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
|
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add blackfire and blackfire-agent.
|
|
||||||
Function Add-Blackfire() {
|
|
||||||
$agent_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 0 }
|
|
||||||
$agent_version = [regex]::Matches($agent_data, '<td.*?>(.+)</td>') | ForEach-Object {$_.Captures[0].Groups[1].value }
|
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
|
||||||
Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_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
|
# Variables
|
||||||
$tick = ([char]8730)
|
$tick = ([char]8730)
|
||||||
$cross = ([char]10007)
|
$cross = ([char]10007)
|
||||||
@ -358,9 +335,11 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
}
|
}
|
||||||
if ($version -eq $master_version) {
|
if ($version -eq $master_version) {
|
||||||
$version = 'master'
|
$version = 'master'
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri https://dl.bintray.com/shivammathur/php/Install-PhpMaster.ps1 -OutFile $php_dir\Install-PhpMaster.ps1 > $null 2>&1
|
||||||
|
& $php_dir\Install-PhpMaster.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir
|
||||||
|
} else {
|
||||||
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
|
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir >$null 2>&1
|
||||||
@ -382,10 +361,4 @@ if($version -lt "5.5") {
|
|||||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||||
}
|
}
|
||||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||||
if ($version -eq 'master') {
|
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php_$env:phpts`_$arch`_pcov.dll" -OutFile $ext_dir"\php_pcov.dll" >$null 2>&1
|
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php_$env:phpts`_$arch`_xdebug.dll" -OutFile $ext_dir"\php_xdebug.dll" >$null 2>&1
|
|
||||||
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
|
|
||||||
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
|
||||||
}
|
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
31
src/tools.ts
31
src/tools.ts
@ -1,6 +1,7 @@
|
|||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import {IHttpClientResponse as hcr} from '@actions/http-client/interfaces';
|
import {IHttpClientResponse as hcr} from '@actions/http-client/interfaces';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get command to setup tools
|
* Function to get command to setup tools
|
||||||
@ -38,6 +39,8 @@ export async function getToolVersion(version: string): Promise<string> {
|
|||||||
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||||
version = version.replace(/[><=^]*/, '');
|
version = version.replace(/[><=^]*/, '');
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case version.charAt(0) == 'v':
|
||||||
|
return version.replace('v', '');
|
||||||
case composer_regex.test(version):
|
case composer_regex.test(version):
|
||||||
case semver_regex.test(version):
|
case semver_regex.test(version):
|
||||||
return version;
|
return version;
|
||||||
@ -361,7 +364,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -439,6 +442,27 @@ export async function addPackage(
|
|||||||
return tool_command + tool + ' ' + release + ' ' + prefix;
|
return tool_command + tool + ' ' + release + ' ' + prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get script to add tools with custom support.
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function addCustomTool(
|
||||||
|
tool: string,
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
const script_extension: string = await utils.scriptExtension(os_version);
|
||||||
|
const script: string = path.join(
|
||||||
|
__dirname,
|
||||||
|
'../src/scripts/tools/' + tool + script_extension
|
||||||
|
);
|
||||||
|
const command: string = await getCommand(os_version, tool);
|
||||||
|
return '. ' + script + '\n' + command + version;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup tools
|
* Setup tools
|
||||||
*
|
*
|
||||||
@ -470,8 +494,9 @@ export async function addTools(
|
|||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'grpc_php_plugin':
|
||||||
script += await getCommand(os_version, 'blackfire');
|
case 'protoc':
|
||||||
|
script += await addCustomTool(tool, version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
|
54
src/utils.ts
54
src/utils.ts
@ -259,3 +259,57 @@ export async function suppressOutput(os_version: string): Promise<string> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get script to log unsupported extensions.
|
||||||
|
*
|
||||||
|
* @param extension
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function getUnsupportedLog(
|
||||||
|
extension: string,
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
return (
|
||||||
|
'\n' +
|
||||||
|
(await addLog(
|
||||||
|
'$cross',
|
||||||
|
extension,
|
||||||
|
[extension, 'is not supported on PHP', version].join(' '),
|
||||||
|
os_version
|
||||||
|
)) +
|
||||||
|
'\n'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to join strings with space
|
||||||
|
*
|
||||||
|
* @param str
|
||||||
|
*/
|
||||||
|
export async function joins(...str: string[]): Promise<string> {
|
||||||
|
return [...str].join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get script extensions
|
||||||
|
*
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function scriptExtension(os_version: string): Promise<string> {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'win32':
|
||||||
|
return '.ps1';
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
return '.sh';
|
||||||
|
default:
|
||||||
|
return await log(
|
||||||
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
os_version,
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user