setup-php 2.15.0 → 2.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -143
- package/lib/config.d.ts +3 -3
- package/lib/config.js +71 -71
- package/lib/config.js.map +1 -1
- package/lib/coverage.d.ts +5 -4
- package/lib/coverage.js +97 -87
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.d.ts +4 -4
- package/lib/extensions.js +214 -210
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +63 -0
- package/lib/fetch.js.map +1 -0
- package/lib/install.d.ts +2 -2
- package/lib/install.js +75 -80
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +23 -24
- package/lib/tools.js +373 -386
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +21 -23
- package/lib/utils.js +261 -293
- package/lib/utils.js.map +1 -1
- package/package.json +21 -20
- package/src/config.ts +8 -8
- package/src/configs/brew_extensions +2 -0
- package/src/configs/composer.env +2 -0
- package/src/configs/ini/jit.ini +3 -0
- package/src/configs/ini/php.ini +2 -0
- package/src/configs/ini/xdebug.ini +1 -0
- package/src/configs/os_releases.csv +2 -0
- package/src/configs/php-versions.json +2 -2
- package/src/configs/php_packages +12 -0
- package/src/configs/{php.json → pm/php.json} +0 -0
- package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
- package/src/configs/tools.json +48 -26
- package/src/configs/tools_schema.json +11 -0
- package/src/coverage.ts +47 -55
- package/src/extensions.ts +23 -19
- package/src/fetch.ts +54 -0
- package/src/install.ts +27 -40
- package/src/scripts/darwin.sh +72 -39
- package/src/scripts/extensions/add_extensions.ps1 +194 -0
- package/src/scripts/extensions/add_extensions.sh +184 -0
- package/src/scripts/{ext → extensions}/blackfire.ps1 +0 -0
- package/src/scripts/{ext → extensions}/blackfire.sh +0 -0
- package/src/scripts/{ext → extensions}/couchbase.sh +0 -0
- package/src/scripts/{ext → extensions}/cubrid.sh +3 -3
- package/src/scripts/{ext → extensions}/extension_map.php +36 -13
- package/src/scripts/{ext → extensions}/firebird.ps1 +0 -0
- package/src/scripts/{ext → extensions}/firebird.sh +0 -0
- package/src/scripts/{ext → extensions}/gearman.sh +0 -0
- package/src/scripts/{ext → extensions}/geos.sh +0 -0
- package/src/scripts/{ext → extensions}/http.ps1 +0 -0
- package/src/scripts/{ext → extensions}/http.sh +4 -15
- package/src/scripts/{ext → extensions}/intl.sh +0 -0
- package/src/scripts/{ext → extensions}/ioncube.ps1 +2 -2
- package/src/scripts/{ext → extensions}/ioncube.sh +2 -2
- package/src/scripts/{ext → extensions}/oci.ps1 +39 -14
- package/src/scripts/{ext → extensions}/oci.sh +3 -3
- package/src/scripts/{ext → extensions}/patches/firebird.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/geos.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/http.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/phpize.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/protobuf.sh +0 -0
- package/src/scripts/{ext → extensions}/phalcon.ps1 +0 -0
- package/src/scripts/{ext → extensions}/phalcon.sh +4 -5
- package/src/scripts/{ext → extensions}/source.sh +23 -22
- package/src/scripts/extensions/sqlsrv.sh +15 -0
- package/src/scripts/linux.sh +71 -40
- package/src/scripts/tools/add_tools.ps1 +220 -10
- package/src/scripts/tools/add_tools.sh +166 -15
- package/src/scripts/tools/blackfire.sh +2 -1
- package/src/scripts/tools/grpc_php_plugin.ps1 +4 -4
- package/src/scripts/tools/grpc_php_plugin.sh +3 -3
- package/src/scripts/tools/ppa.sh +12 -9
- package/src/scripts/tools/protoc.ps1 +2 -2
- package/src/scripts/tools/protoc.sh +2 -2
- package/src/scripts/tools/symfony.ps1 +18 -0
- package/src/scripts/tools/symfony.sh +18 -0
- package/src/scripts/unix.sh +186 -0
- package/src/scripts/win32.ps1 +145 -356
- package/src/tools.ts +62 -82
- package/src/utils.ts +57 -145
- package/lib/sapi.js +0 -64
- package/src/scripts/common.sh +0 -366
|
@@ -1,24 +1,175 @@
|
|
|
1
|
+
# Variables
|
|
2
|
+
export tool_path_dir="/usr/local/bin"
|
|
3
|
+
export composer_home="$HOME/.composer"
|
|
4
|
+
export composer_bin="$composer_home/vendor/bin"
|
|
5
|
+
export composer_json="$composer_home/composer.json"
|
|
6
|
+
export composer_lock="$composer_home/composer.lock"
|
|
7
|
+
|
|
8
|
+
# Function to extract tool version.
|
|
9
|
+
get_tool_version() {
|
|
10
|
+
tool=$1
|
|
11
|
+
param=$2
|
|
12
|
+
alp="[a-zA-Z0-9]"
|
|
13
|
+
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
|
14
|
+
if [ "$tool" = "composer" ]; then
|
|
15
|
+
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
|
16
|
+
if [[ -n "$composer_alias_version" ]]; then
|
|
17
|
+
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
|
|
18
|
+
else
|
|
19
|
+
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
|
20
|
+
fi
|
|
21
|
+
echo "$composer_version" | sudo tee /tmp/composer_version
|
|
22
|
+
else
|
|
23
|
+
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Function to configure composer
|
|
28
|
+
configure_composer() {
|
|
29
|
+
tool_path=$1
|
|
30
|
+
sudo ln -sf "$tool_path" "$tool_path.phar"
|
|
31
|
+
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
|
32
|
+
if [ $? -eq 1 ]; then
|
|
33
|
+
add_log "${cross:?}" "composer" "Could not download composer"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
if ! [ -d "$composer_home" ]; then
|
|
37
|
+
sudo -u "$(id -un)" -g "$(id -gn)" mkdir -p -m=00755 "$composer_home"
|
|
38
|
+
else
|
|
39
|
+
sudo chown -R "$(id -un)":"$(id -gn)" "$composer_home"
|
|
40
|
+
fi
|
|
41
|
+
if ! [ -e "$composer_json" ]; then
|
|
42
|
+
echo '{}' | tee "$composer_json" >/dev/null
|
|
43
|
+
chmod 644 "$composer_json"
|
|
44
|
+
fi
|
|
45
|
+
add_env_path "${src:?}"/configs/composer.env
|
|
46
|
+
add_path "$composer_bin"
|
|
47
|
+
if [ -n "$COMPOSER_TOKEN" ]; then
|
|
48
|
+
add_env COMPOSER_AUTH '{"github-oauth": {"github.com": "'"$COMPOSER_TOKEN"'"}}'
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Helper function to configure tools.
|
|
1
53
|
add_tools_helper() {
|
|
2
54
|
tool=$1
|
|
55
|
+
extensions=()
|
|
3
56
|
if [ "$tool" = "codeception" ]; then
|
|
4
|
-
|
|
57
|
+
extensions+=(json mbstring)
|
|
58
|
+
sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception
|
|
5
59
|
elif [ "$tool" = "composer" ]; then
|
|
6
|
-
configure_composer "$
|
|
60
|
+
configure_composer "$tool_path"
|
|
7
61
|
elif [ "$tool" = "cs2pr" ]; then
|
|
8
|
-
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$
|
|
9
|
-
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$
|
|
62
|
+
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" 2>/dev/null ||
|
|
63
|
+
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
|
10
64
|
elif [ "$tool" = "phan" ]; then
|
|
11
|
-
|
|
12
|
-
|
|
65
|
+
extensions+=(fileinfo ast)
|
|
66
|
+
elif [ "$tool" = "phinx" ]; then
|
|
67
|
+
extensions+=(mbstring)
|
|
13
68
|
elif [ "$tool" = "phive" ]; then
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
69
|
+
extensions+=(curl mbstring xml)
|
|
70
|
+
elif [[ "$tool" =~ phpc(bf|s) ]]; then
|
|
71
|
+
extensions+=(tokenizer simplexml xmlwriter)
|
|
72
|
+
elif [[ "$tool" =~ phpc(bf|s) ]]; then
|
|
73
|
+
extensions+=(tokenizer xmlwriter simplexml)
|
|
74
|
+
elif [ "$tool" = "php-cs-fixer" ]; then
|
|
75
|
+
extensions+=(json tokenizer)
|
|
17
76
|
elif [ "$tool" = "phpDocumentor" ]; then
|
|
18
|
-
|
|
19
|
-
sudo ln -s "$
|
|
20
|
-
sudo ln -s "$
|
|
21
|
-
elif [
|
|
22
|
-
|
|
77
|
+
extensions+=(ctype hash json fileinfo iconv mbstring simplexml xml)
|
|
78
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/phpdocumentor 2>/dev/null || true
|
|
79
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/phpdoc
|
|
80
|
+
elif [ "$tool" = "phpunit" ]; then
|
|
81
|
+
extensions+=(dom json libxml mbstring xml xmlwriter)
|
|
82
|
+
elif [ "$tool" = "phpunit-bridge" ]; then
|
|
83
|
+
extensions+=(dom pdo tokenizer xmlwriter xmlreader)
|
|
84
|
+
elif [[ "$tool" =~ phpunit(-polyfills)?$ ]]; then
|
|
85
|
+
if [ -e "$tool_path_dir"/phpunit ] && [ -d "$composer_bin" ]; then
|
|
86
|
+
sudo cp "$tool_path_dir"/phpunit "$composer_bin"
|
|
87
|
+
fi
|
|
88
|
+
elif [ "$tool" = "vapor-cli" ]; then
|
|
89
|
+
extensions+=(fileinfo json mbstring zip simplexml)
|
|
90
|
+
sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli
|
|
91
|
+
elif [ "$tool" = wp-cli ]; then
|
|
92
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
|
93
|
+
fi
|
|
94
|
+
for extension in "${extensions[@]}"; do
|
|
95
|
+
add_extension "$extension" extension >/dev/null 2>&1
|
|
96
|
+
done
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# Function to setup a remote tool.
|
|
100
|
+
add_tool() {
|
|
101
|
+
url=$1
|
|
102
|
+
tool=$2
|
|
103
|
+
ver_param=$3
|
|
104
|
+
tool_path="$tool_path_dir/$tool"
|
|
105
|
+
add_path "$tool_path_dir"
|
|
106
|
+
if [ -e "$tool_path" ]; then
|
|
107
|
+
sudo cp -aL "$tool_path" /tmp/"$tool"
|
|
108
|
+
fi
|
|
109
|
+
IFS="," read -r -a url <<<"$url"
|
|
110
|
+
status_code=$(get -v -e "$tool_path" "${url[@]}")
|
|
111
|
+
if [ "$status_code" != "200" ] && [[ "${url[0]}" =~ .*github.com.*releases.*latest.* ]]; then
|
|
112
|
+
url[0]="${url[0]//releases\/latest\/download/releases/download/$(get -s -n "" "$(echo "${url[0]}" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "${url[0]}" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
|
113
|
+
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
|
114
|
+
fi
|
|
115
|
+
if [ "$status_code" = "200" ]; then
|
|
116
|
+
add_tools_helper "$tool"
|
|
117
|
+
tool_version=$(get_tool_version "$tool" "$ver_param")
|
|
118
|
+
add_log "${tick:?}" "$tool" "Added $tool $tool_version"
|
|
119
|
+
else
|
|
120
|
+
if [ "$tool" = "composer" ]; then
|
|
121
|
+
export fail_fast=true
|
|
122
|
+
elif [ -e /tmp/"$tool" ]; then
|
|
123
|
+
sudo cp -a /tmp/"$tool" "$tool_path"
|
|
124
|
+
fi
|
|
125
|
+
add_log "$cross" "$tool" "Could not setup $tool"
|
|
126
|
+
fi
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# Function to setup a tool using composer in a different scope.
|
|
130
|
+
add_composertool_helper() {
|
|
131
|
+
tool=$1
|
|
132
|
+
release=$2
|
|
133
|
+
prefix=$3
|
|
134
|
+
scope=$4
|
|
135
|
+
composer_args=$5
|
|
136
|
+
enable_extensions curl mbstring openssl
|
|
137
|
+
if [ "$scope" = "global" ]; then
|
|
138
|
+
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
|
139
|
+
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
|
140
|
+
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
|
141
|
+
else
|
|
142
|
+
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
|
143
|
+
if ! [ -d "$scoped_dir" ]; then
|
|
144
|
+
mkdir -p "$scoped_dir"
|
|
145
|
+
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
|
146
|
+
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
|
147
|
+
fi
|
|
148
|
+
add_path "$scoped_dir"/vendor/bin
|
|
149
|
+
fi
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Function to setup a tool using composer.
|
|
153
|
+
add_composertool() {
|
|
154
|
+
tool=$1
|
|
155
|
+
release=$2
|
|
156
|
+
prefix=$3
|
|
157
|
+
scope=$4
|
|
158
|
+
composer_major_version=$(cut -d'.' -f 1 /tmp/composer_version)
|
|
159
|
+
if [ "$composer_major_version" != "1" ]; then
|
|
160
|
+
composer_args="--ignore-platform-req=ext-*"
|
|
161
|
+
if [[ "$tool" =~ prestissimo|composer-prefetcher ]]; then
|
|
162
|
+
echo "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
|
|
163
|
+
add_log "$cross" "$tool" "Skipped"
|
|
164
|
+
return
|
|
165
|
+
fi
|
|
166
|
+
fi
|
|
167
|
+
add_composertool_helper "$tool" "$release" "$prefix" "$scope" "$composer_args"
|
|
168
|
+
tool_version=$(get_tool_version cat /tmp/composer.log)
|
|
169
|
+
([ -s /tmp/composer.log ] && add_log "$tick" "$tool" "Added $tool $tool_version"
|
|
170
|
+
) || add_log "$cross" "$tool" "Could not setup $tool"
|
|
171
|
+
add_tools_helper "$tool"
|
|
172
|
+
if [ -e "$composer_bin/composer" ]; then
|
|
173
|
+
sudo cp -a "$tool_path_dir/composer" "$composer_bin"
|
|
23
174
|
fi
|
|
24
|
-
}
|
|
175
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
add_blackfire_linux() {
|
|
2
|
-
sudo mkdir -p /var/run/blackfire
|
|
2
|
+
sudo mkdir -p /var/run/blackfire /etc/blackfire
|
|
3
3
|
add_list debian/blackfire http://packages.blackfire.io/debian https://packages.blackfire.io/gpg.key any main
|
|
4
4
|
install_packages blackfire
|
|
5
|
+
sudo chmod 777 /etc/blackfire/agent
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
add_blackfire_darwin() {
|
|
@@ -11,11 +11,11 @@ Function Add-Grpc_php_plugin() {
|
|
|
11
11
|
$msys_location = Add-Msys2
|
|
12
12
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
|
13
13
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Add-Path $msys_location\mingw64\bin
|
|
15
|
+
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
|
16
16
|
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
|
17
17
|
Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
|
|
18
|
-
printf "
|
|
18
|
+
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"
|
|
19
19
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
|
20
|
-
Write-Output "
|
|
20
|
+
Write-Output "$env:END_GROUP"
|
|
21
21
|
}
|
|
@@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|
|
50
50
|
else
|
|
51
51
|
add_grpc_php_plugin_compile >/dev/null 2>&1
|
|
52
52
|
fi
|
|
53
|
-
|
|
53
|
+
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
|
54
54
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
|
55
|
-
printf "
|
|
55
|
+
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"
|
|
56
56
|
cat "$license_path"
|
|
57
|
-
echo "
|
|
57
|
+
echo "$END_GROUP"
|
|
58
58
|
}
|
package/src/scripts/tools/ppa.sh
CHANGED
|
@@ -54,14 +54,17 @@ update_lists_helper() {
|
|
|
54
54
|
update_lists() {
|
|
55
55
|
local ppa=${1:-}
|
|
56
56
|
local ppa_search=${2:-}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
local list=
|
|
58
|
+
status_file=/tmp/os_lists
|
|
59
|
+
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
|
|
60
|
+
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
|
|
61
|
+
status_file=/tmp/"${ppa/\//_}"
|
|
62
|
+
elif grep -Eq '^deb ' "$list_file"; then
|
|
63
|
+
list="$list_file"
|
|
64
|
+
fi
|
|
65
|
+
if [ ! -e "$status_file" ]; then
|
|
63
66
|
update_lists_helper "$list" >/dev/null 2>&1
|
|
64
|
-
echo '' | tee
|
|
67
|
+
echo '' | tee "$status_file" >/dev/null 2>&1
|
|
65
68
|
fi
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -156,9 +159,9 @@ add_ppa() {
|
|
|
156
159
|
else
|
|
157
160
|
add_list "$ppa"
|
|
158
161
|
fi
|
|
159
|
-
|
|
162
|
+
exit_code="$?"
|
|
160
163
|
. /etc/os-release
|
|
161
|
-
return $
|
|
164
|
+
return $exit_code
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
# Function to update a PPA.
|
|
@@ -32,7 +32,7 @@ Function Add-Protoc() {
|
|
|
32
32
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
|
33
33
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
|
34
34
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
|
35
|
-
printf "
|
|
35
|
+
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"
|
|
36
36
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
|
37
|
-
Write-Output "
|
|
37
|
+
Write-Output "$env:END_GROUP"
|
|
38
38
|
}
|
|
@@ -22,7 +22,7 @@ add_protoc() {
|
|
|
22
22
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
|
23
23
|
) >/dev/null 2>&1
|
|
24
24
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
|
25
|
-
printf "
|
|
25
|
+
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
|
26
26
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
|
27
|
-
echo "
|
|
27
|
+
echo "$END_GROUP"
|
|
28
28
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Function Add-Symfony() {
|
|
2
|
+
$arch_name ='amd64'
|
|
3
|
+
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
|
4
|
+
$arch_name = '386'
|
|
5
|
+
}
|
|
6
|
+
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
|
7
|
+
Invoke-WebRequest -Uri $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
|
8
|
+
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
9
|
+
if(Test-Path $bin_dir\symfony.exe) {
|
|
10
|
+
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
|
11
|
+
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
|
12
|
+
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
|
13
|
+
$tool_version = Get-ToolVersion symfony "-V"
|
|
14
|
+
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
|
|
15
|
+
} else {
|
|
16
|
+
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
add_symfony() {
|
|
2
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
3
|
+
echo 'deb [trusted=yes] https://repo.symfony.com/apt/ /' | sudo tee /etc/apt/sources.list.d/symfony-cli.list >/dev/null 2>&1
|
|
4
|
+
update_lists symfony repo.symfony.com
|
|
5
|
+
install_packages symfony-cli
|
|
6
|
+
elif [ "$(uname -s)" = "Darwin" ]; then
|
|
7
|
+
add_brew_tap symfony-cli/homebrew-tap
|
|
8
|
+
brew install symfony-cli/tap/symfony-cli >/dev/null 2>&1
|
|
9
|
+
fi
|
|
10
|
+
symfony_path="$(command -v symfony)"
|
|
11
|
+
if [[ -n "$symfony_path" ]]; then
|
|
12
|
+
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
|
13
|
+
tool_version=$(get_tool_version "symfony" "-V")
|
|
14
|
+
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
|
|
15
|
+
else
|
|
16
|
+
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
|
|
17
|
+
fi
|
|
18
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Variables
|
|
2
|
+
export tick="✓"
|
|
3
|
+
export cross="✗"
|
|
4
|
+
export curl_opts=(-sL)
|
|
5
|
+
export old_versions="5.[3-5]"
|
|
6
|
+
export jit_versions="8.[0-9]"
|
|
7
|
+
export nightly_versions="8.[2-9]"
|
|
8
|
+
export xdebug3_versions="7.[2-4]|8.[0-9]"
|
|
9
|
+
export latest="releases/latest/download"
|
|
10
|
+
export github="https://github.com/shivammathur"
|
|
11
|
+
export jsdeliver="https://cdn.jsdelivr.net/gh/shivammathur"
|
|
12
|
+
export setup_php="https://setup-php.com"
|
|
13
|
+
|
|
14
|
+
if [ -n "${GITHUB_ACTIONS}" ]; then
|
|
15
|
+
export GROUP='::group::'
|
|
16
|
+
export END_GROUP='::endgroup::'
|
|
17
|
+
else
|
|
18
|
+
export GROUP=''
|
|
19
|
+
export END_GROUP=''
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Function to log start of a operation.
|
|
23
|
+
step_log() {
|
|
24
|
+
message=$1
|
|
25
|
+
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Function to log result of a operation.
|
|
29
|
+
add_log() {
|
|
30
|
+
mark=$1
|
|
31
|
+
subject=$2
|
|
32
|
+
message=$3
|
|
33
|
+
if [ "$mark" = "$tick" ]; then
|
|
34
|
+
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
35
|
+
else
|
|
36
|
+
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
37
|
+
[ "$fail_fast" = "true" ] && exit 1
|
|
38
|
+
fi
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Function to set output on GitHub Actions.
|
|
42
|
+
set_output() {
|
|
43
|
+
name=$1
|
|
44
|
+
value=$2
|
|
45
|
+
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
|
46
|
+
echo "::set-output name=${name}::${value}"
|
|
47
|
+
fi
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Function to read env inputs.
|
|
51
|
+
read_env() {
|
|
52
|
+
update="${update:-${UPDATE:-false}}"
|
|
53
|
+
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
|
54
|
+
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github
|
|
55
|
+
runner="${runner:-${RUNNER:-$_runner}}"
|
|
56
|
+
|
|
57
|
+
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
|
58
|
+
fail_fast=true
|
|
59
|
+
add_log "$cross" "Runner" "Runner set as github in self-hosted environment"
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Function to download a file using cURL.
|
|
64
|
+
# mode: -s pipe to stdout, -v save file and return status code
|
|
65
|
+
# execute: -e save file as executable
|
|
66
|
+
get() {
|
|
67
|
+
mode=$1
|
|
68
|
+
execute=$2
|
|
69
|
+
file_path=$3
|
|
70
|
+
shift 3
|
|
71
|
+
links=("$@")
|
|
72
|
+
if [ "$mode" = "-s" ]; then
|
|
73
|
+
sudo curl "${curl_opts[@]}" "${links[0]}"
|
|
74
|
+
else
|
|
75
|
+
for link in "${links[@]}"; do
|
|
76
|
+
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
|
77
|
+
[ "$status_code" = "200" ] && break
|
|
78
|
+
done
|
|
79
|
+
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
|
80
|
+
[ "$mode" = "-v" ] && echo "$status_code"
|
|
81
|
+
fi
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# Function to get shell profile.
|
|
85
|
+
get_shell_profile() {
|
|
86
|
+
case "$SHELL" in
|
|
87
|
+
*bash*)
|
|
88
|
+
echo "${HOME}/.bashrc"
|
|
89
|
+
;;
|
|
90
|
+
*zsh*)
|
|
91
|
+
echo "${HOME}/.zshrc"
|
|
92
|
+
;;
|
|
93
|
+
*)
|
|
94
|
+
echo "${HOME}/.profile"
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# Function to add a path to the PATH variable.
|
|
100
|
+
add_path() {
|
|
101
|
+
path_to_add=$1
|
|
102
|
+
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
|
103
|
+
if [[ -n "$GITHUB_PATH" ]]; then
|
|
104
|
+
echo "$path_to_add" | tee -a "$GITHUB_PATH" >/dev/null 2>&1
|
|
105
|
+
else
|
|
106
|
+
profile=$(get_shell_profile)
|
|
107
|
+
([ -e "$profile" ] && grep -q ":$path_to_add\"" "$profile" 2>/dev/null) || echo "export PATH=\"\${PATH:+\${PATH}:}\"$path_to_add" | sudo tee -a "$profile" >/dev/null 2>&1
|
|
108
|
+
fi
|
|
109
|
+
export PATH="${PATH:+${PATH}:}$path_to_add"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Function to add environment variables using a PATH.
|
|
113
|
+
add_env_path() {
|
|
114
|
+
env_path=$1
|
|
115
|
+
[ -e "$env_path" ] || return
|
|
116
|
+
if [[ -n "$GITHUB_ENV" ]]; then
|
|
117
|
+
cat "$env_path" >> "$GITHUB_ENV"
|
|
118
|
+
else
|
|
119
|
+
profile=$(get_shell_profile)
|
|
120
|
+
cat "$env_path" >> "$profile"
|
|
121
|
+
fi
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# Function to add an environment variable.
|
|
125
|
+
add_env() {
|
|
126
|
+
env_name=$1
|
|
127
|
+
env_value=$2
|
|
128
|
+
if [[ -n "$GITHUB_ENV" ]]; then
|
|
129
|
+
echo "$env_name=$env_value" | tee -a "$GITHUB_ENV" >/dev/null 2>&1
|
|
130
|
+
else
|
|
131
|
+
profile=$(get_shell_profile)
|
|
132
|
+
echo "export $env_name=\"$env_value\"" | sudo tee -a "$profile" >/dev/null 2>&1
|
|
133
|
+
fi
|
|
134
|
+
export "$env_name"="$env_value"
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# Function to download and run scripts from GitHub releases with jsdeliver fallback.
|
|
138
|
+
run_script() {
|
|
139
|
+
repo=$1
|
|
140
|
+
shift
|
|
141
|
+
args=("$@")
|
|
142
|
+
get -q -e /tmp/install.sh "$github/$repo/$latest/install.sh" "$jsdeliver/$repo@main/scripts/install.sh" "$setup_php/$repo/install.sh"
|
|
143
|
+
bash /tmp/install.sh "${args[@]}"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# Function to install required packages on self-hosted runners.
|
|
147
|
+
self_hosted_setup() {
|
|
148
|
+
if [ "$runner" = "self-hosted" ]; then
|
|
149
|
+
if [[ "${version:?}" =~ $old_versions ]]; then
|
|
150
|
+
add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner"
|
|
151
|
+
exit 1
|
|
152
|
+
else
|
|
153
|
+
self_hosted_helper >/dev/null 2>&1
|
|
154
|
+
fi
|
|
155
|
+
fi
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
# Function to configure PHP
|
|
159
|
+
configure_php() {
|
|
160
|
+
add_php_config
|
|
161
|
+
ini_config_dir="${src:?}"/configs/ini
|
|
162
|
+
ini_files=("$ini_config_dir"/php.ini)
|
|
163
|
+
[[ "$version" =~ $jit_versions ]] && ini_files+=("$ini_config_dir"/jit.ini)
|
|
164
|
+
[[ "$version" =~ $xdebug3_versions ]] && ini_files+=("$ini_config_dir"/xdebug.ini)
|
|
165
|
+
cat "${ini_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# Function to get PHP version in semver format.
|
|
169
|
+
php_semver() {
|
|
170
|
+
grep -Eo 'version="[0-9]+(\.[0-9]+){2}((-?[a-zA-Z]+([0-9]+)?)?){2}' "${php_config:?}" | cut -d '"' -f 2
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# Function to get ini_path.
|
|
174
|
+
php_ini_path() {
|
|
175
|
+
cut -d '"' -f 2 < <(grep "ini_path=" "$php_config" || php --ini | grep '(php.ini)' | sed -e "s|.*: s*||")
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
# Function to get the tag for a php version.
|
|
179
|
+
php_src_tag() {
|
|
180
|
+
commit=$(php_extra_version | grep -Eo "[0-9a-zA-Z]+")
|
|
181
|
+
if [[ -n "${commit}" ]]; then
|
|
182
|
+
echo "$commit"
|
|
183
|
+
else
|
|
184
|
+
echo "php-${semver:?}"
|
|
185
|
+
fi
|
|
186
|
+
}
|