mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Upgrade blackfire to v2
This commit is contained in:
parent
947009a717
commit
dbf50bf9e0
@ -260,7 +260,7 @@ These tools can be setup globally using the `tools` input. It accepts a string i
|
||||
|
||||
- Scripts `phpize` and `php-config` are set up with the same version as of the input PHP version.
|
||||
|
||||
- The latest versions of both agent `blackfire-agent` and client `blackfire` are set up when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
|
||||
- The latest version of `blackfire` cli is setup when `blackfire` is specified in tools input. Please refer to the [official documentation](https://blackfire.io/docs/integrations/ci/github-actions "Blackfire.io documentation for GitHub Actions") for using `blackfire` with GitHub Actions.
|
||||
|
||||
- Tools `prestissimo` and `composer-prefetcher` will be skipped unless `composer:v1` is also specified in tools input. It is recommended to drop `prestissimo` and use `composer v2`.
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
# Function to add blackfire and blackfire-agent.
|
||||
# Function to add blackfire cli.
|
||||
Function Add-Blackfire() {
|
||||
$arch_name ='amd64'
|
||||
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||
$arch_name = '386'
|
||||
}
|
||||
$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"
|
||||
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
||||
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
||||
Invoke-WebRequest -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
|
||||
blackfire agent:config --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
|
||||
blackfire client: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 blackfire $agent_version"
|
||||
Add-Log $tick "blackfire-agent" "Added blackfire-agent $agent_version"
|
||||
Add-Log $tick "blackfire" "Added blackfire $cli_version"
|
||||
}
|
||||
|
@ -3,27 +3,28 @@ add_blackfire_linux() {
|
||||
get -s -n "" 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
|
||||
${apt_install:?} blackfire
|
||||
sudo chmod -R 777 /var/run/blackfire /etc/blackfire/agent
|
||||
}
|
||||
|
||||
add_blackfire_darwin() {
|
||||
sudo mkdir -p /usr/local/var/run
|
||||
brew tap --shallow blackfireio/homebrew-blackfire
|
||||
brew install blackfire-agent
|
||||
add_brew_tap blackfireio/homebrew-blackfire
|
||||
brew install blackfire
|
||||
}
|
||||
|
||||
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
|
||||
blackfire agent:config --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN"
|
||||
[ "$os" = "Linux" ] && sudo service blackfire-agent restart
|
||||
[ "$os" = "Darwin" ] && brew services start blackfire
|
||||
fi
|
||||
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
||||
blackfire config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN"
|
||||
blackfire client:config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to add blackfire and blackfire-agent.
|
||||
# Function to add blackfire cli.
|
||||
add_blackfire() {
|
||||
os="$(uname -s)"
|
||||
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
||||
@ -31,5 +32,4 @@ add_blackfire() {
|
||||
blackfire_config >/dev/null 2>&1
|
||||
tool_version=$(get_tool_version "blackfire" "version")
|
||||
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
||||
add_log "${tick:?}" "blackfire-agent" "Added blackfire-agent $tool_version"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user