mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Add blackfire on OSX
This commit is contained in:
parent
dc9461a053
commit
943f491830
@ -25,6 +25,12 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
||||||
|
expect(win32).toContain('blackfire.ps1 7.3 73');
|
||||||
|
|
||||||
|
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
|
||||||
|
expect(win32).toContain('blackfire.ps1 7.3 73 1.31.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
@ -126,6 +132,12 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('blackfire_darwin.sh 7.3 73');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
|
||||||
|
expect(darwin).toContain('blackfire_darwin.sh 7.3 73 1.31.0');
|
||||||
|
|
||||||
darwin = await extensions.addExtension(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
'7.2',
|
'7.2',
|
||||||
|
25
dist/index.js
vendored
25
dist/index.js
vendored
@ -2733,6 +2733,18 @@ 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;
|
||||||
@ -2768,6 +2780,19 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
|||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
let matches;
|
let matches;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match blackfire...blackfire-1.31.0
|
||||||
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
|
script +=
|
||||||
|
'\nsh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||||
|
' ' +
|
||||||
|
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 += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||||
|
@ -63,6 +63,19 @@ 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;
|
||||||
@ -98,6 +111,20 @@ export async function addExtensionWindows(
|
|||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
let matches: RegExpExecArray;
|
let matches: RegExpExecArray;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match blackfire...blackfire-1.31.0
|
||||||
|
case /^blackfire(-\d+\.\d+\.\d+)?$/.test(extension):
|
||||||
|
script +=
|
||||||
|
'\nsh ' +
|
||||||
|
path.join(__dirname, '../src/scripts/ext/blackfire.ps1') +
|
||||||
|
' ' +
|
||||||
|
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 += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
|
||||||
|
23
src/scripts/ext/blackfire_darwin.sh
Normal file
23
src/scripts/ext/blackfire_darwin.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Function to log result of a operation
|
||||||
|
add_log() {
|
||||||
|
mark=$1
|
||||||
|
subject=$2
|
||||||
|
message=$3
|
||||||
|
if [ "$mark" = "$tick" ]; then
|
||||||
|
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||||
|
else
|
||||||
|
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
tick="✓"
|
||||||
|
cross="✗"
|
||||||
|
phpversion=$2
|
||||||
|
blackfireVersion=${3:-1.31.0}
|
||||||
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
|
|
||||||
|
(curl -A "Github action" -o /tmp/blackfire.so -L -s https://packages.blackfire.io/binaries/blackfire-php/$blackfireVersion/blackfire-php-darwin_amd64-php-$phpversion.so && \
|
||||||
|
sudo mv /tmp/blackfire.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so && \
|
||||||
|
echo "extension=blackfire.so" >>"$ini_file" && \
|
||||||
|
add_log "$tick" "blackfire" "Installed and enabled") || \
|
||||||
|
add_log "$cross" "blackfire" "Could not install blackfire"
|
Loading…
Reference in New Issue
Block a user