mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Fail fast PCOV on unsupported PHP versions
This commit is contained in:
parent
3aa0f17b55
commit
e0561697dc
@ -9,6 +9,12 @@ describe('Extension tests', () => {
|
|||||||
expect(await extensions.getXdebugVersion('7.0')).toContain('2.7.2');
|
expect(await extensions.getXdebugVersion('7.0')).toContain('2.7.2');
|
||||||
expect(await extensions.getXdebugVersion('7.2')).toContain('2.9.6');
|
expect(await extensions.getXdebugVersion('7.2')).toContain('2.9.6');
|
||||||
});
|
});
|
||||||
|
it('checking getUnsupportedLog', async () => {
|
||||||
|
expect(await extensions.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
||||||
|
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
|
||||||
@ -27,6 +33,11 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
|
||||||
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
|
||||||
|
expect(win32).toContain(
|
||||||
|
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
|
||||||
expect(win32).toContain('Add-Extension mysqli');
|
expect(win32).toContain('Add-Extension mysqli');
|
||||||
expect(win32).toContain('Add-Extension mysqlnd');
|
expect(win32).toContain('Add-Extension mysqlnd');
|
||||||
@ -88,6 +99,11 @@ describe('Extension tests', () => {
|
|||||||
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
|
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
linux = await extensions.addExtension('pcov', '5.6', 'linux');
|
||||||
|
expect(linux).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('gearman.sh 7.0');
|
||||||
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
||||||
@ -153,7 +169,9 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
expect(darwin).toContain('oci.sh pdo_oci 7.3');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install -f pcov');
|
expect(darwin).toContain(
|
||||||
|
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
|
||||||
|
);
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('add_brew_extension pcov');
|
expect(darwin).toContain('add_brew_extension pcov');
|
||||||
|
20
dist/index.js
vendored
20
dist/index.js
vendored
@ -3568,7 +3568,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.getXdebugVersion = void 0;
|
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.getUnsupportedLog = exports.getXdebugVersion = void 0;
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
/**
|
/**
|
||||||
@ -3592,6 +3592,12 @@ async function getXdebugVersion(version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getXdebugVersion = getXdebugVersion;
|
exports.getXdebugVersion = getXdebugVersion;
|
||||||
|
async function getUnsupportedLog(extension, version, os_version) {
|
||||||
|
return ('\n' +
|
||||||
|
(await utils.addLog('$cross', extension, extension + ' is not supported on PHP ' + version, os_version)) +
|
||||||
|
'\n');
|
||||||
|
}
|
||||||
|
exports.getUnsupportedLog = getUnsupportedLog;
|
||||||
/**
|
/**
|
||||||
* Install and enable extensions for darwin
|
* Install and enable extensions for darwin
|
||||||
*
|
*
|
||||||
@ -3650,6 +3656,10 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
command =
|
command =
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
||||||
break;
|
break;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'darwin');
|
||||||
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
@ -3759,6 +3769,10 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
add_script +=
|
add_script +=
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'win32');
|
||||||
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3mysql..5.6mysql
|
||||||
// match 5.3mysqli..5.6mysqli
|
// match 5.3mysqli..5.6mysqli
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
// match 5.3mysqlnd..5.6mysqlnd
|
||||||
@ -3869,6 +3883,10 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'linux');
|
||||||
|
return;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
command =
|
command =
|
||||||
|
@ -22,6 +22,23 @@ export async function getXdebugVersion(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getUnsupportedLog(
|
||||||
|
extension: string,
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
return (
|
||||||
|
'\n' +
|
||||||
|
(await utils.addLog(
|
||||||
|
'$cross',
|
||||||
|
extension,
|
||||||
|
extension + ' is not supported on PHP ' + version,
|
||||||
|
os_version
|
||||||
|
)) +
|
||||||
|
'\n'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install and enable extensions for darwin
|
* Install and enable extensions for darwin
|
||||||
*
|
*
|
||||||
@ -86,6 +103,10 @@ export async function addExtensionDarwin(
|
|||||||
command =
|
command =
|
||||||
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
|
||||||
break;
|
break;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'darwin');
|
||||||
|
return;
|
||||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
@ -204,6 +225,10 @@ export async function addExtensionWindows(
|
|||||||
add_script +=
|
add_script +=
|
||||||
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
|
||||||
return;
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'win32');
|
||||||
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3mysql..5.6mysql
|
||||||
// match 5.3mysqli..5.6mysqli
|
// match 5.3mysqli..5.6mysqli
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
// match 5.3mysqlnd..5.6mysqlnd
|
||||||
@ -320,6 +345,10 @@ export async function addExtensionLinux(
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
|
// match 5.3pcov to 7.0pcov
|
||||||
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
|
add_script += await getUnsupportedLog('pcov', version, 'linux');
|
||||||
|
return;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
command =
|
command =
|
||||||
|
Loading…
Reference in New Issue
Block a user