mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 21:33:06 +07:00
Move blackfire setup to separate scripts
This commit is contained in:
parent
cb25b9c13a
commit
5405f14867
11
dist/index.js
vendored
11
dist/index.js
vendored
@ -2259,7 +2259,7 @@ async function getCleanedToolsList(tools_csv) {
|
|||||||
.map(function (extension) {
|
.map(function (extension) {
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
.replace(/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
return [...new Set(tools_list)];
|
return [...new Set(tools_list)];
|
||||||
@ -2345,8 +2345,9 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'grpc_php_plugin':
|
||||||
script += await getCommand(os_version, 'blackfire');
|
case 'protoc':
|
||||||
|
script += await addCustomTool(tool, version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
@ -2392,10 +2393,6 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'flex':
|
case 'flex':
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'grpc_php_plugin':
|
|
||||||
case 'protoc':
|
|
||||||
script += await addCustomTool(tool, version, os_version);
|
|
||||||
break;
|
|
||||||
case 'infection':
|
case 'infection':
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
|
@ -202,21 +202,6 @@ add_composertool() {
|
|||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_blackfire() {
|
|
||||||
sudo mkdir -p usr/local/var/run
|
|
||||||
brew tap --shallow blackfireio/homebrew-blackfire >/dev/null 2>&1
|
|
||||||
brew install blackfire-agent >/dev/null 2>&1
|
|
||||||
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
|
||||||
blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
|
|
||||||
brew services start blackfire-agent >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
|
||||||
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
add_log "$tick" "blackfire" "Added"
|
|
||||||
add_log "$tick" "blackfire-agent" "Added"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
for tool in pear pecl; do
|
for tool in pear pecl; do
|
||||||
|
@ -305,24 +305,6 @@ add_devtools() {
|
|||||||
configure_pecl >/dev/null 2>&1
|
configure_pecl >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add blackfire and blackfire-agent.
|
|
||||||
add_blackfire() {
|
|
||||||
sudo mkdir -p /var/run/blackfire
|
|
||||||
sudo curl "${curl_opts[@]}" https://packages.blackfire.io/gpg.key | sudo apt-key add - >/dev/null 2>&1
|
|
||||||
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list >/dev/null 2>&1
|
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
|
||||||
$apt_install blackfire-agent >/dev/null 2>&1
|
|
||||||
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
|
||||||
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
|
|
||||||
sudo /etc/init.d/blackfire-agent restart >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
|
||||||
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
add_log "$tick" "blackfire" "Added"
|
|
||||||
add_log "$tick" "blackfire-agent" "Added"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to setup the nightly build from master branch.
|
# Function to setup the nightly build from master branch.
|
||||||
setup_master() {
|
setup_master() {
|
||||||
curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner"
|
curl "${curl_opts[@]}" "$github"/php-builder/releases/latest/download/install.sh | bash -s "$runner"
|
||||||
|
17
src/scripts/tools/blackfire.ps1
Normal file
17
src/scripts/tools/blackfire.ps1
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Function to add blackfire and blackfire-agent.
|
||||||
|
Function Add-Blackfire() {
|
||||||
|
$agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
|
||||||
|
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
||||||
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||||
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
||||||
|
Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_dir\blackfire-agent.exe"
|
||||||
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
||||||
|
blackfire-agent --register --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
||||||
|
}
|
||||||
|
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
||||||
|
blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
||||||
|
}
|
||||||
|
Add-Log $tick "blackfire" "Added"
|
||||||
|
Add-Log $tick "blackfire-agent" "Added"
|
||||||
|
}
|
34
src/scripts/tools/blackfire.sh
Normal file
34
src/scripts/tools/blackfire.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
add_blackfire_linux() {
|
||||||
|
sudo mkdir -p /var/run/blackfire
|
||||||
|
sudo curl "${curl_opts[@]:?}" https://packages.blackfire.io/gpg.key | sudo apt-key add -
|
||||||
|
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
|
||||||
|
sudo "${debconf_fix:?}" apt-get update
|
||||||
|
${apt_install:?} blackfire-agent
|
||||||
|
}
|
||||||
|
|
||||||
|
add_blackfire_darwin() {
|
||||||
|
sudo mkdir -p /usr/local/var/run
|
||||||
|
brew tap --shallow blackfireio/homebrew-blackfire
|
||||||
|
brew install blackfire-agent
|
||||||
|
}
|
||||||
|
|
||||||
|
blackfire_config() {
|
||||||
|
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
||||||
|
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN"
|
||||||
|
[ "$os" = "Linux" ] && sudo /etc/init.d/blackfire-agent restart
|
||||||
|
[ "$os" = "Darwin" ] && brew services start blackfire-agent
|
||||||
|
fi
|
||||||
|
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
||||||
|
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add blackfire and blackfire-agent.
|
||||||
|
add_blackfire() {
|
||||||
|
os="$(uname -s)"
|
||||||
|
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
||||||
|
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
||||||
|
blackfire_config >/dev/null 2>&1
|
||||||
|
add_log "${tick:?}" "blackfire" "Added"
|
||||||
|
add_log "${tick:?}" "blackfire-agent" "Added"
|
||||||
|
}
|
@ -265,24 +265,6 @@ 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"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add blackfire and blackfire-agent.
|
|
||||||
Function Add-Blackfire() {
|
|
||||||
$agent_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).agent
|
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
|
||||||
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
||||||
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
|
||||||
Add-ToProfile $current_profile 'blackfire-agent' "New-Alias blackfire-agent $bin_dir\blackfire-agent.exe"
|
|
||||||
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
|
||||||
blackfire-agent --register --server-id=$env:BLACKFIRE_SERVER_ID --server-token=$env:BLACKFIRE_SERVER_TOKEN >$null 2>&1
|
|
||||||
}
|
|
||||||
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
|
|
||||||
blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
|
|
||||||
}
|
|
||||||
Add-Log $tick "blackfire" "Added"
|
|
||||||
Add-Log $tick "blackfire-agent" "Added"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
$tick = ([char]8730)
|
$tick = ([char]8730)
|
||||||
$cross = ([char]10007)
|
$cross = ([char]10007)
|
||||||
|
11
src/tools.ts
11
src/tools.ts
@ -364,7 +364,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -494,8 +494,9 @@ export async function addTools(
|
|||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'grpc_php_plugin':
|
||||||
script += await getCommand(os_version, 'blackfire');
|
case 'protoc':
|
||||||
|
script += await addCustomTool(tool, version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
@ -546,10 +547,6 @@ export async function addTools(
|
|||||||
case 'flex':
|
case 'flex':
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'grpc_php_plugin':
|
|
||||||
case 'protoc':
|
|
||||||
script += await addCustomTool(tool, version, os_version);
|
|
||||||
break;
|
|
||||||
case 'infection':
|
case 'infection':
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
|
Loading…
Reference in New Issue
Block a user