mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve extension support
Add support for xdebug2 coverage
This commit is contained in:
parent
847ea65468
commit
87a933f720
@ -1,15 +1,9 @@
|
|||||||
import * as coverage from '../src/coverage';
|
import * as coverage from '../src/coverage';
|
||||||
|
|
||||||
jest.mock('../src/extensions', () => ({
|
|
||||||
addExtension: jest.fn().mockImplementation(extension => {
|
|
||||||
return 'add_extension ' + extension + '\n';
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it('checking addCoverage with PCOV on windows', async () => {
|
it('checking addCoverage with PCOV on windows', async () => {
|
||||||
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
||||||
expect(win32).toContain('add_extension pcov');
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
expect(win32).toContain('Remove-Extension xdebug');
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
|
||||||
win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
|
win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
|
||||||
@ -27,24 +21,38 @@ describe('Config tests', () => {
|
|||||||
|
|
||||||
it('checking addCoverage with PCOV on darwin', async () => {
|
it('checking addCoverage with PCOV on darwin', async () => {
|
||||||
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
|
const darwin: string = await coverage.addCoverage('pcov', '7.4', 'darwin');
|
||||||
expect(darwin).toContain('add_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
expect(darwin).toContain('remove_extension xdebug');
|
expect(darwin).toContain('remove_extension xdebug');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on windows', async () => {
|
it('checking addCoverage with Xdebug on windows', async () => {
|
||||||
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
|
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
|
||||||
expect(win32).toContain('add_extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on linux', async () => {
|
it('checking addCoverage with Xdebug3 on windows', async () => {
|
||||||
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
|
const win32: string = await coverage.addCoverage('xdebug3', '7.4', 'win32');
|
||||||
expect(linux).toContain('add_extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on windows', async () => {
|
||||||
|
const win32: string = await coverage.addCoverage('xdebug2', '7.4', 'win32');
|
||||||
|
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on linux', async () => {
|
it('checking addCoverage with Xdebug on linux', async () => {
|
||||||
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
|
||||||
expect(linux).toContain('add_extension xdebug');
|
expect(linux).toContain('add_extension xdebug');
|
||||||
expect(linux).toContain('echo "xdebug.mode=coverage"');
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
|
||||||
|
expect(linux).toContain('add_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on linux', async () => {
|
||||||
|
const linux: string = await coverage.addCoverage('xdebug2', '7.4', 'linux');
|
||||||
|
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addCoverage with Xdebug on darwin', async () => {
|
it('checking addCoverage with Xdebug on darwin', async () => {
|
||||||
@ -53,7 +61,25 @@ describe('Config tests', () => {
|
|||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug3 on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug3',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('checking addCoverage with Xdebug2 on darwin', async () => {
|
||||||
|
const darwin: string = await coverage.addCoverage(
|
||||||
|
'xdebug2',
|
||||||
|
'7.4',
|
||||||
|
'darwin'
|
||||||
|
);
|
||||||
|
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking disableCoverage windows', async () => {
|
it('checking disableCoverage windows', async () => {
|
||||||
|
@ -13,7 +13,7 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||||
expect(win32).toContain('Add-Extension ast beta');
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'win32');
|
win32 = await extensions.addExtension('xdebug2', '7.2', 'win32');
|
||||||
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
expect(win32).toContain('Add-Extension xdebug stable 2.9.8');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
@ -71,7 +71,7 @@ describe('Extension tests', () => {
|
|||||||
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.4');
|
expect(linux).toContain('gearman.sh 7.4');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'linux');
|
linux = await extensions.addExtension('xdebug2', '7.2', 'linux');
|
||||||
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
expect(linux).toContain('add_pecl_extension xdebug 2.9.8 zend_extension');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
linux = await extensions.addExtension('xdebug', '7.2', 'openbsd');
|
||||||
@ -119,12 +119,6 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug');
|
expect(darwin).toContain('add_brew_extension xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
|
||||||
expect(darwin).toContain('pecl_install redis-2.2.8');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
|
||||||
expect(darwin).toContain('pecl_install redis');
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
'7.2',
|
'7.2',
|
||||||
|
47
dist/index.js
vendored
47
dist/index.js
vendored
@ -1256,14 +1256,11 @@ exports.CSVArray = CSVArray;
|
|||||||
* @param extension
|
* @param extension
|
||||||
*/
|
*/
|
||||||
async function getExtensionPrefix(extension) {
|
async function getExtensionPrefix(extension) {
|
||||||
const zend = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
switch (true) {
|
||||||
switch (zend.indexOf(extension)) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
return 'zend_extension';
|
|
||||||
case -1:
|
|
||||||
default:
|
default:
|
||||||
return 'extension';
|
return 'extension';
|
||||||
|
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
||||||
|
return 'zend_extension';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getExtensionPrefix = getExtensionPrefix;
|
exports.getExtensionPrefix = getExtensionPrefix;
|
||||||
@ -2141,18 +2138,11 @@ exports.addCoverage = exports.disableCoverage = exports.addCoveragePCOV = export
|
|||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
const extensions = __importStar(__webpack_require__(911));
|
const extensions = __importStar(__webpack_require__(911));
|
||||||
const config = __importStar(__webpack_require__(641));
|
const config = __importStar(__webpack_require__(641));
|
||||||
/**
|
async function addCoverageXdebug(extension, version, os_version, pipe) {
|
||||||
* Function to setup Xdebug
|
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
|
||||||
*
|
pipe;
|
||||||
* @param version
|
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
|
||||||
* @param os_version
|
return xdebug + '\n' + log;
|
||||||
* @param pipe
|
|
||||||
*/
|
|
||||||
async function addCoverageXdebug(version, os_version, pipe) {
|
|
||||||
const xdebug = (await extensions.addExtension('xdebug', version, os_version, true)) + pipe;
|
|
||||||
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
|
|
||||||
const log = await utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version);
|
|
||||||
return xdebug + '\n' + ini + '\n' + log;
|
|
||||||
}
|
}
|
||||||
exports.addCoverageXdebug = addCoverageXdebug;
|
exports.addCoverageXdebug = addCoverageXdebug;
|
||||||
/**
|
/**
|
||||||
@ -2233,7 +2223,10 @@ async function addCoverage(coverage_driver, version, os_version) {
|
|||||||
case 'pcov':
|
case 'pcov':
|
||||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||||
case 'xdebug':
|
case 'xdebug':
|
||||||
return script + (await addCoverageXdebug(version, os_version, pipe));
|
case 'xdebug3':
|
||||||
|
return (script + (await addCoverageXdebug('xdebug', version, os_version, pipe)));
|
||||||
|
case 'xdebug2':
|
||||||
|
return (script + (await addCoverageXdebug('xdebug2', version, os_version, pipe)));
|
||||||
case 'none':
|
case 'none':
|
||||||
return script + (await disableCoverage(version, os_version, pipe));
|
return script + (await disableCoverage(version, os_version, pipe));
|
||||||
default:
|
default:
|
||||||
@ -2284,7 +2277,7 @@ async function addINIValuesUnix(ini_values_csv) {
|
|||||||
script +=
|
script +=
|
||||||
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
||||||
});
|
});
|
||||||
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
return ('echo "' + ini_values.join('\n') + '" >> ${pecl_file:-$ini_file}' + script);
|
||||||
}
|
}
|
||||||
exports.addINIValuesUnix = addINIValuesUnix;
|
exports.addINIValuesUnix = addINIValuesUnix;
|
||||||
/**
|
/**
|
||||||
@ -2721,18 +2714,12 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||||
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension):
|
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + extension_name;
|
command = 'add_brew_extension ' + extension_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
|
||||||
case /5\.6redis/.test(version_extension):
|
|
||||||
command = command_prefix + 'redis-2.2.8';
|
|
||||||
break;
|
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
@ -2786,7 +2773,7 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match 7.2xdebug
|
// match 7.2xdebug
|
||||||
case /7\.2xdebug/.test(version_extension):
|
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||||
script += '\nAdd-Extension xdebug stable 2.9.8';
|
script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||||
break;
|
break;
|
||||||
// match 7.0mysql..8.0mysql
|
// match 7.0mysql..8.0mysql
|
||||||
@ -2866,7 +2853,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
version;
|
version;
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug
|
// match 7.2xdebug
|
||||||
case /^7\.2xdebug$/.test(version_extension):
|
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||||
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
|
@ -14,7 +14,9 @@ export async function addINIValuesUnix(
|
|||||||
script +=
|
script +=
|
||||||
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
(await utils.addLog('$tick', line, 'Added to php.ini', 'linux')) + '\n';
|
||||||
});
|
});
|
||||||
return 'echo "' + ini_values.join('\n') + '" >> $ini_file' + script;
|
return (
|
||||||
|
'echo "' + ini_values.join('\n') + '" >> ${pecl_file:-$ini_file}' + script
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,32 +2,22 @@ import * as utils from './utils';
|
|||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as config from './config';
|
import * as config from './config';
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to setup Xdebug
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param os_version
|
|
||||||
* @param pipe
|
|
||||||
*/
|
|
||||||
export async function addCoverageXdebug(
|
export async function addCoverageXdebug(
|
||||||
|
extension: string,
|
||||||
version: string,
|
version: string,
|
||||||
os_version: string,
|
os_version: string,
|
||||||
pipe: string
|
pipe: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const xdebug =
|
const xdebug =
|
||||||
(await extensions.addExtension('xdebug', version, os_version, true)) + pipe;
|
(await extensions.addExtension(extension, version, os_version, true)) +
|
||||||
const ini = await config.addINIValues(
|
pipe;
|
||||||
'xdebug.mode=coverage',
|
|
||||||
os_version,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
const log = await utils.addLog(
|
const log = await utils.addLog(
|
||||||
'$tick',
|
'$tick',
|
||||||
'xdebug',
|
extension,
|
||||||
'Xdebug enabled as coverage driver',
|
'Xdebug enabled as coverage driver',
|
||||||
os_version
|
os_version
|
||||||
);
|
);
|
||||||
return xdebug + '\n' + ini + '\n' + log;
|
return xdebug + '\n' + log;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +130,14 @@ export async function addCoverage(
|
|||||||
case 'pcov':
|
case 'pcov':
|
||||||
return script + (await addCoveragePCOV(version, os_version, pipe));
|
return script + (await addCoveragePCOV(version, os_version, pipe));
|
||||||
case 'xdebug':
|
case 'xdebug':
|
||||||
return script + (await addCoverageXdebug(version, os_version, pipe));
|
case 'xdebug3':
|
||||||
|
return (
|
||||||
|
script + (await addCoverageXdebug('xdebug', version, os_version, pipe))
|
||||||
|
);
|
||||||
|
case 'xdebug2':
|
||||||
|
return (
|
||||||
|
script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
|
||||||
|
);
|
||||||
case 'none':
|
case 'none':
|
||||||
return script + (await disableCoverage(version, os_version, pipe));
|
return script + (await disableCoverage(version, os_version, pipe));
|
||||||
default:
|
default:
|
||||||
|
@ -30,20 +30,14 @@ export async function addExtensionDarwin(
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||||
// match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole
|
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
||||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(
|
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||||
command = 'add_brew_extension ' + extension_name;
|
command = 'add_brew_extension ' + extension_name;
|
||||||
break;
|
break;
|
||||||
// match 5.6redis
|
|
||||||
case /5\.6redis/.test(version_extension):
|
|
||||||
command = command_prefix + 'redis-2.2.8';
|
|
||||||
break;
|
|
||||||
// match sqlite
|
// match sqlite
|
||||||
case /^sqlite$/.test(extension):
|
case /^sqlite$/.test(extension):
|
||||||
extension = 'sqlite3';
|
extension = 'sqlite3';
|
||||||
@ -100,7 +94,7 @@ export async function addExtensionWindows(
|
|||||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match 7.2xdebug
|
// match 7.2xdebug
|
||||||
case /7\.2xdebug/.test(version_extension):
|
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||||
script += '\nAdd-Extension xdebug stable 2.9.8';
|
script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||||
break;
|
break;
|
||||||
// match 7.0mysql..8.0mysql
|
// match 7.0mysql..8.0mysql
|
||||||
@ -184,7 +178,7 @@ export async function addExtensionLinux(
|
|||||||
version;
|
version;
|
||||||
return;
|
return;
|
||||||
// match 7.2xdebug
|
// match 7.2xdebug
|
||||||
case /^7\.2xdebug$/.test(version_extension):
|
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||||
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
||||||
return;
|
return;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
|
@ -148,7 +148,7 @@ add_tool() {
|
|||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" != "200" ] && [[ "$url" =~ .*github.com.*releases.*latest.* ]]; then
|
if [ "$status_code" != "200" ] && [[ "$url" =~ .*github.com.*releases.*latest.* ]]; then
|
||||||
url=$(echo $url | sed -e "s|releases/latest/download|releases/download/$(curl "${curl_opts[@]}" "$(echo "$url" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "$url" | sed -e "s/.*\///")" | cut -d '/' -f 1)|")
|
url="${url//releases\/latest\/download/releases/download/$(curl "${curl_opts[@]}" "$(echo "$url" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "$url" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
||||||
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
status_code=$(sudo curl -w "%{http_code}" -o "$tool_path" "${curl_opts[@]}" "$url")
|
||||||
fi
|
fi
|
||||||
if [ "$status_code" = "200" ]; then
|
if [ "$status_code" = "200" ]; then
|
||||||
@ -221,6 +221,15 @@ setup_php() {
|
|||||||
brew link --force --overwrite php@"$version"
|
brew link --force --overwrite php@"$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to configure PHP
|
||||||
|
configure_php() {
|
||||||
|
(
|
||||||
|
echo -e "date.timezone=UTC\nmemory_limit=-1"
|
||||||
|
[[ "$version" =~ 8.0 ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235"
|
||||||
|
[[ "$version" =~ 7.[2-4]|8.0 ]] && echo -e "xdebug.mode=coverage"
|
||||||
|
) | sudo tee -a "$ini_file" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
tick="✓"
|
tick="✓"
|
||||||
cross="✗"
|
cross="✗"
|
||||||
@ -241,7 +250,7 @@ else
|
|||||||
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" "$tool_path_dir"
|
sudo chmod 777 "$ini_file" "$tool_path_dir"
|
||||||
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
|
configure_php
|
||||||
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||||
|
@ -103,12 +103,8 @@ add_extension() {
|
|||||||
elif check_extension "$extension"; then
|
elif check_extension "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
if [ "$version" = "8.0" ]; then
|
|
||||||
pecl_install "$extension"
|
|
||||||
else
|
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
eval "$install_command" >/dev/null 2>&1 ||
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
||||||
fi
|
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
@ -258,6 +254,15 @@ php_semver() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to configure PHP
|
||||||
|
configure_php() {
|
||||||
|
(
|
||||||
|
echo -e "date.timezone=UTC\nmemory_limit=-1"
|
||||||
|
[[ "$version" =~ 8.0 ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235"
|
||||||
|
[[ "$version" =~ 7.[2-4]|8.0 ]] && echo -e "xdebug.mode=coverage"
|
||||||
|
) | sudo tee -a "$pecl_file" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
tick="✓"
|
tick="✓"
|
||||||
cross="✗"
|
cross="✗"
|
||||||
@ -308,6 +313,7 @@ ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s
|
|||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
pecl_file="$scan_dir"/99-pecl.ini
|
pecl_file="$scan_dir"/99-pecl.ini
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
||||||
|
configure_php
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
||||||
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
|
@ -300,8 +300,11 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
}
|
}
|
||||||
|
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
|
('date.timezone=UTC', 'memory_limit=-1', 'xdebug.mode=coverage') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
||||||
Set-PhpIniKey -Key 'memory_limit' -Value '-1' -Path $php_dir
|
# Patch till there is a pcov DLL for PHP 8.0 on pecl
|
||||||
|
if ($version -eq '8.0') {
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$version`_$env:PHPTS`_$arch`_pcov.dll" -OutFile $php_dir"\ext\php`_pcov.dll"
|
||||||
|
}
|
||||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||||
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
|
@ -243,14 +243,11 @@ export async function CSVArray(values_csv: string): Promise<Array<string>> {
|
|||||||
* @param extension
|
* @param extension
|
||||||
*/
|
*/
|
||||||
export async function getExtensionPrefix(extension: string): Promise<string> {
|
export async function getExtensionPrefix(extension: string): Promise<string> {
|
||||||
const zend: Array<string> = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
switch (true) {
|
||||||
switch (zend.indexOf(extension)) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
return 'zend_extension';
|
|
||||||
case -1:
|
|
||||||
default:
|
default:
|
||||||
return 'extension';
|
return 'extension';
|
||||||
|
case /xdebug([2-3])?$|opcache|ioncube|eaccelerator/.test(extension):
|
||||||
|
return 'zend_extension';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user