mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add blackfire support on windows
This commit is contained in:
parent
943f491830
commit
3dfd7a648b
@ -27,10 +27,10 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||||
expect(win32).toContain('blackfire.ps1 7.3 73');
|
expect(win32).toContain('blackfire.ps1 73');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||||
expect(win32).toContain('blackfire.ps1 7.3 73 1.31.0');
|
expect(win32).toContain('blackfire.ps1 73 1.31.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
|
28
dist/index.js
vendored
28
dist/index.js
vendored
@ -2692,6 +2692,18 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
const prefix = yield utils.getExtensionPrefix(ext_name);
|
const prefix = yield utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
|
script +=
|
||||||
|
'\nsh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||||
|
' ' +
|
||||||
|
version +
|
||||||
|
' ' +
|
||||||
|
(yield utils.getMinorVersion(version)).replace('.', '');
|
||||||
|
if (ext_version) {
|
||||||
|
script += ' ' + ext_version;
|
||||||
|
}
|
||||||
|
return;
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
@ -2733,18 +2745,6 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
' ' +
|
' ' +
|
||||||
version;
|
version;
|
||||||
return;
|
return;
|
||||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
|
||||||
script +=
|
|
||||||
'\nsh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
' ' +
|
|
||||||
(yield utils.getMinorVersion(version)).replace('.', '');
|
|
||||||
if (ext_version) {
|
|
||||||
script += ' ' + ext_version;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install -f ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
@ -2783,11 +2783,9 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
|||||||
// match blackfire...blackfire-1.31.0
|
// match blackfire...blackfire-1.31.0
|
||||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
script +=
|
script +=
|
||||||
'\nsh ' +
|
'\n& ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
|
||||||
' ' +
|
|
||||||
(yield utils.getMinorVersion(version)).replace('.', '');
|
(yield utils.getMinorVersion(version)).replace('.', '');
|
||||||
if (ext_version) {
|
if (ext_version) {
|
||||||
script += ' ' + ext_version;
|
script += ' ' + ext_version;
|
||||||
|
@ -22,6 +22,19 @@ export async function addExtensionDarwin(
|
|||||||
const prefix = await utils.getExtensionPrefix(ext_name);
|
const prefix = await utils.getExtensionPrefix(ext_name);
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
|
script +=
|
||||||
|
'\nsh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
||||||
|
' ' +
|
||||||
|
version +
|
||||||
|
' ' +
|
||||||
|
(await utils.getMinorVersion(version)).replace('.', '');
|
||||||
|
|
||||||
|
if (ext_version) {
|
||||||
|
script += ' ' + ext_version;
|
||||||
|
}
|
||||||
|
return;
|
||||||
// match pre-release versions
|
// match pre-release versions
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
@ -63,19 +76,6 @@ export async function addExtensionDarwin(
|
|||||||
' ' +
|
' ' +
|
||||||
version;
|
version;
|
||||||
return;
|
return;
|
||||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
|
||||||
script +=
|
|
||||||
'\nsh ' +
|
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
|
|
||||||
' ' +
|
|
||||||
version +
|
|
||||||
' ' +
|
|
||||||
(await utils.getMinorVersion(version)).replace('.', '');
|
|
||||||
|
|
||||||
if (ext_version) {
|
|
||||||
script += ' ' + ext_version;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install -f ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
@ -114,11 +114,9 @@ export async function addExtensionWindows(
|
|||||||
// match blackfire...blackfire-1.31.0
|
// match blackfire...blackfire-1.31.0
|
||||||
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
script +=
|
script +=
|
||||||
'\nsh ' +
|
'\n& ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
|
||||||
' ' +
|
|
||||||
(await utils.getMinorVersion(version)).replace('.', '');
|
(await utils.getMinorVersion(version)).replace('.', '');
|
||||||
|
|
||||||
if (ext_version) {
|
if (ext_version) {
|
||||||
|
27
src/scripts/ext/blackfire.ps1
Normal file
27
src/scripts/ext/blackfire.ps1
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[string]
|
||||||
|
$phpversion,
|
||||||
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
|
[string]
|
||||||
|
$version = '1.31.0'
|
||||||
|
)
|
||||||
|
|
||||||
|
Function Install-Blackfire() {
|
||||||
|
$installed = Get-Php -Path $php_dir
|
||||||
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri "https://packages.blackfire.io/binaries/blackfire-php/${version}/blackfire-php-windows_x64-php-${phpversion}${nts}.dll" -OutFile $ENV:RUNNER_TOOL_CACHE\blackfire.dll > $null 2>&1
|
||||||
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\blackfire.dll" -Destination "$ext_dir\blackfire.dll"
|
||||||
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
|
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick "Blackfire" "Installed and enabled"
|
||||||
|
}
|
||||||
|
|
||||||
|
$tick = ([char]8730)
|
||||||
|
$php_dir = 'C:\tools\php'
|
||||||
|
$ext_dir = $php_dir + '\ext'
|
||||||
|
|
||||||
|
Install-Blackfire
|
||||||
|
|
Loading…
Reference in New Issue
Block a user