v1 maintenance release - 1.8.4

This commit is contained in:
Shivam Mathur 2020-03-01 06:20:48 +05:30
parent 3579c7ef28
commit 0da52b1327
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
15 changed files with 517 additions and 523 deletions

View File

@ -2,28 +2,34 @@ import * as tools from '../src/tools';
describe('Tools tests', () => { describe('Tools tests', () => {
it('checking getCommand', async () => { it('checking getCommand', async () => {
expect(await tools.getArchiveCommand('linux')).toBe('add_tool '); expect(await tools.getCommand('linux', 'tool')).toBe('add_tool ');
expect(await tools.getArchiveCommand('darwin')).toBe('add_tool '); expect(await tools.getCommand('darwin', 'tool')).toBe('add_tool ');
expect(await tools.getArchiveCommand('win32')).toBe('Add-Tool '); expect(await tools.getCommand('win32', 'tool')).toBe('Add-Tool ');
expect(await tools.getArchiveCommand('fedora')).toContain( expect(await tools.getCommand('fedora', 'tool')).toContain(
'Platform fedora is not supported' 'Platform fedora is not supported'
); );
}); });
it('checking getCommand', async () => { it('checking getCommand', async () => {
expect(await tools.getPackageCommand('linux')).toBe('add_composer_tool '); expect(await tools.getCommand('linux', 'composertool')).toBe(
expect(await tools.getPackageCommand('darwin')).toBe('add_composer_tool '); 'add_composertool '
expect(await tools.getPackageCommand('win32')).toBe('Add-Composer-Tool '); );
expect(await tools.getPackageCommand('fedora')).toContain( expect(await tools.getCommand('darwin', 'composertool')).toBe(
'add_composertool '
);
expect(await tools.getCommand('win32', 'composertool')).toBe(
'Add-Composertool '
);
expect(await tools.getCommand('fedora', 'composertool')).toContain(
'Platform fedora is not supported' 'Platform fedora is not supported'
); );
}); });
it('checking getPECLCommand', async () => { it('checking getCommand', async () => {
expect(await tools.getPECLCommand('linux')).toBe('add_pecl '); expect(await tools.getCommand('linux', 'pecl')).toBe('add_pecl ');
expect(await tools.getPECLCommand('darwin')).toBe('add_pecl '); expect(await tools.getCommand('darwin', 'pecl')).toBe('add_pecl ');
expect(await tools.getPECLCommand('win32')).toBe('Add-PECL '); expect(await tools.getCommand('win32', 'pecl')).toBe('Add-Pecl ');
expect(await tools.getPECLCommand('fedora')).toContain( expect(await tools.getCommand('fedora', 'pecl')).toContain(
'Platform fedora is not supported' 'Platform fedora is not supported'
); );
}); });
@ -107,22 +113,13 @@ describe('Tools tests', () => {
}); });
it('checking getCodeceptionUriBuilder', async () => { it('checking getCodeceptionUriBuilder', async () => {
expect(await tools.getCodeceptionUriBuilder('3.2.1', '5.6', 'php56')).toBe( expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php56')).toBe(
'releases/3.2.1/php56/codecept.phar' 'releases/3.2.1/php56/codecept.phar'
); );
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.0', 'php54')).toBe( expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
'releases/3.2.1/php54/codecept.phar' 'releases/3.2.1/php54/codecept.phar'
); );
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.1', 'php56')).toBe( expect(await tools.getCodeceptionUriBuilder('3.2.1', '')).toBe(
'releases/3.2.1/php56/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.2', 'php56')).toBe(
'releases/3.2.1/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.3', 'php56')).toBe(
'releases/3.2.1/codecept.phar'
);
expect(await tools.getCodeceptionUriBuilder('3.2.1', '7.4', 'php56')).toBe(
'releases/3.2.1/codecept.phar' 'releases/3.2.1/codecept.phar'
); );
}); });
@ -146,17 +143,59 @@ describe('Tools tests', () => {
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe( expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
'codecept.phar' 'codecept.phar'
); );
expect(await tools.getCodeceptionUri('3.2.1', '5.6')).toBe( expect(await tools.getCodeceptionUri('4.0.0', '7.4')).toBe(
'releases/3.2.1/php54/codecept.phar' 'releases/4.0.0/codecept.phar'
); );
expect(await tools.getCodeceptionUri('4.3.2', '5.6')).toBe( expect(await tools.getCodeceptionUri('4.0.0', '5.6')).toBe(
'releases/4.3.2/php56/codecept.phar' 'releases/4.0.0/php56/codecept.phar'
); );
expect(await tools.getCodeceptionUri('3.2.1', '7.4')).toBe( expect(await tools.getCodeceptionUri('4.0.0', '7.1')).toBe(
'releases/3.2.1/codecept.phar' 'releases/4.0.0/php56/codecept.phar'
); );
expect(await tools.getCodeceptionUri('4.3.2', '7.4')).toBe( expect(await tools.getCodeceptionUri('3.1.0', '7.4')).toBe(
'releases/4.3.2/codecept.phar' 'releases/3.1.0/codecept.phar'
);
expect(await tools.getCodeceptionUri('3.1.0', '5.6')).toBe(
'releases/3.1.0/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.5.4', '7.4')).toBe(
'releases/2.5.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.5.4', '5.6')).toBe(
'releases/2.5.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.3.4', '7.4')).toBe(
'releases/2.3.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.3.4', '5.4')).toBe(
'releases/2.3.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '5.6')).toBe(
'releases/2.2.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '7.4')).toBe(
'releases/2.2.4/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.2.4', '5.4')).toBe(
'releases/2.2.4/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.7', '5.6')).toBe(
'releases/2.1.7/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.7', '5.4')).toBe(
'releases/2.1.7/php54/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.5', '5.4')).toBe(
'releases/2.1.5/codecept.phar'
);
expect(await tools.getCodeceptionUri('2.1.5', '7.4')).toBe(
'releases/2.1.5/codecept.phar'
);
expect(await tools.getCodeceptionUri('1.6.9', '7.4')).toBe(
'releases/1.6.9/codecept.phar'
);
expect(await tools.getCodeceptionUri('1.5.0', '7.4')).toBe(
'releases/1.5.0/codecept.phar'
); );
}); });
@ -173,11 +212,11 @@ describe('Tools tests', () => {
}); });
it('checking getPhpunitUri', async () => { it('checking getPhpunitUri', async () => {
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe( expect(await tools.getPharUrl('domain', 'tool', '', 'latest')).toBe(
'https://phar.phpunit.de/tool.phar' 'domain/tool.phar'
); );
expect(await tools.getPhpunitUrl('tool', '1.2.3')).toBe( expect(await tools.getPharUrl('domain', 'tool', 'v', '1.2.3')).toBe(
'https://phar.phpunit.de/tool-1.2.3.phar' 'domain/tool-v1.2.3.phar'
); );
}); });
@ -190,7 +229,7 @@ describe('Tools tests', () => {
); );
}); });
it('checking getDeployerUri', async () => { it('checking addComposer', async () => {
expect(await tools.addComposer(['a', 'b'])).toStrictEqual([ expect(await tools.addComposer(['a', 'b'])).toStrictEqual([
'composer', 'composer',
'a', 'a',
@ -311,13 +350,13 @@ describe('Tools tests', () => {
'user/', 'user/',
'linux' 'linux'
); );
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/'); expect(script).toContain('add_composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'darwin'); script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'darwin');
expect(script).toContain('add_composer_tool tool tool:1.2.3 user/'); expect(script).toContain('add_composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32'); script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'win32');
expect(script).toContain('Add-Composer-Tool tool tool:1.2.3 user/'); expect(script).toContain('Add-Composertool tool tool:1.2.3 user/');
script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora'); script = await tools.addPackage('tool', 'tool:1.2.3', 'user/', 'fedora');
expect(script).toContain('Platform fedora is not supported'); expect(script).toContain('Platform fedora is not supported');
@ -330,7 +369,7 @@ describe('Tools tests', () => {
'linux' 'linux'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer' 'add_tool https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr' 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@ -351,8 +390,8 @@ describe('Tools tests', () => {
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony' 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
); );
expect(script).toContain('add_pecl'); expect(script).toContain('add_pecl');
expect(script).toContain('add_composer_tool phinx phinx robmorgan/'); expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/'); expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_devtools'); expect(script).toContain('add_devtools');
expect(script).toContain('add_log "$tick" "php-config" "Added"'); expect(script).toContain('add_log "$tick" "php-config" "Added"');
expect(script).toContain('add_log "$tick" "phpize" "Added"'); expect(script).toContain('add_log "$tick" "phpize" "Added"');
@ -364,7 +403,7 @@ describe('Tools tests', () => {
'darwin' 'darwin'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/composer/composer/releases/latest/download/composer.phar composer' 'add_tool https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr' 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
@ -384,12 +423,12 @@ describe('Tools tests', () => {
expect(script).toContain( expect(script).toContain(
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm' 'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
); );
expect(script).toContain('add_composer_tool phinx phinx robmorgan/'); expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive' 'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
); );
expect(script).toContain( expect(script).toContain(
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-' 'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony' 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
@ -407,7 +446,7 @@ describe('Tools tests', () => {
'win32' 'win32'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer' 'Add-Tool https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr' 'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
@ -415,13 +454,11 @@ describe('Tools tests', () => {
expect(script).toContain( expect(script).toContain(
'Add-Tool https://deployer.org/deployer.phar deployer' 'Add-Tool https://deployer.org/deployer.phar deployer'
); );
expect(script).toContain( expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
'Add-Composer-Tool prestissimo prestissimo hirak/'
);
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd' 'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
); );
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/'); expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive' 'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
); );
@ -440,14 +477,12 @@ describe('Tools tests', () => {
'win32' 'win32'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/composer/composer/releases/latest/download/composer.phar composer' 'Add-Tool https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain( expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/' 'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain(
'Add-Composer-Tool composer-prefetcher composer-prefetcher narrowspark/automatic-'
); );
}); });
}); });

View File

@ -3,6 +3,7 @@ author: shivammathur
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer' description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
branding: branding:
color: 'purple' color: 'purple'
icon: 'play-circle'
inputs: inputs:
php-version: php-version:
description: 'Setup PHP version.' description: 'Setup PHP version.'

140
dist/index.js vendored
View File

@ -1452,6 +1452,13 @@ exports.setFailed = setFailed;
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// Logging Commands // Logging Commands
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/**
* Gets whether Actions Step Debug is on or not
*/
function isDebug() {
return process.env['RUNNER_DEBUG'] === '1';
}
exports.isDebug = isDebug;
/** /**
* Writes debug message to user log * Writes debug message to user log
* @param message debug message * @param message debug message
@ -1575,63 +1582,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const utils = __importStar(__webpack_require__(163)); const utils = __importStar(__webpack_require__(163));
/** /**
* Function to get command to setup tool * Function to get command to setup tools
* *
* @param os_version * @param os_version
*/ */
function getArchiveCommand(os_version) { function getCommand(os_version, suffix) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (os_version) { switch (os_version) {
case 'linux': case 'linux':
case 'darwin': case 'darwin':
return 'add_tool '; return 'add_' + suffix + ' ';
case 'win32': case 'win32':
return 'Add-Tool '; return 'Add-' + suffix.charAt(0).toUpperCase() + suffix.slice(1) + ' ';
default: default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error'); return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
} }
}); });
} }
exports.getArchiveCommand = getArchiveCommand; exports.getCommand = getCommand;
/**
* Function to get command to setup tools using composer
*
* @param os_version
*/
function getPackageCommand(os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_composer_tool ';
case 'win32':
return 'Add-Composer-Tool ';
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.getPackageCommand = getPackageCommand;
/**
*
* Function to get command to setup PECL
*
* @param os_version
*/
function getPECLCommand(os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_pecl ';
case 'win32':
return 'Add-PECL ';
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
});
}
exports.getPECLCommand = getPECLCommand;
/** /**
* Function to get tool version * Function to get tool version
* *
@ -1703,20 +1671,13 @@ exports.getUri = getUri;
* Helper function to get the codeception url * Helper function to get the codeception url
* *
* @param version * @param version
* @param php_version
* @param suffix * @param suffix
*/ */
function getCodeceptionUriBuilder(version, php_version, suffix) { function getCodeceptionUriBuilder(version, suffix) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (true) {
case /^5\.6$|^7\.[0|1]$/.test(php_version):
return ['releases', version, suffix, 'codecept.phar'] return ['releases', version, suffix, 'codecept.phar']
.filter(Boolean) .filter(Boolean)
.join('/'); .join('/');
case /^7\.[2-4]$/.test(php_version):
default:
return ['releases', version, 'codecept.phar'].filter(Boolean).join('/');
}
}); });
} }
exports.getCodeceptionUriBuilder = getCodeceptionUriBuilder; exports.getCodeceptionUriBuilder = getCodeceptionUriBuilder;
@ -1728,19 +1689,55 @@ exports.getCodeceptionUriBuilder = getCodeceptionUriBuilder;
*/ */
function getCodeceptionUri(version, php_version) { function getCodeceptionUri(version, php_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const codecept = yield getCodeceptionUriBuilder(version, '');
const codecept54 = yield getCodeceptionUriBuilder(version, 'php54');
const codecept56 = yield getCodeceptionUriBuilder(version, 'php56');
// Refer to https://codeception.com/builds
switch (true) { switch (true) {
case /latest/.test(version): case /latest/.test(version):
switch (true) { switch (true) {
case /^5\.6$|^7\.[0|1]$/.test(php_version): case /5\.6|7\.[0|1]/.test(php_version):
return 'php56/codecept.phar'; return 'php56/codecept.phar';
case /^7\.[2-4]$/.test(php_version): case /7\.[2-4]/.test(php_version):
default: default:
return 'codecept.phar'; return 'codecept.phar';
} }
case /([4-9]|\d{2,})\..*/.test(version): case /(^[4-9]|\d{2,})\..*/.test(version):
return yield getCodeceptionUriBuilder(version, php_version, 'php56'); switch (true) {
case /5\.6|7\.[0|1]/.test(php_version):
return codecept56;
case /7\.[2-4]/.test(php_version):
default: default:
return yield getCodeceptionUriBuilder(version, php_version, 'php54'); return codecept;
}
case /(^2\.[4-5]\.\d+|^3\.[0-1]\.\d+).*/.test(version):
switch (true) {
case /5\.6/.test(php_version):
return codecept54;
case /7\.[0-4]/.test(php_version):
default:
return codecept;
}
case /^2\.3\.\d+.*/.test(version):
switch (true) {
case /5\.[4-6]/.test(php_version):
return codecept54;
case /^7\.[0-4]$/.test(php_version):
default:
return codecept;
}
case /(^2\.(1\.([6-9]|\d{2,}))|^2\.2\.\d+).*/.test(version):
switch (true) {
case /5\.[4-5]/.test(php_version):
return codecept54;
case /5.6|7\.[0-4]/.test(php_version):
default:
return codecept;
}
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
return codecept;
default:
return yield codecept;
} }
}); });
} }
@ -1757,10 +1754,10 @@ function addPhive(version, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (version) { switch (version) {
case 'latest': case 'latest':
return ((yield getArchiveCommand(os_version)) + return ((yield getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive'); 'https://phar.io/releases/phive.phar phive');
default: default:
return ((yield getArchiveCommand(os_version)) + return ((yield getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' + 'https://github.com/phar-io/phive/releases/download/' +
version + version +
'/phive-' + '/phive-' +
@ -1771,22 +1768,21 @@ function addPhive(version, os_version) {
} }
exports.addPhive = addPhive; exports.addPhive = addPhive;
/** /**
* Function to get the PHPUnit url * Function to get the phar url in domain/tool-version.phar format
* *
* @param version * @param version
*/ */
function getPhpunitUrl(tool, version) { function getPharUrl(domain, tool, prefix, version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const phpunit = 'https://phar.phpunit.de';
switch (version) { switch (version) {
case 'latest': case 'latest':
return phpunit + '/' + tool + '.phar'; return domain + '/' + tool + '.phar';
default: default:
return phpunit + '/' + tool + '-' + version + '.phar'; return domain + '/' + tool + '-' + prefix + version + '.phar';
} }
}); });
} }
exports.getPhpunitUrl = getPhpunitUrl; exports.getPharUrl = getPharUrl;
/** /**
* Function to get the Deployer url * Function to get the Deployer url
* *
@ -1884,7 +1880,7 @@ exports.getCleanedToolsList = getCleanedToolsList;
*/ */
function addArchive(tool, version, url, os_version) { function addArchive(tool, version, url, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return (yield getArchiveCommand(os_version)) + url + ' ' + tool; return (yield getCommand(os_version, 'tool')) + url + ' ' + tool;
}); });
} }
exports.addArchive = addArchive; exports.addArchive = addArchive;
@ -1921,7 +1917,7 @@ exports.addDevTools = addDevTools;
*/ */
function addPackage(tool, release, prefix, os_version) { function addPackage(tool, release, prefix, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const tool_command = yield getPackageCommand(os_version); const tool_command = yield getCommand(os_version, 'composertool');
return tool_command + tool + ' ' + release + ' ' + prefix; return tool_command + tool + ' ' + release + ' ' + prefix;
}); });
} }
@ -1977,8 +1973,10 @@ function addTools(tools_csv, php_version, os_version) {
script += yield addArchive(tool, version, url, os_version); script += yield addArchive(tool, version, url, os_version);
break; break;
case 'composer': case 'composer':
url = // If RC is released as latest release, switch to getcomposer.
github + 'composer/composer/releases/latest/download/composer.phar'; // Prefered source is GitHub as it is faster.
// url = github + 'composer/composer/releases/latest/download/composer.phar';
url = 'https://getcomposer.org/composer-stable.phar';
script += yield addArchive(tool, version, url, os_version); script += yield addArchive(tool, version, url, os_version);
break; break;
case 'codeception': case 'codeception':
@ -1989,7 +1987,7 @@ function addTools(tools_csv, php_version, os_version) {
break; break;
case 'phpcpd': case 'phpcpd':
case 'phpunit': case 'phpunit':
url = yield getPhpunitUrl(tool, version); url = yield getPharUrl('https://phar.phpunit.de', tool, '', version);
script += yield addArchive(tool, version, url, os_version); script += yield addArchive(tool, version, url, os_version);
break; break;
case 'deployer': case 'deployer':
@ -2006,7 +2004,7 @@ function addTools(tools_csv, php_version, os_version) {
script += yield addPackage(tool, release, 'narrowspark/automatic-', os_version); script += yield addPackage(tool, release, 'narrowspark/automatic-', os_version);
break; break;
case 'pecl': case 'pecl':
script += yield getPECLCommand(os_version); script += yield getCommand(os_version, 'pecl');
break; break;
case 'php-config': case 'php-config':
case 'phpize': case 'phpize':

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

302
package-lock.json generated
View File

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

View File

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

View File

@ -20,22 +20,14 @@ add_log() {
remove_extension() { remove_extension() {
extension=$1 extension=$1
sudo sed -i '' "/$extension/d" "$ini_file" sudo sed -i '' "/$extension/d" "$ini_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1 sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
} }
# Function to setup extensions # Function to test if extension is loaded
add_extension() { check_extension() {
extension=$1 extension=$1
install_command=$2 php -m | grep -i -q -w "$extension"
prefix=$3
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q -w "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q -w "$extension"; then
(eval "$install_command" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
} }
# Fuction to get the PECL version # Fuction to get the PECL version
@ -51,43 +43,59 @@ get_pecl_version() {
echo "$pecl_version" echo "$pecl_version"
} }
# Function to install a PECL version
add_pecl_extension() {
extension=$1
pecl_version=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
fi
}
# Function to setup extensions
add_extension() {
extension=$1
install_command=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
(
eval "$install_command" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
}
# Function to pre-release extensions using PECL # Function to pre-release extensions using PECL
add_unstable_extension() { add_unstable_extension() {
extension=$1 extension=$1
stability=$2 stability=$2
prefix=$3 prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability") pecl_version=$(get_pecl_version "$extension" "$stability")
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then add_pecl_extension "$extension" "$pecl_version" "$prefix"
extension_version=$(php -d="$prefix=$extension" -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
elif php -m | grep -i -q -w "$extension"; then
extension_version=$(php -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
remove_extension "$extension"
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
else
add_extension "$extension" "sudo pecl install -f $extension-$pecl_version" "$prefix"
fi
} }
# Function to setup a remote tool # Function to setup a remote tool
add_tool() { add_tool() {
url=$1 url=$1
tool=$2 tool=$2
if [ "$tool" = "composer" ]; then tool_path="$tool_path_dir/$tool"
brew install composer >/dev/null 2>&1
composer -q global config process-timeout 0
add_log "$tick" "$tool" "Added"
else
tool_path=/usr/local/bin/"$tool"
if [ ! -e "$tool_path" ]; then if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path" rm -rf "$tool_path"
fi fi
@ -108,11 +116,10 @@ add_tool() {
else else
add_log "$cross" "$tool" "Could not setup $tool" add_log "$cross" "$tool" "Could not setup $tool"
fi fi
fi
} }
# Function to add a tool using composer # Function to add a tool using composer
add_composer_tool() { add_composertool() {
tool=$1 tool=$1
release=$2 release=$2
prefix=$3 prefix=$3
@ -149,6 +156,7 @@ setup_php_and_composer() {
tick="✓" tick="✓"
cross="✗" cross="✗"
version=$1 version=$1
tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version | cut -c 1-3) existing_version=$(php-config --version | cut -c 1-3)
# Setup PHP # Setup PHP
@ -163,9 +171,10 @@ else
status="Found" status="Found"
fi fi
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file" "$tool_path_dir"
echo "date.timezone=UTC" >>"$ini_file" echo "date.timezone=UTC" >>"$ini_file"
ext_dir=$(php -i | grep -Ei "extension_dir => /(usr|opt)" | sed -e "s|.*=> s*||") ext_dir=$(php -i | grep -Ei "extension_dir => /(usr|opt)" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo mkdir -p "$ext_dir" sudo mkdir -p "$ext_dir"
semver=$(php -v | head -n 1 | cut -f 2 -d ' ') semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
configure_pecl configure_pecl

View File

@ -48,31 +48,17 @@ get_pecl_version() {
echo "$pecl_version" echo "$pecl_version"
} }
# Function to setup extensions # Function to test if extension is loaded
add_extension() { check_extension() {
extension=$1 extension=$1
install_command=$2 php -m | grep -i -q -w "$extension"
prefix=$3
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then
# shellcheck disable=SC2046
$apt_install $(apt-cache depends php"$version"-"$extension" | awk '/Depends:/{print$2}') >/dev/null 2>&1
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif php -m | grep -i -q -w "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! php -m | grep -i -q -w "$extension"; then
(eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
(sudo pecl install -f "$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
sudo chmod 777 "$ini_file"
} }
# Function to delete extensions # Function to delete extensions
delete_extension() { delete_extension() {
extension=$1 extension=$1
sudo sed -i "/$extension/d" "$ini_file" sudo sed -i "/$extension/d" "$ini_file"
sudo rm -rf /etc/php/"$version"/cli/conf.d/*"$extension"* >/dev/null 2>&1 sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1 sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
} }
@ -85,13 +71,44 @@ remove_extension() {
delete_extension "$extension" delete_extension "$extension"
} }
# Function to setup extensions
add_extension() {
extension=$1
install_command=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
echo "$prefix=$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then
eval "$install_command" >/dev/null 2>&1 ||
(update_ppa && eval "$install_command" >/dev/null 2>&1) ||
sudo pecl install -f "$extension" >/dev/null 2>&1
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi
sudo chmod 777 "$ini_file"
}
# Function to install a PECL version # Function to install a PECL version
add_pecl_extension() { add_pecl_extension() {
extension=$1 extension=$1
pecl_version=$2 pecl_version=$2
(sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 && prefix=$3
add_log "$tick" "$extension" "Installed and enabled") || if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver" echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
fi
ext_version=$(php -r "echo phpversion('$extension');")
if [ "$ext_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
(
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
check_extension "$extension" &&
add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
fi
} }
# Function to pre-release extensions using PECL # Function to pre-release extensions using PECL
@ -100,25 +117,7 @@ add_unstable_extension() {
stability=$2 stability=$2
prefix=$3 prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability") pecl_version=$(get_pecl_version "$extension" "$stability")
if ! php -m | grep -i -q -w "$extension" && [ -e "$ext_dir/$extension.so" ]; then add_pecl_extension "$extension" "$pecl_version" "$prefix"
extension_version=$(php -d="$prefix=$extension" -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
add_pecl_extension "$extension" "$pecl_version"
fi
elif php -m | grep -i -q -w "$extension"; then
extension_version=$(php -r "echo phpversion('$extension');")
if [ "$extension_version" = "$pecl_version" ]; then
add_log "$tick" "$extension" "Enabled"
else
delete_extension "$extension"
add_pecl_extension "$extension" "$pecl_version"
fi
else
add_pecl_extension "$extension" "$pecl_version"
fi
} }
# Function to update extension # Function to update extension
@ -140,7 +139,7 @@ update_extension() {
add_tool() { add_tool() {
url=$1 url=$1
tool=$2 tool=$2
tool_path=/usr/local/bin/"$tool" tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path" rm -rf "$tool_path"
fi fi
@ -152,9 +151,9 @@ add_tool() {
elif [ "$tool" = "cs2pr" ]; then elif [ "$tool" = "cs2pr" ]; then
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
elif [ "$tool" = "phive" ]; then elif [ "$tool" = "phive" ]; then
add_extension curl >/dev/null 2>&1 add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
add_extension mbstring >/dev/null 2>&1 add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
add_extension xml >/dev/null 2>&1 add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
fi fi
add_log "$tick" "$tool" "Added" add_log "$tick" "$tool" "Added"
else else
@ -163,7 +162,7 @@ add_tool() {
} }
# Function to setup a tool using composer # Function to setup a tool using composer
add_composer_tool() { add_composertool() {
tool=$1 tool=$1
release=$2 release=$2
prefix=$3 prefix=$3
@ -189,8 +188,8 @@ setup_master() {
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
install_dir=~/php/"$version" install_dir=~/php/"$version"
sudo mkdir -m 777 -p ~/php sudo mkdir -m 777 -p ~/php
$apt_install libicu-dev >/dev/null 2>&1 update_ppa && $apt_install libicu64 libicu-dev >/dev/null 2>&1
curl -o "$tar_file" -L https://bintray.com/shivammathur/php/download_file?file_path="$tar_file" >/dev/null 2>&1 curl -SLO https://dl.bintray.com/shivammathur/php/"$tar_file" >/dev/null 2>&1
sudo tar xf "$tar_file" -C ~/php >/dev/null 2>&1 sudo tar xf "$tar_file" -C ~/php >/dev/null 2>&1
rm -rf "$tar_file" rm -rf "$tar_file"
sudo ln -sf -S "$version" "$install_dir"/bin/* /usr/bin/ sudo ln -sf -S "$version" "$install_dir"/bin/* /usr/bin/
@ -216,13 +215,24 @@ switch_version() {
done done
} }
# Function to get PHP version in semver format
php_semver() {
if [ ! "$version" = "8.0" ]; then
php"$version" -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-'
else
php -v | head -n 1 | cut -f 2 -d ' '
fi
}
# Variables # Variables
tick="✓" tick="✓"
cross="✗" cross="✗"
ppa_updated="false" ppa_updated="false"
pecl_config="false" pecl_config="false"
version=$1 version=$1
apt_install="sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y" debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y"
tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version | cut -c 1-3) existing_version=$(php-config --version | cut -c 1-3)
# Setup PHP # Setup PHP
@ -232,36 +242,25 @@ sudo mkdir -p /run/php
if [ "$existing_version" != "$version" ]; then if [ "$existing_version" != "$version" ]; then
if [ ! -e "/usr/bin/php$version" ]; then if [ ! -e "/usr/bin/php$version" ]; then
update_ppa
if [ "$version" = "8.0" ]; then if [ "$version" = "8.0" ]; then
setup_master setup_master
else else
update_ppa
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1 $apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
fi fi
status="installed" status="Installed"
else else
status="switched" status="Switched to"
fi fi
switch_version switch_version
if [ "$version" = "8.0" ]; then
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
else else
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-') status="Found"
fi
if [ "$status" != "switched" ]; then
status="Installed PHP $semver"
else
status="Switched to PHP $semver"
fi
else
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
status="PHP $semver Found"
fi fi
semver=$(php_semver)
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") 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*||") ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file" scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
add_log "$tick" "PHP" "$status" sudo chmod 777 "$ini_file" "$tool_path_dir"
add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -124,7 +124,7 @@ Function Add-Tool() {
} }
} }
Function Add-Composer-Tool() { Function Add-Composertool() {
Param ( Param (
[Parameter(Position = 0, Mandatory = $true)] [Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
@ -152,7 +152,7 @@ Function Add-Composer-Tool() {
} }
} }
Function Add-PECL() { Function Add-Pecl() {
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows" Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
} }
@ -194,11 +194,8 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1 Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
} else { } else {
$updated = Update-Php $php_dir >$null 2>&1
if($updated -eq $False) {
$status = "Found" $status = "Found"
} }
}
$installed = Get-Php -Path $php_dir $installed = Get-Php -Path $php_dir
Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir

View File

@ -1,60 +1,20 @@
import * as utils from './utils'; import * as utils from './utils';
/** /**
* Function to get command to setup tool * Function to get command to setup tools
* *
* @param os_version * @param os_version
*/ */
export async function getArchiveCommand(os_version: string): Promise<string> { export async function getCommand(
os_version: string,
suffix: string
): Promise<string> {
switch (os_version) { switch (os_version) {
case 'linux': case 'linux':
case 'darwin': case 'darwin':
return 'add_tool '; return 'add_' + suffix + ' ';
case 'win32': case 'win32':
return 'Add-Tool '; 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 command to setup tools using composer
*
* @param os_version
*/
export async function getPackageCommand(os_version: string): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_composer_tool ';
case 'win32':
return 'Add-Composer-Tool ';
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
}
/**
*
* Function to get command to setup PECL
*
* @param os_version
*/
export async function getPECLCommand(os_version: string): Promise<string> {
switch (os_version) {
case 'linux':
case 'darwin':
return 'add_pecl ';
case 'win32':
return 'Add-PECL ';
default: default:
return await utils.log( return await utils.log(
'Platform ' + os_version + ' is not supported', 'Platform ' + os_version + ' is not supported',
@ -138,23 +98,15 @@ export async function getUri(
* Helper function to get the codeception url * Helper function to get the codeception url
* *
* @param version * @param version
* @param php_version
* @param suffix * @param suffix
*/ */
export async function getCodeceptionUriBuilder( export async function getCodeceptionUriBuilder(
version: string, version: string,
php_version: string,
suffix: string suffix: string
): Promise<string> { ): Promise<string> {
switch (true) {
case /^5\.6$|^7\.[0|1]$/.test(php_version):
return ['releases', version, suffix, 'codecept.phar'] return ['releases', version, suffix, 'codecept.phar']
.filter(Boolean) .filter(Boolean)
.join('/'); .join('/');
case /^7\.[2-4]$/.test(php_version):
default:
return ['releases', version, 'codecept.phar'].filter(Boolean).join('/');
}
} }
/** /**
@ -167,19 +119,55 @@ export async function getCodeceptionUri(
version: string, version: string,
php_version: string php_version: string
): Promise<string> { ): Promise<string> {
const codecept: string = await getCodeceptionUriBuilder(version, '');
const codecept54: string = await getCodeceptionUriBuilder(version, 'php54');
const codecept56: string = await getCodeceptionUriBuilder(version, 'php56');
// Refer to https://codeception.com/builds
switch (true) { switch (true) {
case /latest/.test(version): case /latest/.test(version):
switch (true) { switch (true) {
case /^5\.6$|^7\.[0|1]$/.test(php_version): case /5\.6|7\.[0|1]/.test(php_version):
return 'php56/codecept.phar'; return 'php56/codecept.phar';
case /^7\.[2-4]$/.test(php_version): case /7\.[2-4]/.test(php_version):
default: default:
return 'codecept.phar'; return 'codecept.phar';
} }
case /([4-9]|\d{2,})\..*/.test(version): case /(^[4-9]|\d{2,})\..*/.test(version):
return await getCodeceptionUriBuilder(version, php_version, 'php56'); switch (true) {
case /5\.6|7\.[0|1]/.test(php_version):
return codecept56;
case /7\.[2-4]/.test(php_version):
default: default:
return await getCodeceptionUriBuilder(version, php_version, 'php54'); return codecept;
}
case /(^2\.[4-5]\.\d+|^3\.[0-1]\.\d+).*/.test(version):
switch (true) {
case /5\.6/.test(php_version):
return codecept54;
case /7\.[0-4]/.test(php_version):
default:
return codecept;
}
case /^2\.3\.\d+.*/.test(version):
switch (true) {
case /5\.[4-6]/.test(php_version):
return codecept54;
case /^7\.[0-4]$/.test(php_version):
default:
return codecept;
}
case /(^2\.(1\.([6-9]|\d{2,}))|^2\.2\.\d+).*/.test(version):
switch (true) {
case /5\.[4-5]/.test(php_version):
return codecept54;
case /5.6|7\.[0-4]/.test(php_version):
default:
return codecept;
}
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
return codecept;
default:
return await codecept;
} }
} }
@ -198,12 +186,12 @@ export async function addPhive(
switch (version) { switch (version) {
case 'latest': case 'latest':
return ( return (
(await getArchiveCommand(os_version)) + (await getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive' 'https://phar.io/releases/phive.phar phive'
); );
default: default:
return ( return (
(await getArchiveCommand(os_version)) + (await getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' + 'https://github.com/phar-io/phive/releases/download/' +
version + version +
'/phive-' + '/phive-' +
@ -214,20 +202,21 @@ export async function addPhive(
} }
/** /**
* Function to get the PHPUnit url * Function to get the phar url in domain/tool-version.phar format
* *
* @param version * @param version
*/ */
export async function getPhpunitUrl( export async function getPharUrl(
domain: string,
tool: string, tool: string,
prefix: string,
version: string version: string
): Promise<string> { ): Promise<string> {
const phpunit = 'https://phar.phpunit.de';
switch (version) { switch (version) {
case 'latest': case 'latest':
return phpunit + '/' + tool + '.phar'; return domain + '/' + tool + '.phar';
default: default:
return phpunit + '/' + tool + '-' + version + '.phar'; return domain + '/' + tool + '-' + prefix + version + '.phar';
} }
} }
@ -333,7 +322,7 @@ export async function addArchive(
url: string, url: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
return (await getArchiveCommand(os_version)) + url + ' ' + tool; return (await getCommand(os_version, 'tool')) + url + ' ' + tool;
} }
/** /**
@ -385,7 +374,7 @@ export async function addPackage(
prefix: string, prefix: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
const tool_command = await getPackageCommand(os_version); const tool_command = await getCommand(os_version, 'composertool');
return tool_command + tool + ' ' + release + ' ' + prefix; return tool_command + tool + ' ' + release + ' ' + prefix;
} }
@ -449,8 +438,10 @@ export async function addTools(
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'composer': case 'composer':
url = // If RC is released as latest release, switch to getcomposer.
github + 'composer/composer/releases/latest/download/composer.phar'; // Prefered source is GitHub as it is faster.
// url = github + 'composer/composer/releases/latest/download/composer.phar';
url = 'https://getcomposer.org/composer-stable.phar';
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'codeception': case 'codeception':
@ -461,7 +452,7 @@ export async function addTools(
break; break;
case 'phpcpd': case 'phpcpd':
case 'phpunit': case 'phpunit':
url = await getPhpunitUrl(tool, version); url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'deployer': case 'deployer':
@ -483,7 +474,7 @@ export async function addTools(
); );
break; break;
case 'pecl': case 'pecl':
script += await getPECLCommand(os_version); script += await getCommand(os_version, 'pecl');
break; break;
case 'php-config': case 'php-config':
case 'phpize': case 'phpize':