mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Fix output on non GitHub Action environments
This commit is contained in:
parent
5acd006232
commit
9d74a11420
@ -235,13 +235,13 @@ setup_php() {
|
|||||||
semver="$(php_semver)"
|
semver="$(php_semver)"
|
||||||
extra_version="$(php_extra_version)"
|
extra_version="$(php_extra_version)"
|
||||||
configure_php
|
configure_php
|
||||||
|
set_output "php-version" "$semver"
|
||||||
if [ "${semver%.*}" != "$version" ]; then
|
if [ "${semver%.*}" != "$version" ]; then
|
||||||
add_log "${cross:?}" "PHP" "Could not setup PHP $version"
|
add_log "${cross:?}" "PHP" "Could not setup PHP $version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
echo "::set-output name=php-version::$semver"
|
|
||||||
add_log "$tick" "PHP" "$status PHP $semver$extra_version"
|
add_log "$tick" "PHP" "$status PHP $semver$extra_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Function to log license details.
|
# Function to log license details.
|
||||||
add_license_log() {
|
add_license_log() {
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
printf "Cubrid CCI package is required for %s extension.\n" "$ext"
|
printf "Cubrid CCI package is required for %s extension.\n" "$ext"
|
||||||
printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
|
printf "The extension %s and Cubrid CCI are provided under the license linked below.\n" "$ext"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://github.com/CUBRID/cubrid-cci/blob/develop/COPYING"
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup gcc-7 and g++-7
|
# Function to setup gcc-7 and g++-7
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
Function Add-LicenseLog() {
|
Function Add-LicenseLog() {
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
Get-Content $ext_dir\ioncube\LICENSE.txt
|
Get-Content $ext_dir\ioncube\LICENSE.txt
|
||||||
Write-Output "::endgroup::"
|
Write-Output "$env:END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add ioncube extension.
|
# Function to add ioncube extension.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
add_license_log() {
|
add_license_log() {
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "ioncube" "Click to read the ioncube loader license information"
|
||||||
cat "${ext_dir:?}"/IONCUBE_LICENSE.txt
|
cat "${ext_dir:?}"/IONCUBE_LICENSE.txt
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install ioncube.
|
# Function to install ioncube.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Function to log license information.
|
# Function to log license information.
|
||||||
Function Add-LicenseLog() {
|
Function Add-LicenseLog() {
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
|
||||||
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
printf "Oracle Instant Client package is required for %s extension.\n" $extension
|
||||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
Write-Output "::endgroup::"
|
Write-Output "$env:END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get instantclinet.
|
# Function to get instantclinet.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Function to log result of a operation.
|
# Function to log result of a operation.
|
||||||
add_license_log() {
|
add_license_log() {
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
|
||||||
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
printf "Oracle Instant Client package is required for %s extension.\n" "$ext"
|
||||||
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
printf "It is provided under the Oracle Technology Network Development and Distribution License.\n"
|
||||||
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.oracle.com/downloads/licenses/instant-client-lic.html"
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install instantclient and SDK.
|
# Function to install instantclient and SDK.
|
||||||
|
@ -68,10 +68,10 @@ run_group() {
|
|||||||
command=$1
|
command=$1
|
||||||
log=$2
|
log=$2
|
||||||
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
|
||||||
echo "::group::$log"
|
echo "$GROUP$log"
|
||||||
. ./run_group.sh
|
. ./run_group.sh
|
||||||
rm ./run_group.sh
|
rm ./run_group.sh
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_extension() {
|
patch_extension() {
|
||||||
|
@ -239,10 +239,10 @@ setup_php() {
|
|||||||
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
|
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
|
||||||
link_pecl_file
|
link_pecl_file
|
||||||
configure_php
|
configure_php
|
||||||
|
set_output "php-version" "$semver"
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
||||||
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
||||||
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$src"/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
echo "::set-output name=php-version::$semver"
|
|
||||||
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ Function Add-Grpc_php_plugin() {
|
|||||||
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
||||||
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
||||||
Add-Path $msys_location\mingw64\bin
|
Add-Path $msys_location\mingw64\bin
|
||||||
Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
||||||
Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
|
Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
||||||
Write-Output "::endgroup::"
|
Write-Output "$env:END_GROUP"
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|||||||
else
|
else
|
||||||
add_grpc_php_plugin_compile >/dev/null 2>&1
|
add_grpc_php_plugin_compile >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
echo "::set-output name=grpc_php_plugin_path::$(command -v grpc_php_plugin)"
|
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
||||||
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
||||||
cat "$license_path"
|
cat "$license_path"
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ Function Add-Protoc() {
|
|||||||
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
||||||
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
||||||
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
||||||
Write-Output "::endgroup::"
|
Write-Output "$env:END_GROUP"
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ add_protoc() {
|
|||||||
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
||||||
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
||||||
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
||||||
echo "::endgroup::"
|
echo "$END_GROUP"
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,14 @@ export github="https://github.com/shivammathur"
|
|||||||
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
|
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
|
||||||
export setup_php="https://setup-php.com"
|
export setup_php="https://setup-php.com"
|
||||||
|
|
||||||
|
if [ -n "${GITHUB_ACTIONS}" ]; then
|
||||||
|
export GROUP='::group::'
|
||||||
|
export END_GROUP='::endgroup::'
|
||||||
|
else
|
||||||
|
export GROUP=''
|
||||||
|
export END_GROUP=''
|
||||||
|
fi
|
||||||
|
|
||||||
# Function to log start of a operation.
|
# Function to log start of a operation.
|
||||||
step_log() {
|
step_log() {
|
||||||
message=$1
|
message=$1
|
||||||
@ -30,6 +38,15 @@ add_log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to set output on GitHub Actions.
|
||||||
|
set_output() {
|
||||||
|
name=$1
|
||||||
|
value=$2
|
||||||
|
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
||||||
|
echo "::set-output name=${name}::${value}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to read env inputs.
|
# Function to read env inputs.
|
||||||
read_env() {
|
read_env() {
|
||||||
update="${update:-${UPDATE:-false}}"
|
update="${update:-${UPDATE:-false}}"
|
||||||
|
@ -28,6 +28,25 @@ Function Add-Log($mark, $subject, $message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to set output on GitHub Actions.
|
||||||
|
Function Set-Output() {
|
||||||
|
param(
|
||||||
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
|
[string]
|
||||||
|
$output,
|
||||||
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[ValidateLength(1, [int]::MaxValue)]
|
||||||
|
[string]
|
||||||
|
$value
|
||||||
|
)
|
||||||
|
if ($env:GITHUB_ACTIONS -eq 'true') {
|
||||||
|
Write-Output "::set-output name=$output::$value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add a line to a powershell profile safely.
|
# Function to add a line to a powershell profile safely.
|
||||||
Function Add-ToProfile {
|
Function Add-ToProfile {
|
||||||
param(
|
param(
|
||||||
@ -231,6 +250,15 @@ if($env:PHPTS -ne 'ts') {
|
|||||||
} else {
|
} else {
|
||||||
$env:PHPTS = ''
|
$env:PHPTS = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $env:GITHUB_ACTIONS -eq 'true') {
|
||||||
|
$env:GROUP = '::group::'
|
||||||
|
$env:END_GROUP = '::endgroup::'
|
||||||
|
} else {
|
||||||
|
$env:GROUP = ''
|
||||||
|
$env:END_GROUP = ''
|
||||||
|
}
|
||||||
|
|
||||||
if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVersion))) {
|
if($env:RUNNER -eq 'self-hosted' -or (-not($env:ImageOS) -and -not($env:ImageVersion))) {
|
||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
@ -316,5 +344,5 @@ if($version -lt "5.5") {
|
|||||||
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
Enable-PhpExtension -Extension $enable_extensions -Path $php_dir
|
||||||
Add-PhpCAInfo
|
Add-PhpCAInfo
|
||||||
Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE
|
Copy-Item -Path $src\configs\pm\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||||
Write-Output "::set-output name=php-version::$($installed.FullVersion)"
|
Set-Output php-version $($installed.FullVersion)
|
||||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)$extra_version"
|
||||||
|
Loading…
Reference in New Issue
Block a user