Merge pull request #270 from shivammathur/develop

2.4.2
This commit is contained in:
Shivam Mathur 2020-08-10 14:55:13 +05:30
commit c5e0997b44
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
16 changed files with 363 additions and 378 deletions

View File

@ -143,7 +143,7 @@ with:
- Extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted.
- These extensions have custom support - `gearman` on `Ubuntu`, `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
## :wrench: Tools Support
@ -178,7 +178,7 @@ with:
```
**Notes**
- Both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
- Latest versions of both agent `blackfire-agent` and client `blackfire` are setup when `blackfire` is specified in tools input.
- Tools which cannot be setup gracefully leave an error message in the logs, the action is not interrupted.
## :signal_strength: Coverage Support
@ -455,45 +455,8 @@ To debug any issues, you can use the `verbose` tag instead of `v2`.
### Cache Extensions
You can cache PHP extensions using [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") and [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Actions. Extensions which take very long to setup when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
```yaml
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
env:
extensions: intl, pcov
key: cache-v1 # can be any string, change to clear the extension cache.
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
```
**Note:** If you setup both `TS` and `NTS` PHP versions on `windows`, add `${{ env.phpts }}` to `key` and `restore-keys` inputs in `actions/cache` step.
You can cache PHP extensions using `shivammathur/cache-extensions` and `action/cache` GitHub Actions. Extensions which take very long to setup when cached are available in the next workflow run and are enabled directly. This reduces the workflow execution time.
Refer to [`shivammathur/cache-extensions`](https://github.com/shivammathur/cache-extensions "GitHub Action to cache php extensions") for details.
### Cache Composer Dependencies
@ -646,9 +609,23 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
## :sparkling_heart: Support This Project
If this action helped you.
**Thanks for supporting this project**
- Sponsor the project by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") or by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal"). This project is also available as part of the [Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-setup-php?utm_source=npm-setup-php&utm_medium=referral&utm_campaign=enterprise&utm_term=repo "Tidelift Subscription for setup-php") to support delivering enterprise-level maintenance.
<p>
<a href="https://www.jetbrains.com/?from=setup-php">
<img src="https://shivammathur.com/jetbrains.svg" alt="JetBrains" width="150" height="85">
</a>
<img src="https://shivammathur.com/blank.svg" alt="spacer" width="40" height="85">
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
<img src="https://shivammathur.com/tidelift.png" alt="Tidelift" width="100" height="85">
</a>
</p>
*If this action helped you*
- Sponsor the project by contributing using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal") or by subscribing on [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon").
- If you have an open-source support program, please [contact](mailto:contact@shivammathur.com) to sponsor this project.
- This project is also available as part of the [Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-setup-php?utm_source=npm-setup-php&utm_medium=referral&utm_campaign=enterprise&utm_term=repo "Tidelift Subscription for setup-php") to support delivering enterprise-level maintenance.
- Please star the project and dependencies. If you blog, please share your experience of using this action with the community.
## :package: Dependencies
@ -658,9 +635,12 @@ If this action helped you.
- [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Packaging active PHP packages")
- [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions")
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
- [shivammathur/composer-cache](https://github.com/shivammathur/composer-cache "Cache composer releases")
- [shivammathur/homebrew-extensions](https://github.com/shivammathur/homebrew-extensions "Tap for PHP extensions on MacOS")
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package")
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds on MacOS")
- [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package for Ubuntu")
- [shivammathur/php-builder-windows](https://github.com/shivammathur/php-builder-windows "Nightly PHP package for Windows")
- [shivammathur/php-ubuntu](https://github.com/shivammathur/php-ubuntu "Cache stable PHP Packages for Ubuntu")
- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-darwin "Scripts to setup PHP5 versions on darwin")
- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu")

View File

@ -13,8 +13,8 @@ describe('Extension tests', () => {
expect(win32).toContain('Remove-Extension intl');
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-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');
@ -95,6 +95,11 @@ describe('Extension tests', () => {
linux = await extensions.addExtension('gearman', '7.4', 'linux');
expect(linux).toContain('add_gearman');
linux = await extensions.addExtension('pdo_cubrid', '7.0', 'linux');
expect(linux).toContain('add_cubrid pdo_cubrid');
linux = await extensions.addExtension('cubrid', '7.4', 'linux');
expect(linux).toContain('add_cubrid cubrid');
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');

View File

@ -17,15 +17,6 @@ httpm.HttpClient.prototype.get = jest.fn().mockImplementation(() => {
});
describe('Tools tests', () => {
it('checking getCommand', async () => {
expect(await tools.getCommand('linux', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('darwin', 'tool')).toBe('add_tool ');
expect(await tools.getCommand('win32', 'tool')).toBe('Add-Tool ');
expect(await tools.getCommand('fedora', 'tool')).toContain(
'Platform fedora is not supported'
);
});
it('checking parseToolVersion', async () => {
expect(await tools.getToolVersion('latest')).toBe('latest');
expect(await tools.getToolVersion('1.2.3')).toBe('1.2.3');
@ -402,17 +393,6 @@ 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, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, protoc, symfony, wp-cli',
@ -424,7 +404,7 @@ describe('Tools tests', () => {
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-stable.phar composer'
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@ -499,7 +479,7 @@ describe('Tools tests', () => {
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-stable.phar composer'
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize'
@ -590,7 +570,7 @@ describe('Tools tests', () => {
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
);
expect(script).toContain(
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain(
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@ -631,7 +611,7 @@ describe('Tools tests', () => {
);
expect(script).toContain(
'Add-Tool https://getcomposer.org/composer-stable.phar composer'
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
);
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
@ -649,12 +629,12 @@ describe('Tools tests', () => {
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer-1.phar composer'
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
);
script = await tools.addTools('composer:preview', '7.4', 'linux');
expect(script).toContain(
'add_tool https://getcomposer.org/composer-preview.phar composer'
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer'
);
script = await tools.addTools(
'composer:v1, composer:preview, composer:snapshot',
@ -662,7 +642,7 @@ describe('Tools tests', () => {
'linux'
);
expect(script).toContain(
'add_tool https://getcomposer.org/composer.phar composer'
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer'
);
});
});

View File

@ -174,6 +174,15 @@ describe('Utils tests', () => {
);
});
it('checking getCommand', async () => {
expect(await utils.getCommand('linux', 'tool')).toBe('add_tool ');
expect(await utils.getCommand('darwin', 'tool')).toBe('add_tool ');
expect(await utils.getCommand('win32', 'tool')).toBe('Add-Tool ');
expect(await utils.getCommand('fedora', 'tool')).toContain(
'Platform fedora is not supported'
);
});
it('checking joins', async () => {
expect(await utils.joins('a', 'b', 'c')).toBe('a b c');
});
@ -186,4 +195,17 @@ describe('Utils tests', () => {
'Platform fedora is not supported'
);
});
it('checking customPackage', async () => {
const script_path: string = path.join('ext', 'pkg.sh');
expect(await utils.customPackage('pkg', 'ext', '1.2.3', 'linux')).toContain(
script_path + '\nadd_pkg 1.2.3'
);
expect(
await utils.customPackage('pdo_pkg', 'ext', '1.2.3', 'linux')
).toContain(script_path + '\nadd_pkg 1.2.3');
expect(
await utils.customPackage('pkg8', 'ext', '1.2.3', 'linux')
).toContain(script_path + '\nadd_pkg 1.2.3');
});
});

164
dist/index.js vendored
View File

@ -1314,7 +1314,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
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;
exports.customPackage = exports.scriptExtension = exports.joins = exports.getCommand = exports.getUnsupportedLog = exports.suppressOutput = exports.getExtensionPrefix = exports.CSVArray = exports.extensionArray = exports.writeScript = exports.readScript = exports.addLog = exports.stepLog = exports.log = exports.color = exports.asyncForEach = exports.getInput = void 0;
const fs = __importStar(__webpack_require__(747));
const path = __importStar(__webpack_require__(622));
const core = __importStar(__webpack_require__(470));
@ -1542,6 +1542,24 @@ async function getUnsupportedLog(extension, version, os_version) {
'\n');
}
exports.getUnsupportedLog = getUnsupportedLog;
/**
* Function to get command to setup tools
*
* @param os_version
* @param suffix
*/
async function getCommand(os_version, suffix) {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
}
exports.getCommand = getCommand;
/**
* Function to join strings with space
*
@ -1568,6 +1586,22 @@ async function scriptExtension(os_version) {
}
}
exports.scriptExtension = scriptExtension;
/**
* Function to get script to add tools with custom support.
*
* @param pkg
* @param type
* @param version
* @param os_version
*/
async function customPackage(pkg, type, version, os_version) {
const pkg_name = pkg.replace(/\d+|pdo[_-]/, '');
const script_extension = await scriptExtension(os_version);
const script = path.join(__dirname, '../src/scripts/' + type + '/' + pkg_name + script_extension);
const command = await getCommand(os_version, pkg_name);
return '\n. ' + script + '\n' + command + version;
}
exports.customPackage = customPackage;
/***/ }),
@ -1947,28 +1981,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
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;
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 = 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
*
* @param os_version
* @param suffix
*/
async function getCommand(os_version, suffix) {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return await utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
}
exports.getCommand = getCommand;
/**
* Function to get tool version
*
@ -2116,10 +2131,10 @@ exports.getCodeceptionUri = getCodeceptionUri;
async function addPhive(version, os_version) {
switch (version) {
case 'latest':
return ((await getCommand(os_version, 'tool')) +
return ((await utils.getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive');
default:
return ((await getCommand(os_version, 'tool')) +
return ((await utils.getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
@ -2229,21 +2244,24 @@ exports.addComposer = addComposer;
* @param version
*/
async function getComposerUrl(version) {
const cache_url = 'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-' +
version.replace('latest', 'stable') +
'.phar,';
const getComposerUrlHelper = async function (version) {
const client = new httpm.HttpClient('setup-php');
const response = await client.get('https://getcomposer.org/versions');
const data = JSON.parse(await response.readBody());
return 'https://getcomposer.org' + data[version][0]['path'];
return cache_url + 'https://getcomposer.org' + data[version][0]['path'];
};
switch (version) {
case 'snapshot':
return 'https://getcomposer.org/composer.phar';
return cache_url + 'https://getcomposer.org/composer.phar';
case 'preview':
case '1':
case '2':
return await getComposerUrlHelper(version);
default:
return 'https://getcomposer.org/composer-stable.phar';
return cache_url + 'https://getcomposer.org/composer-stable.phar';
}
}
exports.getComposerUrl = getComposerUrl;
@ -2274,7 +2292,7 @@ exports.getCleanedToolsList = getCleanedToolsList;
* @param os_version
*/
async function addArchive(tool, version, url, os_version) {
return (await getCommand(os_version, 'tool')) + url + ' ' + tool;
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
}
exports.addArchive = addArchive;
/**
@ -2307,24 +2325,10 @@ exports.addDevTools = addDevTools;
* @param os_version
*/
async function addPackage(tool, release, prefix, os_version) {
const tool_command = await getCommand(os_version, 'composertool');
const tool_command = await utils.getCommand(os_version, 'composertool');
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
*
@ -2347,7 +2351,7 @@ async function addTools(tools_csv, php_version, os_version) {
case 'blackfire':
case 'grpc_php_plugin':
case 'protoc':
script += await addCustomTool(tool, version, os_version);
script += await utils.customPackage(tool, 'tools', version, os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
@ -2398,7 +2402,7 @@ async function addTools(tools_csv, php_version, os_version) {
script += await addArchive(tool, version, url, os_version);
break;
case 'pecl':
script += await getCommand(os_version, 'pecl');
script += await utils.getCommand(os_version, 'pecl');
break;
case 'phan':
url = github + 'phan/phan/' + uri;
@ -3625,22 +3629,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.customExtension = void 0;
const path = __importStar(__webpack_require__(622));
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = void 0;
const utils = __importStar(__webpack_require__(163));
/**
* Function to get script to install custom extensions
*
* @param script
* @param command
*/
async function customExtension(script, ...command) {
return ('\n. ' +
path.join(__dirname, '../src/scripts/ext/' + script) +
'\n' +
(await utils.joins(...command)));
}
exports.customExtension = customExtension;
/**
* Install and enable extensions for darwin
*
@ -3665,20 +3655,14 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
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 /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^pdo_oci$|^oci8$/.test(extension):
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += await customExtension('phalcon.sh', 'add_phalcon', extension);
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
@ -3741,23 +3725,17 @@ async function addExtensionWindows(extension_csv, version) {
case /^:/.test(ext_name):
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
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 += await customExtension('blackfire.ps1', 'Add-Blackfire', extension);
break;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 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 /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^pdo_oci$|^oci8$/.test(extension):
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
add_script += await customExtension('phalcon.ps1', 'Add-Phalcon', extension);
break;
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version);
@ -3824,25 +3802,19 @@ async function addExtensionLinux(extension_csv, version, pipe) {
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
add_script += await customExtension('blackfire.sh', 'add_blackfire', extension);
return;
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// 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 5.6gearman..7.4gearman
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
case /^pdo_oci$|^oci8$/.test(extension):
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
add_script += await customExtension('gearman.sh', 'add_gearman');
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):

104
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.4.1",
"version": "2.4.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -40,16 +40,16 @@
}
},
"@babel/core": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.0.tgz",
"integrity": "sha512-mkLq8nwaXmDtFmRkQ8ED/eA2CnVw4zr7dCztKalZXBvdK5EeNUAesrrwUqjQEzFgomJssayzB0aqlOsP1vGLqg==",
"version": "7.11.1",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.1.tgz",
"integrity": "sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/generator": "^7.11.0",
"@babel/helper-module-transforms": "^7.11.0",
"@babel/helpers": "^7.10.4",
"@babel/parser": "^7.11.0",
"@babel/parser": "^7.11.1",
"@babel/template": "^7.10.4",
"@babel/traverse": "^7.11.0",
"@babel/types": "^7.11.0",
@ -285,9 +285,9 @@
}
},
"@babel/parser": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.0.tgz",
"integrity": "sha512-qvRvi4oI8xii8NllyEc4MDJjuZiNaRzyb7Y7lup1NqJV8TZHF4O27CcP+72WPn/k1zkgJ6WJfnIbk4jTsVAZHw==",
"version": "7.11.3",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.3.tgz",
"integrity": "sha512-REo8xv7+sDxkKvoxEywIdsNFiZLybwdI7hcT5uEPyQrSMB4YQ973BfC9OOrD/81MaIjh6UxdulIQXkjmiH3PcA==",
"dev": true
},
"@babel/plugin-syntax-async-generators": {
@ -1034,9 +1034,9 @@
}
},
"@types/jest": {
"version": "26.0.8",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.8.tgz",
"integrity": "sha512-eo3VX9jGASSuv680D4VQ89UmuLZneNxv2MCZjfwlInav05zXVJTzfc//lavdV0GPwSxsXJTy2jALscB7Acqg0g==",
"version": "26.0.9",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.9.tgz",
"integrity": "sha512-k4qFfJ5AUKrWok5KYXp2EPm89b0P/KZpl7Vg4XuOTVVQEhLDBDBU3iBFrjjdgd8fLw96aAtmnwhXHl63bWeBQQ==",
"dev": true,
"requires": {
"jest-diff": "^25.2.1",
@ -1101,12 +1101,12 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.7.1.tgz",
"integrity": "sha512-3DB9JDYkMrc8Au00rGFiJLK2Ja9CoMP6Ut0sHsXp3ZtSugjNxvSSHTnKLfo4o+QmjYBJqEznDqsG1zj4F2xnsg==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.8.0.tgz",
"integrity": "sha512-lFb4VCDleFSR+eo4Ew+HvrJ37ZH1Y9ZyE+qyP7EiwBpcCVxwmUc5PAqhShCQ8N8U5vqYydm74nss+a0wrrCErw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "3.7.1",
"@typescript-eslint/experimental-utils": "3.8.0",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -1115,45 +1115,45 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.7.1.tgz",
"integrity": "sha512-TqE97pv7HrqWcGJbLbZt1v59tcqsSVpWTOf1AqrWK7n8nok2sGgVtYRuGXeNeLw3wXlLEbY1MKP3saB2HsO/Ng==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.8.0.tgz",
"integrity": "sha512-o8T1blo1lAJE0QDsW7nSyvZHbiDzQDjINJKyB44Z3sSL39qBy5L10ScI/XwDtaiunoyKGLiY9bzRk4YjsUZl8w==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/types": "3.7.1",
"@typescript-eslint/typescript-estree": "3.7.1",
"@typescript-eslint/types": "3.8.0",
"@typescript-eslint/typescript-estree": "3.8.0",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.7.1.tgz",
"integrity": "sha512-W4QV/gXvfIsccN8225784LNOorcm7ch68Fi3V4Wg7gmkWSQRKevO4RrRqWo6N/Z/myK1QAiGgeaXN57m+R/8iQ==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.8.0.tgz",
"integrity": "sha512-u5vjOBaCsnMVQOvkKCXAmmOhyyMmFFf5dbkM3TIbg3MZ2pyv5peE4gj81UAbTHwTOXEwf7eCQTUMKrDl/+qGnA==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "3.7.1",
"@typescript-eslint/types": "3.7.1",
"@typescript-eslint/typescript-estree": "3.7.1",
"@typescript-eslint/experimental-utils": "3.8.0",
"@typescript-eslint/types": "3.8.0",
"@typescript-eslint/typescript-estree": "3.8.0",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/types": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.7.1.tgz",
"integrity": "sha512-PZe8twm5Z4b61jt7GAQDor6KiMhgPgf4XmUb9zdrwTbgtC/Sj29gXP1dws9yEn4+aJeyXrjsD9XN7AWFhmnUfg==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.8.0.tgz",
"integrity": "sha512-8kROmEQkv6ss9kdQ44vCN1dTrgu4Qxrd2kXr10kz2NP5T8/7JnEfYNxCpPkArbLIhhkGLZV3aVMplH1RXQRF7Q==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.1.tgz",
"integrity": "sha512-m97vNZkI08dunYOr2lVZOHoyfpqRs0KDpd6qkGaIcLGhQ2WPtgHOd/eVbsJZ0VYCQvupKrObAGTOvk3tfpybYA==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.8.0.tgz",
"integrity": "sha512-MTv9nPDhlKfclwnplRNDL44mP2SY96YmPGxmMbMy6x12I+pERcxpIUht7DXZaj4mOKKtet53wYYXU0ABaiXrLw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "3.7.1",
"@typescript-eslint/visitor-keys": "3.7.1",
"@typescript-eslint/types": "3.8.0",
"@typescript-eslint/visitor-keys": "3.8.0",
"debug": "^4.1.1",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
@ -1163,9 +1163,9 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.1.tgz",
"integrity": "sha512-xn22sQbEya+Utj2IqJHGLA3i1jDzR43RzWupxojbSWnj3nnPLavaQmWe5utw03CwYao3r00qzXfgJMGNkrzrAA==",
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.8.0.tgz",
"integrity": "sha512-gfqQWyVPpT9NpLREXNR820AYwgz+Kr1GuF3nf1wxpHD6hdxI62tq03ToomFnDxY0m3pUB39IF7sil7D5TQexLA==",
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
@ -1184,9 +1184,9 @@
"dev": true
},
"acorn": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
"integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==",
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
"dev": true
},
"acorn-globals": {
@ -3409,9 +3409,9 @@
}
},
"is-docker": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.0.tgz",
"integrity": "sha512-mB2WygGsSeoXtLKpSYzP6sa0Z9DyU9ZyKlnvuZWxCociaI0qsF8u12sR72DFTX236g1u6oWSWYFuUk09nGQEjg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz",
"integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==",
"dev": true,
"optional": true
},
@ -3470,9 +3470,9 @@
"dev": true
},
"is-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz",
"integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
"dev": true,
"requires": {
"has-symbols": "^1.0.1"
@ -4914,9 +4914,9 @@
"dev": true
},
"jsdom": {
"version": "16.3.0",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.3.0.tgz",
"integrity": "sha512-zggeX5UuEknpdZzv15+MS1dPYG0J/TftiiNunOeNxSl3qr8Z6cIlQpN0IdJa44z9aFxZRIVqRncvEhQ7X5DtZg==",
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.4.0.tgz",
"integrity": "sha512-lYMm3wYdgPhrl7pDcRmvzPhhrGVBeVhPIqeHjzeiHN3DFmD1RBpbExbi8vU7BJdH8VAZYovR8DMt0PNNDM7k8w==",
"dev": true,
"requires": {
"abab": "^2.0.3",
@ -5421,9 +5421,9 @@
}
},
"onetime": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.1.tgz",
"integrity": "sha512-ZpZpjcJeugQfWsfyQlshVoowIIQ1qBGSVll4rfDq6JJVO//fesjoX808hXWfBjY+ROZgpKDI5TRSRBSoJiZ8eg==",
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
"dev": true,
"requires": {
"mimic-fn": "^2.1.0"

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.4.1",
"version": "2.4.2",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
@ -31,10 +31,10 @@
"fs": "0.0.1-security"
},
"devDependencies": {
"@types/jest": "^26.0.8",
"@types/jest": "^26.0.9",
"@types/node": "^14.0.27",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"@zeit/ncc": "^0.22.3",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",

View File

@ -1,24 +1,5 @@
import * as path from 'path';
import * as utils from './utils';
/**
* Function to get script to install custom extensions
*
* @param script
* @param command
*/
export async function customExtension(
script: string,
...command: string[]
): Promise<string> {
return (
'\n. ' +
path.join(__dirname, '../src/scripts/ext/' + script) +
'\n' +
(await utils.joins(...command))
);
}
/**
* Install and enable extensions for darwin
*
@ -47,29 +28,20 @@ export async function addExtensionDarwin(
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
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
add_script += await utils.customPackage(
ext_name,
'ext',
extension,
'darwin'
);
return;
// match pre-release versions. For example - xdebug-beta
@ -154,33 +126,24 @@ export async function addExtensionWindows(
case /^:/.test(ext_name):
remove_script += '\nRemove-Extension ' + ext_name.slice(1);
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(
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
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
add_script += await utils.customPackage(
ext_name,
'ext',
extension,
'win32'
);
break;
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
add_script += await utils.joins(
@ -269,35 +232,28 @@ export async function addExtensionLinux(
remove_script += '\nremove_extension ' + ext_name.slice(1);
return;
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver}
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// match pdo_oci and oci8
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
// match 5.6gearman..7.4gearman
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
add_script += await customExtension(
'blackfire.sh',
'add_blackfire',
extension
);
return;
// match pdo_oci and oci8
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
version_extension
):
case /^pdo_oci$|^oci8$/.test(extension):
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 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
add_script += await customExtension('gearman.sh', 'add_gearman');
add_script += await utils.customPackage(
ext_name,
'ext',
extension,
'linux'
);
return;
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):

View File

@ -167,7 +167,13 @@ add_tool() {
rm -rf "$tool_path"
fi
if [ "$tool" = "composer" ]; then
IFS="," read -r -a urls <<< "$url"
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "${urls[0]}") ||
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "${urls[1]}")
else
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
fi
if [ "$status_code" = "200" ]; then
sudo chmod a+x "$tool_path"
if [ "$tool" = "composer" ]; then
@ -235,7 +241,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)
curl_opts=(-sL)
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
read_env

50
src/scripts/ext/cubrid.sh Normal file
View File

@ -0,0 +1,50 @@
# Function to log license details.
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 "Cubrid CCI package is required for %s extension.\n" "$ext"
printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
echo "::endgroup::"
}
# Function to set cubrid repo for the extension.
set_cubrid_repo() {
case "${ext:?}" in
"cubrid") cubrid_repo="cubrid-php";;
"pdo_cubrid") cubrid_repo="cubrid-pdo";;
esac
}
# Function to set cubrid branch for a PHP version.
set_cubrid_branch() {
case "${version:?}" in
5.[3-6]) cubrid_branch="RB-9.3.0";;
*) cubrid_branch="develop";;
esac
}
add_cubrid_helper() {
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
status='Installed and enabled'
set_cubrid_repo
set_cubrid_branch
(
git clone -b "$cubrid_branch" --recursive "https://github.com/CUBRID/$cubrid_repo" "/tmp/$cubrid_repo"
cd "/tmp/$cubrid_repo" || exit
! [[ "$version" =~ ${old_versions:?} ]] && add_devtools
phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=shared
make -j"$(nproc)"
sudo make install
)
echo "extension=$ext.so" | sudo tee "${scan_dir:?}/$ext.ini"
fi
}
# Function to add cubrid and pdo_cubrid.
add_cubrid() {
ext=$1
status='Enabled'
add_cubrid_helper >/dev/null 2>&1
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}

View File

@ -21,7 +21,7 @@ Function Add-InstantClient() {
}
# Function to install oci8 and pdo_oci.
Function Add-OCI() {
Function Add-Oci() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
@ -35,6 +35,7 @@ Function Add-OCI() {
if ($extension -eq "pdo_oci") {
Enable-PhpExtension pdo_oci -Path $php_dir
} else {
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
$status = 'Installed and enabled'
$ociVersion = '2.2.0'
if ($version -eq '7.0') {
@ -45,6 +46,8 @@ Function Add-OCI() {
$ociUrl = Get-PeclArchiveUrl oci8 $ociVersion $installed
Invoke-WebRequest -UseBasicParsing -Uri $ociUrl -OutFile $php_dir\oci8.zip
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
}
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
}
Add-Log $tick $extension $status

View File

@ -261,7 +261,13 @@ add_tool() {
if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path"
fi
if [ "$tool" = "composer" ]; then
IFS="," read -r -a urls <<< "$url"
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "${urls[0]}") ||
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "${urls[1]}")
else
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
fi
if [ "$status_code" = "200" ]; then
sudo chmod a+x "$tool_path"
if [ "$tool" = "composer" ]; then
@ -392,7 +398,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)
curl_opts=(-sL)
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
read_env

View File

@ -19,7 +19,7 @@ add_protoc() {
[ "$(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
sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google
) >/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"

View File

@ -187,8 +187,6 @@ Function Add-Tool() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)]
[string]
$url,
[Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()]
@ -199,6 +197,7 @@ Function Add-Tool() {
if (Test-Path $bin_dir\$tool) {
Remove-Item $bin_dir\$tool
}
if($url.Count -gt 1) { $url = $url[0] }
if ($tool -eq "symfony") {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\$tool.exe
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.exe" >$null 2>&1

View File

@ -1,32 +1,6 @@
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
*
* @param os_version
* @param suffix
*/
export async function getCommand(
os_version: string,
suffix: string
): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}
/**
* Function to get tool version
@ -194,12 +168,12 @@ export async function addPhive(
switch (version) {
case 'latest':
return (
(await getCommand(os_version, 'tool')) +
(await utils.getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive'
);
default:
return (
(await getCommand(os_version, 'tool')) +
(await utils.getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
@ -329,23 +303,27 @@ export async function addComposer(tools_list: string[]): Promise<string[]> {
* @param version
*/
export async function getComposerUrl(version: string): Promise<string> {
const cache_url =
'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-' +
version.replace('latest', 'stable') +
'.phar,';
const getComposerUrlHelper = async function (
version: string
): Promise<string> {
const client: httpm.HttpClient = new httpm.HttpClient('setup-php');
const response: hcr = await client.get('https://getcomposer.org/versions');
const data = JSON.parse(await response.readBody());
return 'https://getcomposer.org' + data[version][0]['path'];
return cache_url + 'https://getcomposer.org' + data[version][0]['path'];
};
switch (version) {
case 'snapshot':
return 'https://getcomposer.org/composer.phar';
return cache_url + 'https://getcomposer.org/composer.phar';
case 'preview':
case '1':
case '2':
return await getComposerUrlHelper(version);
default:
return 'https://getcomposer.org/composer-stable.phar';
return cache_url + 'https://getcomposer.org/composer-stable.phar';
}
}
@ -386,7 +364,7 @@ export async function addArchive(
url: string,
os_version: string
): Promise<string> {
return (await getCommand(os_version, 'tool')) + url + ' ' + tool;
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
}
/**
@ -438,31 +416,10 @@ export async function addPackage(
prefix: string,
os_version: string
): Promise<string> {
const tool_command = await getCommand(os_version, 'composertool');
const tool_command = await utils.getCommand(os_version, 'composertool');
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
*
@ -496,7 +453,7 @@ export async function addTools(
case 'blackfire':
case 'grpc_php_plugin':
case 'protoc':
script += await addCustomTool(tool, version, os_version);
script += await utils.customPackage(tool, 'tools', version, os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
@ -552,7 +509,7 @@ export async function addTools(
script += await addArchive(tool, version, url, os_version);
break;
case 'pecl':
script += await getCommand(os_version, 'pecl');
script += await utils.getCommand(os_version, 'pecl');
break;
case 'phan':
url = github + 'phan/phan/' + uri;

View File

@ -284,6 +284,31 @@ export async function getUnsupportedLog(
);
}
/**
* Function to get command to setup tools
*
* @param os_version
* @param suffix
*/
export async function getCommand(
os_version: string,
suffix: string
): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_' + suffix + ' ';
case 'win32':
return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default:
return await log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}
/**
* Function to join strings with space
*
@ -313,3 +338,27 @@ export async function scriptExtension(os_version: string): Promise<string> {
);
}
}
/**
* Function to get script to add tools with custom support.
*
* @param pkg
* @param type
* @param version
* @param os_version
*/
export async function customPackage(
pkg: string,
type: string,
version: string,
os_version: string
): Promise<string> {
const pkg_name: string = pkg.replace(/\d+|pdo[_-]/, '');
const script_extension: string = await scriptExtension(os_version);
const script: string = path.join(
__dirname,
'../src/scripts/' + type + '/' + pkg_name + script_extension
);
const command: string = await getCommand(os_version, pkg_name);
return '\n. ' + script + '\n' + command + version;
}