mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11: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 |
|
||||
| ------- | ------------------ |
|
||||
| 1.9.x | :white_check_mark: |
|
||||
| 2.3.x | :white_check_mark: |
|
||||
| 2.4.x | :white_check_mark: |
|
||||
|
||||
## 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
|
||||
continue-on-error: true
|
||||
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.
|
||||
|
||||
`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
|
||||
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
|
||||
|
||||
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
|
||||
- name: Setup PHP
|
||||
@ -634,7 +634,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
|
||||
## :scroll: License
|
||||
|
||||
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
|
||||
- This project has multiple [dependencies](#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").
|
||||
|
||||
## :+1: Contributions
|
||||
|
@ -1,14 +1,6 @@
|
||||
import * as extensions from '../src/extensions';
|
||||
|
||||
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 () => {
|
||||
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',
|
||||
@ -19,14 +11,19 @@ describe('Extension tests', () => {
|
||||
expect(win32).toContain('Add-Extension pcov');
|
||||
expect(win32).toContain('Add-Extension sqlite3');
|
||||
expect(win32).toContain('Remove-Extension intl');
|
||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||
expect(win32).toContain('ioncube.ps1 7.4');
|
||||
expect(win32).toContain('oci.ps1 oci8 7.4');
|
||||
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
|
||||
expect(win32).toContain('Add-Phalcon phalcon4');
|
||||
expect(win32).toContain('Add-Ioncube');
|
||||
expect(win32).toContain('Add-OCI oci8');
|
||||
expect(win32).toContain('Add-OCI pdo_oci');
|
||||
expect(win32).toContain('Add-Extension ast beta');
|
||||
expect(win32).toContain('Add-Extension grpc stable 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');
|
||||
expect(win32).toContain('Add-Extension mysqli');
|
||||
expect(win32).toContain('Add-Extension mysqlnd');
|
||||
@ -46,17 +43,17 @@ describe('Extension tests', () => {
|
||||
'win32',
|
||||
true
|
||||
);
|
||||
expect(win32).toContain('phalcon.ps1 phalcon3');
|
||||
expect(win32).toContain('Add-Phalcon phalcon3');
|
||||
expect(win32).toContain('Add-Extension does_not_exist');
|
||||
|
||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
|
||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
|
||||
expect(win32).toContain('Add-Blackfire blackfire');
|
||||
|
||||
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 () => {
|
||||
@ -65,7 +62,6 @@ describe('Extension tests', () => {
|
||||
'7.4',
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain('update_extension xdebug 2.9.6');
|
||||
expect(linux).toContain(
|
||||
'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'
|
||||
);
|
||||
|
||||
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');
|
||||
expect(linux).toContain('gearman.sh 7.0');
|
||||
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');
|
||||
|
||||
expect(linux).toContain('add_gearman');
|
||||
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');
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
|
||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
||||
expect(linux).toContain('add_phalcon phalcon3');
|
||||
expect(linux).toContain('add_phalcon phalcon4');
|
||||
|
||||
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');
|
||||
expect(linux).toContain('oci.sh oci8 7.3');
|
||||
expect(linux).toContain('oci.sh pdo_oci 7.3');
|
||||
expect(linux).toContain('add_oci oci8');
|
||||
expect(linux).toContain('add_oci pdo_oci');
|
||||
|
||||
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');
|
||||
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
|
||||
expect(linux).toContain('add_blackfire blackfire-1.31.0');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
@ -135,39 +127,32 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension grpc');
|
||||
expect(darwin).toContain('add_brew_extension protobuf');
|
||||
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('add_unstable_extension ast beta extension');
|
||||
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
|
||||
|
||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
||||
expect(darwin).toContain('add_phalcon phalcon3');
|
||||
|
||||
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');
|
||||
expect(darwin).toContain('ioncube.sh 7.3');
|
||||
expect(darwin).toContain('add_ioncube');
|
||||
|
||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||
expect(darwin).toContain('oci.sh oci8 7.3');
|
||||
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
||||
expect(darwin).toContain('add_oci oci8');
|
||||
expect(darwin).toContain('add_oci pdo_oci');
|
||||
|
||||
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');
|
||||
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');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
@ -178,24 +163,24 @@ describe('Extension tests', () => {
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
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');
|
||||
expect(darwin).toContain('sudo pecl install -f redis');
|
||||
expect(darwin).toContain('pecl_install redis');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||
expect(darwin).toContain('pecl_install imagick');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||
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');
|
||||
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');
|
||||
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(
|
||||
'does_not_exist',
|
||||
|
@ -402,9 +402,20 @@ describe('Tools tests', () => {
|
||||
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 () => {
|
||||
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',
|
||||
'linux'
|
||||
);
|
||||
@ -436,6 +447,8 @@ describe('Tools tests', () => {
|
||||
expect(script).toContain(
|
||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
|
||||
);
|
||||
expect(script).toContain('add_protoc latest');
|
||||
expect(script).toContain('add_grpc_php_plugin latest');
|
||||
expect(script).toContain('add_pecl');
|
||||
expect(script).toContain('add_composertool flex flex symfony/');
|
||||
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||
@ -455,6 +468,7 @@ describe('Tools tests', () => {
|
||||
'composer-unused',
|
||||
'cs2pr:1.2.3',
|
||||
'flex',
|
||||
'grpc_php_plugin:1.2.3',
|
||||
'infection',
|
||||
'phan',
|
||||
'phan:2.7.2',
|
||||
@ -466,6 +480,7 @@ describe('Tools tests', () => {
|
||||
'phpcs',
|
||||
'phpize',
|
||||
'phpmd',
|
||||
'protoc:v1.2.3',
|
||||
'psalm',
|
||||
'symfony',
|
||||
'symfony:1.2.3',
|
||||
@ -519,6 +534,8 @@ describe('Tools tests', () => {
|
||||
expect(script).toContain(
|
||||
'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 flex flex symfony/');
|
||||
expect(script).toContain('add_composertool phinx phinx robmorgan/');
|
||||
|
@ -167,4 +167,23 @@ describe('Utils tests', () => {
|
||||
'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;
|
||||
};
|
||||
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 path = __importStar(__webpack_require__(622));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
@ -1529,6 +1529,45 @@ async function suppressOutput(os_version) {
|
||||
}
|
||||
}
|
||||
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;
|
||||
};
|
||||
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 httpm = __importStar(__webpack_require__(539));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
/**
|
||||
* Function to get command to setup tools
|
||||
*
|
||||
@ -1940,6 +1980,8 @@ async function getToolVersion(version) {
|
||||
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||
version = version.replace(/[><=^]*/, '');
|
||||
switch (true) {
|
||||
case version.charAt(0) == 'v':
|
||||
return version.replace('v', '');
|
||||
case composer_regex.test(version):
|
||||
case semver_regex.test(version):
|
||||
return version;
|
||||
@ -2217,7 +2259,7 @@ async function getCleanedToolsList(tools_csv) {
|
||||
.map(function (extension) {
|
||||
return extension
|
||||
.trim()
|
||||
.replace(/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
||||
.replace(/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
||||
})
|
||||
.filter(Boolean);
|
||||
return [...new Set(tools_list)];
|
||||
@ -2269,6 +2311,20 @@ async function addPackage(tool, release, prefix, os_version) {
|
||||
return tool_command + tool + ' ' + release + ' ' + prefix;
|
||||
}
|
||||
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
|
||||
*
|
||||
@ -2289,8 +2345,9 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
let url = '';
|
||||
switch (tool) {
|
||||
case 'blackfire':
|
||||
case 'blackfire-agent':
|
||||
script += await getCommand(os_version, 'blackfire');
|
||||
case 'grpc_php_plugin':
|
||||
case 'protoc':
|
||||
script += await addCustomTool(tool, version, os_version);
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||
@ -3568,30 +3625,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
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 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) {
|
||||
switch (version) {
|
||||
case '5.3':
|
||||
return '2.2.7';
|
||||
case '5.4':
|
||||
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';
|
||||
}
|
||||
async function customExtension(script, ...command) {
|
||||
return ('\n. ' +
|
||||
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||
'\n' +
|
||||
(await utils.joins(...command)));
|
||||
}
|
||||
exports.getXdebugVersion = getXdebugVersion;
|
||||
exports.customExtension = customExtension;
|
||||
/**
|
||||
* Install and enable extensions for darwin
|
||||
*
|
||||
@ -3607,7 +3656,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
const version_extension = version + extension;
|
||||
const [ext_name, ext_version] = extension.split('-');
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
const command_prefix = 'pecl_install ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// 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-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):
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
extension;
|
||||
break;
|
||||
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
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
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||
return;
|
||||
// match semver
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
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, 'darwin');
|
||||
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.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||
// match 7.1pcov to 8.0pcov
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + ext_name;
|
||||
break;
|
||||
@ -3664,53 +3706,18 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
break;
|
||||
// match imagick
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
command = await utils.joins('brew install pkg-config imagemagick' + pipe, '&& ' + command_prefix + 'imagick' + pipe);
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension;
|
||||
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:
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
}
|
||||
add_script +=
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
add_script += await utils.joins('\nadd_extension', extension, '"' + command + '"', ext_prefix);
|
||||
});
|
||||
return add_script + remove_script;
|
||||
}
|
||||
@ -3733,32 +3740,41 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
// Match :extension
|
||||
case /^:/.test(ext_name):
|
||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||
return;
|
||||
break;
|
||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
add_script +=
|
||||
'\n& ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
extension;
|
||||
return;
|
||||
add_script += await customExtension('blackfire.ps1', 'Add-Blackfire', extension);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
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
|
||||
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;
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
add_script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||
return;
|
||||
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
||||
break;
|
||||
// match semver with state
|
||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension):
|
||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(version_extension);
|
||||
add_script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
add_script += await utils.joins('\nAdd-Extension', 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.3mysqli..5.6mysqli
|
||||
// match 5.3mysqlnd..5.6mysqlnd
|
||||
@ -3775,38 +3791,7 @@ async function addExtensionWindows(extension_csv, version) {
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
add_script += '\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';
|
||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||
break;
|
||||
default:
|
||||
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-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
command =
|
||||
'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;
|
||||
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
|
||||
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
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version;
|
||||
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 +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
||||
' ' +
|
||||
version;
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
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):
|
||||
add_script +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version;
|
||||
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
|
||||
return;
|
||||
// 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;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
@ -3916,20 +3866,9 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
extension = 'xdebug';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
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
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension
|
||||
.replace('pdo_', '')
|
||||
.replace('pdo-', '')
|
||||
.replace('sqlite3', 'sqlite');
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
add_script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match ast and uopz
|
||||
@ -3945,8 +3884,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
}
|
||||
add_script +=
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
add_script += await utils.joins('\nadd_extension', extension, '"' + command + '"', ext_prefix);
|
||||
});
|
||||
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",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.1",
|
||||
"private": false,
|
||||
"description": "Setup PHP for use with GitHub Actions",
|
||||
"main": "dist/index.js",
|
||||
@ -31,21 +31,21 @@
|
||||
"fs": "0.0.1-security"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.5",
|
||||
"@types/node": "^14.0.23",
|
||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
||||
"@typescript-eslint/parser": "^3.6.1",
|
||||
"@types/jest": "^26.0.8",
|
||||
"@types/node": "^14.0.27",
|
||||
"@typescript-eslint/eslint-plugin": "^3.7.1",
|
||||
"@typescript-eslint/parser": "^3.7.1",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-config-prettier": "^6.11.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",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.1.0",
|
||||
"jest-circus": "^26.1.0",
|
||||
"jest": "^26.2.2",
|
||||
"jest-circus": "^26.2.2",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-jest": "^26.1.3",
|
||||
"ts-jest": "^26.1.4",
|
||||
"typescript": "^3.9.7"
|
||||
},
|
||||
"husky": {
|
||||
|
@ -2,24 +2,21 @@ import * as path from 'path';
|
||||
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> {
|
||||
switch (version) {
|
||||
case '5.3':
|
||||
return '2.2.7';
|
||||
case '5.4':
|
||||
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';
|
||||
}
|
||||
export async function customExtension(
|
||||
script: string,
|
||||
...command: string[]
|
||||
): Promise<string> {
|
||||
return (
|
||||
'\n. ' +
|
||||
path.join(__dirname, '../src/scripts/ext/' + script) +
|
||||
'\n' +
|
||||
(await utils.joins(...command))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,7 +38,7 @@ export async function addExtensionDarwin(
|
||||
const version_extension: string = version + extension;
|
||||
const [ext_name, ext_version]: string[] = extension.split('-');
|
||||
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
||||
const command_prefix = 'sudo pecl install -f ';
|
||||
const command_prefix = 'pecl_install ';
|
||||
let command = '';
|
||||
switch (true) {
|
||||
// match :extension
|
||||
@ -53,44 +50,55 @@ export async function addExtensionDarwin(
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
command =
|
||||
'bash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
extension;
|
||||
break;
|
||||
add_script += await customExtension(
|
||||
'blackfire.sh',
|
||||
'add_blackfire',
|
||||
extension
|
||||
);
|
||||
return;
|
||||
// match pdo_oci and oci8
|
||||
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
|
||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_unstable_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
add_script += await utils.joins(
|
||||
'\nadd_unstable_extension',
|
||||
ext_name,
|
||||
ext_version,
|
||||
ext_prefix
|
||||
);
|
||||
return;
|
||||
// match semver
|
||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
||||
add_script +=
|
||||
'\nadd_pecl_extension ' +
|
||||
ext_name +
|
||||
' ' +
|
||||
ext_version +
|
||||
' ' +
|
||||
ext_prefix;
|
||||
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, 'darwin');
|
||||
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.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||
// match 7.1pcov to 8.0pcov
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|swoole)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + ext_name;
|
||||
break;
|
||||
@ -100,53 +108,26 @@ export async function addExtensionDarwin(
|
||||
break;
|
||||
// match imagick
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
command = await utils.joins(
|
||||
'brew install pkg-config imagemagick' + pipe,
|
||||
'&& ' + command_prefix + 'imagick' + pipe
|
||||
);
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
command = command_prefix + extension;
|
||||
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:
|
||||
command = command_prefix + extension;
|
||||
break;
|
||||
}
|
||||
add_script +=
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
add_script += await utils.joins(
|
||||
'\nadd_extension',
|
||||
extension,
|
||||
'"' + command + '"',
|
||||
ext_prefix
|
||||
);
|
||||
});
|
||||
return add_script + remove_script;
|
||||
}
|
||||
@ -172,28 +153,51 @@ export async function addExtensionWindows(
|
||||
// Match :extension
|
||||
case /^:/.test(ext_name):
|
||||
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
|
||||
return;
|
||||
break;
|
||||
// match 5.4blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
||||
// match 5.4blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
|
||||
case /^(5\.[4-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
add_script +=
|
||||
'\n& ' +
|
||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||
' ' +
|
||||
version +
|
||||
' ' +
|
||||
extension;
|
||||
return;
|
||||
add_script += await customExtension(
|
||||
'blackfire.ps1',
|
||||
'Add-Blackfire',
|
||||
extension
|
||||
);
|
||||
break;
|
||||
// match pdo_oci and oci8
|
||||
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
|
||||
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;
|
||||
// match semver without state
|
||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
||||
add_script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
|
||||
return;
|
||||
add_script += await utils.joins(
|
||||
'\nAdd-Extension',
|
||||
ext_name,
|
||||
'stable',
|
||||
ext_version
|
||||
);
|
||||
break;
|
||||
// match semver with state
|
||||
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
|
||||
version_extension
|
||||
@ -201,9 +205,17 @@ export async function addExtensionWindows(
|
||||
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
|
||||
version_extension
|
||||
) as RegExpExecArray;
|
||||
add_script +=
|
||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||
return;
|
||||
add_script += await utils.joins(
|
||||
'\nAdd-Extension',
|
||||
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.3mysqli..5.6mysqli
|
||||
// match 5.3mysqlnd..5.6mysqlnd
|
||||
@ -220,38 +232,7 @@ export async function addExtensionWindows(
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
add_script += '\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';
|
||||
add_script += await utils.joins('\nAdd-Extension', extension);
|
||||
break;
|
||||
default:
|
||||
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(
|
||||
version_extension
|
||||
):
|
||||
command =
|
||||
'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;
|
||||
add_script += await customExtension(
|
||||
'blackfire.sh',
|
||||
'add_blackfire',
|
||||
extension
|
||||
);
|
||||
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
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
add_script +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/oci.sh') +
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version;
|
||||
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 +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/ioncube.sh') +
|
||||
' ' +
|
||||
version;
|
||||
add_script += await customExtension('ioncube.sh', 'add_ioncube');
|
||||
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):
|
||||
add_script +=
|
||||
'\nbash ' +
|
||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version;
|
||||
add_script += await customExtension(
|
||||
'phalcon.sh',
|
||||
'add_phalcon',
|
||||
extension
|
||||
);
|
||||
return;
|
||||
// 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;
|
||||
// match 7.2xdebug3..7.4xdebug3
|
||||
case /^7\.[2-4]xdebug3$/.test(version_extension):
|
||||
@ -367,20 +331,9 @@ export async function addExtensionLinux(
|
||||
extension = 'xdebug';
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
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
|
||||
case /.*pdo[_-].*/.test(version_extension):
|
||||
extension = extension
|
||||
.replace('pdo_', '')
|
||||
.replace('pdo-', '')
|
||||
.replace('sqlite3', 'sqlite');
|
||||
extension = extension.replace(/pdo[_-]|3/, '');
|
||||
add_script += '\nadd_pdo_extension ' + extension;
|
||||
return;
|
||||
// match ast and uopz
|
||||
@ -396,8 +349,12 @@ export async function addExtensionLinux(
|
||||
command = command_prefix + version + '-' + extension + pipe;
|
||||
break;
|
||||
}
|
||||
add_script +=
|
||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
||||
add_script += await utils.joins(
|
||||
'\nadd_extension',
|
||||
extension,
|
||||
'"' + command + '"',
|
||||
ext_prefix
|
||||
);
|
||||
});
|
||||
return add_script + remove_script;
|
||||
}
|
||||
|
@ -16,6 +16,16 @@ add_log() {
|
||||
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.
|
||||
read_env() {
|
||||
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
|
||||
@ -28,7 +38,7 @@ read_env() {
|
||||
self_hosted_setup() {
|
||||
if [[ $(command -v brew) == "" ]]; then
|
||||
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"
|
||||
fi
|
||||
}
|
||||
@ -62,7 +72,7 @@ get_pecl_version() {
|
||||
extension=$1
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||
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*)")
|
||||
if [ ! "$pecl_version" ]; then
|
||||
pecl_version=$(echo "$response" | grep -m 1 -Eo "(\d*\.\d*\.\d*)")
|
||||
@ -70,6 +80,12 @@ get_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.
|
||||
add_pecl_extension() {
|
||||
extension=$1
|
||||
@ -86,11 +102,8 @@ add_pecl_extension() {
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
else
|
||||
remove_extension "$extension" >/dev/null 2>&1
|
||||
(
|
||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
pecl_install "$extension-$pecl_version"
|
||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -116,8 +129,7 @@ add_extension() {
|
||||
elif ! check_extension "$extension"; then
|
||||
eval "$install_command" >/dev/null 2>&1 &&
|
||||
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_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -137,17 +149,13 @@ configure_composer() {
|
||||
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
||||
if [ $? -eq 1 ]; then
|
||||
add_log "$cross" "composer" "Could not download composer"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
composer -q global config process-timeout 0
|
||||
echo "::add-path::/Users/$USER/.composer/vendor/bin"
|
||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||
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.
|
||||
@ -159,18 +167,18 @@ add_tool() {
|
||||
rm -rf "$tool_path"
|
||||
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
|
||||
sudo chmod a+x "$tool_path"
|
||||
if [ "$tool" = "composer" ]; then
|
||||
configure_composer "$tool_path"
|
||||
elif [ "$tool" = "phan" ]; then
|
||||
add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1
|
||||
add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1
|
||||
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
|
||||
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
|
||||
elif [ "$tool" = "phive" ]; then
|
||||
add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1
|
||||
add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1
|
||||
add_extension xml "sudo pecl install -f xml" extension >/dev/null 2>&1
|
||||
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
|
||||
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
|
||||
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
|
||||
elif [ "$tool" = "cs2pr" ]; then
|
||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
||||
tr -d '\r' <"$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
||||
@ -190,26 +198,10 @@ add_composertool() {
|
||||
release=$2
|
||||
prefix=$3
|
||||
(
|
||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
||||
add_log "$tick" "$tool" "Added"
|
||||
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added"
|
||||
) || 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
|
||||
configure_pecl() {
|
||||
for tool in pear pecl; do
|
||||
@ -243,6 +235,7 @@ version=$1
|
||||
nodot_version=${1/./}
|
||||
old_versions="5.[3-5]"
|
||||
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)
|
||||
|
||||
read_env
|
||||
@ -258,7 +251,7 @@ fi
|
||||
# Setup PHP
|
||||
step_log "Setup PHP"
|
||||
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"
|
||||
elif [ "$existing_version" != "$version" ]; then
|
||||
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)]
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$version,
|
||||
[Parameter(Position = 1, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[string]
|
||||
$extension
|
||||
)
|
||||
|
||||
$tick = ([char]8730)
|
||||
$php_dir = 'C:\tools\php'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$arch='x64'
|
||||
if ($version -lt '7.0') { $arch='x86' }
|
||||
$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) {
|
||||
)
|
||||
try {
|
||||
$no_dot_version = $version.replace('.', '')
|
||||
$extension_version = $extension.split('-')[1]
|
||||
if ($extension_version -notmatch "\S") {
|
||||
$extension_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).probe.php
|
||||
}
|
||||
if (Test-Path $ext_dir\blackfire.dll) {
|
||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||
$status="Enabled"
|
||||
} else {
|
||||
$installed = Get-Php -Path $php_dir
|
||||
} 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
|
||||
$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/./}
|
||||
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')
|
||||
fi
|
||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
ini_file="$scan_dir/50-blackfire.ini"
|
||||
sudo curl -o $ext_dir/blackfire.so -SL https://packages.blackfire.io/binaries/blackfire-php/$extension_version/blackfire-php-linux_amd64-php-$version.so
|
||||
echo "extension=blackfire.so" | sudo tee -a "$ini_file"
|
||||
# Function to install blackfire extension.
|
||||
add_blackfire() {
|
||||
extension=$1
|
||||
version=${version:?}
|
||||
no_dot_version=${version/./}
|
||||
platform=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||
blackfire_ini_file="${scan_dir:?}/50-blackfire.ini"
|
||||
if [ ! -e "${ext_dir:?}/blackfire.so" ]; then
|
||||
if [ "$extension_version" = "blackfire" ]; then
|
||||
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)
|
||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
# Helper function to add gearman extension.
|
||||
add_gearman_helper() {
|
||||
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
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
|
||||
elif [ "$release_version" = "16.04" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
|
||||
fi
|
||||
# Function to add gearman extension.
|
||||
add_gearman() {
|
||||
status="Enabled"
|
||||
add_gearman_helper >/dev/null 2>&1
|
||||
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 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
|
||||
Function Add-LicenseLog() {
|
||||
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
|
||||
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)
|
||||
$cross = ([char]10007)
|
||||
$status = 'Enabled'
|
||||
$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 {
|
||||
# Function to add ioncube extension.
|
||||
Function Add-Ioncube() {
|
||||
try {
|
||||
if (-not(Test-Path $ext_dir\php_ioncube.dll)) {
|
||||
$status = 'Installed and enabled'
|
||||
$arch = 'x86-64'
|
||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch = 'x86'
|
||||
$arch_part = $arch
|
||||
if ($arch -eq 'x64') {
|
||||
$arch_part = 'x86-64'
|
||||
}
|
||||
$vc = $installed.VCVersion
|
||||
$ts = ""
|
||||
$ts_part = ""
|
||||
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
|
||||
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
|
||||
Add-Log $tick "ioncube" $status
|
||||
} catch {
|
||||
Add-LicenseLog
|
||||
} catch {
|
||||
Add-Log $cross "ioncube" "Could not install ioncube on PHP $($installed.FullVersion)"
|
||||
}
|
||||
}
|
@ -1,41 +1,19 @@
|
||||
# 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"
|
||||
add_license_log() {
|
||||
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
|
||||
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.
|
||||
install_ioncube() {
|
||||
if [ ! -e "$ext_dir/ioncube.so" ]; then
|
||||
os_name='lin'
|
||||
add_ioncube() {
|
||||
if [ ! -e "${ext_dir:?}/ioncube.so" ]; then
|
||||
status='Installed and enabled'
|
||||
[ "$(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
|
||||
sudo mv /tmp/ioncube/ioncube_loader_"$os_name"_"$version".so "$ext_dir/ioncube.so"
|
||||
os_name='lin' && [ "$(uname -s)" = "Darwin" ] && os_name='mac'
|
||||
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"
|
||||
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 (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[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
|
||||
# Function to log license information.
|
||||
Function Add-LicenseLog() {
|
||||
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 "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"
|
||||
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)
|
||||
$cross = ([char]10007)
|
||||
$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
|
||||
{
|
||||
# Function to get instantclinet.
|
||||
Function Add-InstantClient() {
|
||||
if (-not(Test-Path $php_dir\oci.dll)) {
|
||||
$suffix = 'windows'
|
||||
if (-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0')
|
||||
{
|
||||
if ($arch -eq 'x86') {
|
||||
$suffix = 'nt'
|
||||
}
|
||||
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
|
||||
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") {
|
||||
Enable-PhpExtension pdo_oci -Path $php_dir
|
||||
} else {
|
||||
$status = 'Installed and enabled'
|
||||
$ociVersion = '2.2.0'
|
||||
if ($version -eq '7.0')
|
||||
{
|
||||
if ($version -eq '7.0') {
|
||||
$ociVersion = '2.1.8'
|
||||
}
|
||||
elseif ($version -lt '7.0')
|
||||
{
|
||||
} elseif ($version -lt '7.0') {
|
||||
$ociVersion = '2.0.12'
|
||||
}
|
||||
$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-Log $tick $extension $status
|
||||
} catch {
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||
Add-LicenseLog
|
||||
} catch {
|
||||
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,24 @@
|
||||
# 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"
|
||||
add_license_log() {
|
||||
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 "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"
|
||||
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.
|
||||
get_tag() {
|
||||
master_version='8.0'
|
||||
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 '-')"
|
||||
fi
|
||||
echo "$tag"
|
||||
}
|
||||
|
||||
# Function to install instantclient and SDK.
|
||||
install_client() {
|
||||
add_client() {
|
||||
sudo mkdir -p -m 777 "$oracle_home"
|
||||
if [ ! -e "$oracle_client" ]; then
|
||||
for package in basiclite sdk; do
|
||||
@ -47,7 +33,7 @@ install_client() {
|
||||
arch='macos'
|
||||
lib_ext='dylib'
|
||||
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"
|
||||
done
|
||||
sudo ln -sf /opt/oracle/instantclient*/*.$lib_ext* $libs
|
||||
@ -57,7 +43,7 @@ install_client() {
|
||||
|
||||
# Function to get PHP source.
|
||||
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.
|
||||
@ -86,55 +72,54 @@ restore_phpize() {
|
||||
|
||||
# Function to patch pdo_oci.
|
||||
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
|
||||
}
|
||||
|
||||
# Function to install the dependencies.
|
||||
install_dependencies() {
|
||||
add_dependencies() {
|
||||
if [ "$os" = 'Linux' ]; then
|
||||
if [ "$runner" = "self-hosted" ] || [ "$RUNNER" = "self-hosted" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||
if [ "${runner:?}" = "self-hosted" ]; then
|
||||
${apt_install:?} autoconf automake libaio-dev gcc g++ php"$version"-dev
|
||||
else
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$version"-dev
|
||||
update_lists
|
||||
${apt_install:?} php"$version"-dev
|
||||
fi
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install the extension.
|
||||
install_extension() {
|
||||
if ! [ -e "$ext_dir/$ext.so" ]; then
|
||||
(
|
||||
# Function to install oci8 and pdo_oci.
|
||||
add_oci_helper() {
|
||||
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||
status='Installed and enabled'
|
||||
phpize_orig=$(get_phpize)
|
||||
tag=$(get_tag)
|
||||
get_php
|
||||
patch_phpize
|
||||
(
|
||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
||||
sudo make -j"$(nproc)"
|
||||
sudo cp ./modules/* "$ext_dir/"
|
||||
restore_phpize
|
||||
)
|
||||
restore_phpize
|
||||
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
|
||||
version=$2
|
||||
tick='✓'
|
||||
cross='✗'
|
||||
status='Enabled'
|
||||
oracle_home='/opt/oracle'
|
||||
oracle_client=$oracle_home/instantclient
|
||||
runner="${runner:-github}" && RUNNER="${RUNNER:-github}"
|
||||
os=$(uname -s)
|
||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||
install_client >/dev/null 2>&1
|
||||
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"
|
||||
# Function to add oci extension oci8 and pdo_oci.
|
||||
add_oci() {
|
||||
ext=$1
|
||||
status='Enabled'
|
||||
oracle_home='/opt/oracle'
|
||||
oracle_client=$oracle_home/instantclient
|
||||
os=$(uname -s)
|
||||
add_client >/dev/null 2>&1
|
||||
add_dependencies >/dev/null 2>&1
|
||||
add_oci_helper >/dev/null 2>&1
|
||||
add_extension_log "$ext" "$status"
|
||||
check_extension "$ext" && add_license_log
|
||||
}
|
||||
|
@ -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 Install-Phalcon() {
|
||||
Function Add-PhalconHelper() {
|
||||
if ($extension_version -eq '4') {
|
||||
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||
} else {
|
||||
$installed = Get-Php -Path $php_dir
|
||||
$domain = 'https://github.com'
|
||||
$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)`""
|
||||
$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"
|
||||
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)
|
||||
$domain = 'https://github.com'
|
||||
$php_dir = 'C:\tools\php'
|
||||
if($env:RUNNER -eq 'self-hosted') { $php_dir = "$php_dir$version" }
|
||||
$ext_dir = "$php_dir\ext"
|
||||
$extension_version = $extension.substring($extension.Length - 1)
|
||||
Function Add-Phalcon() {
|
||||
Param (
|
||||
[Parameter(Position = 0, Mandatory = $true)]
|
||||
[ValidateNotNull()]
|
||||
[ValidateSet('phalcon3', 'phalcon4')]
|
||||
[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) {
|
||||
Enable-PhpExtension -Extension psr -Path $php_dir
|
||||
} else {
|
||||
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
|
||||
if($phalcon.Version[0] -eq $extension_version) {
|
||||
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 {
|
||||
$status = 'Installed and enabled'
|
||||
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
|
||||
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"
|
||||
# Helper function to add phalcon.
|
||||
add_phalcon_helper() {
|
||||
status='Installed and enabled'
|
||||
if [ "$os_name" = "Linux" ]; then
|
||||
update_lists
|
||||
${apt_install:?} "php${version:?}-$extension"
|
||||
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
|
||||
}
|
||||
|
||||
# Function to update php ppa
|
||||
update_ppa() {
|
||||
if [ "$ppa_updated" = "false" ]; 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
|
||||
ppa_updated="true"
|
||||
# Function to add phalcon3.
|
||||
add_phalcon3() {
|
||||
if [ -e "${ext_dir:?}/phalcon.so" ]; then
|
||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
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
|
||||
}
|
||||
|
||||
# Function to install phalcon
|
||||
install_phalcon() {
|
||||
extension=$1
|
||||
version=$2
|
||||
(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
|
||||
# Function to add phalcon4.
|
||||
add_phalcon4() {
|
||||
if [ -e "${ext_dir:?}/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||
echo "extension=psr.so" | sudo tee -a "${ini_file:?}"
|
||||
fi
|
||||
|
||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||
if php -m | grep -i -q -w psr; then
|
||||
phalcon_version=$(php -d="extension=phalcon" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||
install_phalcon "$1" "$2"
|
||||
add_phalcon_helper
|
||||
else
|
||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||
add_log "$tick" "$1" "Enabled"
|
||||
echo "extension=phalcon.so" | sudo tee -a "$phalcon_ini_file"
|
||||
fi
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
add_phalcon_helper
|
||||
fi
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
add_phalcon_helper
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$extension_major_version" = "3" ]; then
|
||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||
phalcon_version=$(php -d="extension=phalcon.so" -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
|
||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||
install_phalcon "$1" "$2"
|
||||
else
|
||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
||||
add_log "$tick" "$1" "Enabled"
|
||||
# Function to add phalcon.
|
||||
add_phalcon() {
|
||||
extension=$1
|
||||
status='Enabled'
|
||||
os_name=$(uname -s)
|
||||
phalcon_ini_file="${scan_dir:?}/50-phalcon.ini"
|
||||
extension_major_version=${extension: -1}
|
||||
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
|
||||
else
|
||||
install_phalcon "$1" "$2"
|
||||
fi
|
||||
fi
|
||||
add_extension_log "phalcon" "$status"
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
# 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.
|
||||
read_env() {
|
||||
. /etc/lsb-release
|
||||
@ -35,15 +45,6 @@ cleanup_lists() {
|
||||
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.
|
||||
add_ppa() {
|
||||
if ! apt-cache policy | grep -q ondrej/php; then
|
||||
@ -55,6 +56,16 @@ add_ppa() {
|
||||
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.
|
||||
self_hosted_setup() {
|
||||
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
|
||||
@ -82,7 +93,7 @@ get_pecl_version() {
|
||||
extension=$1
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")"
|
||||
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*)")
|
||||
if [ ! "$pecl_version" ]; then
|
||||
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
||||
@ -90,6 +101,12 @@ get_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.
|
||||
check_extension() {
|
||||
extension=$1
|
||||
@ -148,8 +165,7 @@ add_pdo_extension() {
|
||||
fi
|
||||
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
||||
enable_extension "$pdo_ext" "extension"
|
||||
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
|
||||
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
|
||||
add_extension_log "$pdo_ext" "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -166,10 +182,8 @@ add_extension() {
|
||||
install_command="update_lists && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
|
||||
fi
|
||||
eval "$install_command" >/dev/null 2>&1 ||
|
||||
(update_lists && eval "$install_command" >/dev/null 2>&1) ||
|
||||
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
fi
|
||||
sudo chmod 777 "$ini_file"
|
||||
}
|
||||
@ -190,11 +204,8 @@ add_pecl_extension() {
|
||||
add_log "$tick" "$extension" "Enabled"
|
||||
else
|
||||
delete_extension "$extension"
|
||||
(
|
||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
||||
check_extension "$extension" &&
|
||||
add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||
pecl_install "$extension-$pecl_version"
|
||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -207,21 +218,6 @@ add_unstable_extension() {
|
||||
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
|
||||
add_extension_from_source() {
|
||||
extension=$1
|
||||
@ -232,15 +228,13 @@ add_extension_from_source() {
|
||||
(
|
||||
add_devtools
|
||||
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
|
||||
cd /tmp/"$extension-$release" || exit 1
|
||||
phpize && ./configure "$args" && make && sudo make install
|
||||
enable_extension "$extension" "$prefix"
|
||||
) >/dev/null 2>&1
|
||||
(
|
||||
check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled"
|
||||
) || add_log "$cross" "$extension" "Could not install $extension-$release on PHP $semver"
|
||||
add_extension_log "$extension-$release" "Installed and enabled"
|
||||
}
|
||||
|
||||
# Function to configure composer
|
||||
@ -257,10 +251,6 @@ configure_composer() {
|
||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||
composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
|
||||
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.
|
||||
@ -271,7 +261,7 @@ add_tool() {
|
||||
if [ ! -e "$tool_path" ]; then
|
||||
rm -rf "$tool_path"
|
||||
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
|
||||
sudo chmod a+x "$tool_path"
|
||||
if [ "$tool" = "composer" ]; then
|
||||
@ -315,32 +305,14 @@ add_devtools() {
|
||||
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.
|
||||
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.
|
||||
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
|
||||
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
||||
}
|
||||
@ -349,7 +321,7 @@ setup_old_versions() {
|
||||
add_pecl() {
|
||||
add_devtools >/dev/null 2>&1
|
||||
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
|
||||
configure_pecl >/dev/null 2>&1
|
||||
add_log "$tick" "PECL" "Added"
|
||||
@ -375,14 +347,19 @@ php_semver() {
|
||||
|
||||
# Function to install packaged PHP
|
||||
add_packaged_php() {
|
||||
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
|
||||
update_lists
|
||||
IFS=' ' read -r -a packages <<< "$(echo "cli curl mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
||||
$apt_install "${packages[@]}"
|
||||
else
|
||||
curl "${curl_opts[@]}" "$github"/php-ubuntu/releases/latest/download/install.sh | bash -s "$version"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to update PHP.
|
||||
update_php() {
|
||||
initial_version=$(php_semver)
|
||||
use_package_cache="false"
|
||||
add_packaged_php
|
||||
updated_version=$(php_semver)
|
||||
if [ "$updated_version" != "$initial_version" ]; then
|
||||
@ -407,7 +384,6 @@ add_php() {
|
||||
# Variables
|
||||
tick="✓"
|
||||
cross="✗"
|
||||
lists_updated="false"
|
||||
pecl_config="false"
|
||||
version=$1
|
||||
master_version="8.0"
|
||||
@ -416,6 +392,7 @@ debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
github="https://github.com/shivammathur"
|
||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
||||
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)
|
||||
|
||||
read_env
|
||||
@ -426,8 +403,6 @@ if [ "$runner" = "self-hosted" ]; then
|
||||
else
|
||||
self_hosted_setup >/dev/null 2>&1
|
||||
fi
|
||||
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
|
||||
add_ppa >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# 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) {
|
||||
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.
|
||||
@ -269,25 +265,6 @@ Function Add-Pecl() {
|
||||
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
|
||||
$tick = ([char]8730)
|
||||
$cross = ([char]10007)
|
||||
@ -358,9 +335,11 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
||||
}
|
||||
if ($version -eq $master_version) {
|
||||
$version = 'master'
|
||||
Invoke-WebRequest -UseBasicParsing -Uri https://dl.bintray.com/shivammathur/php/Install-PhpMaster.ps1 -OutFile $php_dir\Install-PhpMaster.ps1 > $null 2>&1
|
||||
& $php_dir\Install-PhpMaster.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir
|
||||
} 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 {
|
||||
if($env:update -eq 'true') {
|
||||
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
|
||||
}
|
||||
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)"
|
||||
|
31
src/tools.ts
31
src/tools.ts
@ -1,6 +1,7 @@
|
||||
import * as utils from './utils';
|
||||
import * as httpm from '@actions/http-client';
|
||||
import {IHttpClientResponse as hcr} from '@actions/http-client/interfaces';
|
||||
import * as path from 'path';
|
||||
|
||||
/**
|
||||
* 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]$/;
|
||||
version = version.replace(/[><=^]*/, '');
|
||||
switch (true) {
|
||||
case version.charAt(0) == 'v':
|
||||
return version.replace('v', '');
|
||||
case composer_regex.test(version):
|
||||
case semver_regex.test(version):
|
||||
return version;
|
||||
@ -361,7 +364,7 @@ export async function getCleanedToolsList(
|
||||
return extension
|
||||
.trim()
|
||||
.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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@ -470,8 +494,9 @@ export async function addTools(
|
||||
let url = '';
|
||||
switch (tool) {
|
||||
case 'blackfire':
|
||||
case 'blackfire-agent':
|
||||
script += await getCommand(os_version, 'blackfire');
|
||||
case 'grpc_php_plugin':
|
||||
case 'protoc':
|
||||
script += await addCustomTool(tool, version, os_version);
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
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