setup-php 2.12.0 → 2.16.0
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/LICENSE +21 -21
- package/README.md +977 -936
- package/package.json +66 -56
- package/src/config.ts +82 -82
- package/src/configs/brew_extensions +30 -0
- package/src/configs/os_releases.csv +17 -0
- package/src/configs/php-versions.json +6 -5
- package/src/configs/{php.json → pm/php.json} +29 -29
- package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
- package/src/configs/tools.json +256 -234
- package/src/configs/tools_schema.json +114 -103
- package/src/coverage.ts +169 -142
- package/src/extensions.ts +363 -349
- package/src/install.ts +79 -82
- package/src/scripts/common.sh +366 -314
- package/src/scripts/darwin.sh +257 -248
- package/src/scripts/ext/blackfire.ps1 +32 -32
- package/src/scripts/ext/blackfire.sh +22 -21
- package/src/scripts/ext/couchbase.sh +43 -43
- package/src/scripts/ext/cubrid.sh +60 -60
- package/src/scripts/ext/extension_map.php +109 -0
- package/src/scripts/ext/firebird.ps1 +19 -19
- package/src/scripts/ext/firebird.sh +39 -35
- package/src/scripts/ext/gearman.sh +22 -22
- package/src/scripts/ext/geos.sh +17 -17
- package/src/scripts/ext/http.ps1 +54 -54
- package/src/scripts/ext/http.sh +120 -120
- package/src/scripts/ext/intl.sh +23 -23
- package/src/scripts/ext/ioncube.ps1 +33 -32
- package/src/scripts/ext/ioncube.sh +21 -19
- package/src/scripts/ext/oci.ps1 +60 -60
- package/src/scripts/ext/oci.sh +65 -63
- package/src/scripts/ext/patches/firebird.sh +11 -11
- package/src/scripts/ext/patches/geos.sh +7 -7
- package/src/scripts/ext/patches/http.sh +11 -11
- package/src/scripts/ext/patches/pdo_oci.sh +6 -6
- package/src/scripts/ext/patches/phpize.sh +26 -26
- package/src/scripts/ext/patches/protobuf.sh +4 -4
- package/src/scripts/ext/phalcon.ps1 +54 -55
- package/src/scripts/ext/phalcon.sh +59 -59
- package/src/scripts/ext/source.sh +144 -144
- package/src/scripts/linux.sh +239 -280
- package/src/scripts/tools/add_tools.ps1 +28 -25
- package/src/scripts/tools/add_tools.sh +27 -19
- package/src/scripts/tools/blackfire.ps1 +19 -21
- package/src/scripts/tools/blackfire.sh +40 -35
- package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
- package/src/scripts/tools/grpc_php_plugin.sh +58 -61
- package/src/scripts/tools/ppa.sh +189 -0
- package/src/scripts/tools/protoc.ps1 +38 -38
- package/src/scripts/tools/protoc.sh +28 -28
- package/src/scripts/win32.ps1 +566 -471
- package/src/tools.ts +538 -509
- package/src/utils.ts +503 -497
- package/.eslintrc.json +0 -16
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/CONTRIBUTING.md +0 -70
- package/.github/FUNDING.yml +0 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
- package/.github/SECURITY.md +0 -29
- package/.github/workflows/docs.yml +0 -77
- package/.github/workflows/node-workflow.yml +0 -51
- package/.github/workflows/workflow.yml +0 -78
- package/.idea/workspace.xml +0 -113
- package/.prettierrc.json +0 -12
- package/__tests__/config.test.ts +0 -52
- package/__tests__/coverage.test.ts +0 -110
- package/__tests__/extensions.test.ts +0 -261
- package/__tests__/install.test.ts +0 -175
- package/__tests__/tools.test.ts +0 -490
- package/__tests__/utils.test.ts +0 -303
- package/action.yml +0 -29
- package/dist/index.js +0 -3001
- package/examples/bedrock.yml +0 -32
- package/examples/blackfire-player.yml +0 -31
- package/examples/blackfire.yml +0 -31
- package/examples/cakephp-mysql.yml +0 -114
- package/examples/cakephp-postgres.yml +0 -112
- package/examples/cakephp.yml +0 -92
- package/examples/codeigniter.yml +0 -34
- package/examples/laravel-mysql.yml +0 -74
- package/examples/laravel-postgres.yml +0 -74
- package/examples/laravel.yml +0 -42
- package/examples/lumen-mysql.yml +0 -74
- package/examples/lumen-postgres.yml +0 -74
- package/examples/lumen.yml +0 -38
- package/examples/phalcon-mysql.yml +0 -74
- package/examples/phalcon-postgres.yml +0 -73
- package/examples/sage.yml +0 -57
- package/examples/slim-framework.yml +0 -34
- package/examples/symfony-mysql.yml +0 -57
- package/examples/symfony-postgres.yml +0 -55
- package/examples/symfony.yml +0 -39
- package/examples/yii2-mysql.yml +0 -73
- package/examples/yii2-postgres.yml +0 -71
- package/examples/zend-framework.yml +0 -36
- package/jest.config.js +0 -12
- package/lib/config.js +0 -72
- package/lib/config.js.map +0 -1
- package/lib/coverage.js +0 -88
- package/lib/coverage.js.map +0 -1
- package/lib/extensions.js +0 -201
- package/lib/extensions.js.map +0 -1
- package/lib/install.js +0 -82
- package/lib/install.js.map +0 -1
- package/lib/sapi.js +0 -64
- package/lib/tools.js +0 -387
- package/lib/tools.js.map +0 -1
- package/lib/utils.js +0 -292
- package/lib/utils.js.map +0 -1
- package/tsconfig.json +0 -18
package/src/scripts/linux.sh
CHANGED
|
@@ -1,280 +1,239 @@
|
|
|
1
|
-
# Function to setup environment for self-hosted runners.
|
|
2
|
-
self_hosted_helper() {
|
|
3
|
-
if ! command -v
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
# Function to
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
add_log "${tick:?}" "
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
# Function to
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
fi
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if [ "$update" = "true" ]; then
|
|
241
|
-
update_php >/dev/null 2>&1
|
|
242
|
-
else
|
|
243
|
-
status="Found"
|
|
244
|
-
fi
|
|
245
|
-
fi
|
|
246
|
-
if ! command -v php"$version" >/dev/null; then
|
|
247
|
-
add_log "$cross" "PHP" "Could not setup PHP $version"
|
|
248
|
-
exit 1
|
|
249
|
-
fi
|
|
250
|
-
semver=$(php_semver)
|
|
251
|
-
extra_version=$(php_extra_version)
|
|
252
|
-
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
|
253
|
-
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|
254
|
-
ini_dir=$(php --ini | grep "(php.ini)" | sed -e "s|.*: s*||")
|
|
255
|
-
pecl_file="$scan_dir"/99-pecl.ini
|
|
256
|
-
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
|
|
257
|
-
link_pecl_file
|
|
258
|
-
configure_php
|
|
259
|
-
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
|
260
|
-
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
|
261
|
-
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
|
262
|
-
echo "::set-output name=php-version::$semver"
|
|
263
|
-
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
# Variables
|
|
267
|
-
version=$1
|
|
268
|
-
dist=$2
|
|
269
|
-
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|
270
|
-
apt_install="sudo $debconf_fix apt-fast install -y"
|
|
271
|
-
scripts="${dist}"/../src/scripts
|
|
272
|
-
|
|
273
|
-
# shellcheck source=.
|
|
274
|
-
. "${scripts:?}"/ext/source.sh
|
|
275
|
-
. "${scripts:?}"/tools/add_tools.sh
|
|
276
|
-
. "${scripts:?}"/common.sh
|
|
277
|
-
. /etc/lsb-release
|
|
278
|
-
read_env
|
|
279
|
-
self_hosted_setup
|
|
280
|
-
setup_php
|
|
1
|
+
# Function to setup environment for self-hosted runners.
|
|
2
|
+
self_hosted_helper() {
|
|
3
|
+
if ! command -v sudo >/dev/null; then
|
|
4
|
+
apt-get update
|
|
5
|
+
apt-get install -y sudo || add_log "${cross:?}" "sudo" "Could not install sudo"
|
|
6
|
+
fi
|
|
7
|
+
if ! command -v apt-fast >/dev/null; then
|
|
8
|
+
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
|
|
9
|
+
trap "sudo rm -f /usr/bin/apt-fast 2>/dev/null" exit
|
|
10
|
+
fi
|
|
11
|
+
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Function to install a package
|
|
15
|
+
install_packages() {
|
|
16
|
+
packages=("$@")
|
|
17
|
+
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Function to disable an extension.
|
|
21
|
+
disable_extension_helper() {
|
|
22
|
+
local extension=$1
|
|
23
|
+
local disable_dependents=${2:-false}
|
|
24
|
+
if [ "$disable_dependents" = "true" ]; then
|
|
25
|
+
disable_extension_dependents "$extension"
|
|
26
|
+
fi
|
|
27
|
+
sudo sed -Ei "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file[@]}" "$pecl_file"
|
|
28
|
+
sudo find "$ini_dir"/.. -name "*$extension.ini" -not -path "*mods-available*" -delete >/dev/null 2>&1 || true
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Function to add PDO extension.
|
|
32
|
+
add_pdo_extension() {
|
|
33
|
+
pdo_ext="pdo_$1"
|
|
34
|
+
if check_extension "$pdo_ext"; then
|
|
35
|
+
add_log "${tick:?}" "$pdo_ext" "Enabled"
|
|
36
|
+
else
|
|
37
|
+
ext=$1
|
|
38
|
+
ext_name=$1
|
|
39
|
+
if shared_extension pdo; then
|
|
40
|
+
disable_extension_helper pdo
|
|
41
|
+
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
|
42
|
+
fi
|
|
43
|
+
if [ "$ext" = "mysql" ]; then
|
|
44
|
+
enable_extension "mysqlnd" "extension"
|
|
45
|
+
ext_name='mysqli'
|
|
46
|
+
elif [ "$ext" = "dblib" ]; then
|
|
47
|
+
ext_name="sybase"
|
|
48
|
+
elif [ "$ext" = "firebird" ]; then
|
|
49
|
+
install_packages libfbclient2 >/dev/null 2>&1
|
|
50
|
+
enable_extension "pdo_firebird" "extension"
|
|
51
|
+
ext_name="interbase"
|
|
52
|
+
elif [ "$ext" = "sqlite" ]; then
|
|
53
|
+
ext="sqlite3"
|
|
54
|
+
ext_name="sqlite3"
|
|
55
|
+
fi
|
|
56
|
+
add_extension "$ext_name" "extension" >/dev/null 2>&1
|
|
57
|
+
add_extension "$pdo_ext" "extension" >/dev/null 2>&1
|
|
58
|
+
add_extension_log "$pdo_ext" "Enabled"
|
|
59
|
+
fi
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Function to check if a package exists
|
|
63
|
+
check_package() {
|
|
64
|
+
sudo apt-cache policy "$1" 2>/dev/null | grep -q 'Candidate'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Function to add extensions.
|
|
68
|
+
add_extension() {
|
|
69
|
+
local extension=$1
|
|
70
|
+
prefix=$2
|
|
71
|
+
package=php"$version"-"$extension"
|
|
72
|
+
enable_extension "$extension" "$prefix"
|
|
73
|
+
if check_extension "$extension"; then
|
|
74
|
+
add_log "${tick:?}" "$extension" "Enabled"
|
|
75
|
+
else
|
|
76
|
+
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
77
|
+
(check_package "$package" && install_packages "$package") || pecl_install "$extension"
|
|
78
|
+
add_extension_log "$extension" "Installed and enabled"
|
|
79
|
+
fi
|
|
80
|
+
sudo chmod 777 "${ini_file[@]}"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Function to setup phpize and php-config.
|
|
84
|
+
add_devtools() {
|
|
85
|
+
tool=$1
|
|
86
|
+
if ! command -v "$tool$version" >/dev/null; then
|
|
87
|
+
install_packages "php$version-dev" "php$version-xml"
|
|
88
|
+
fi
|
|
89
|
+
switch_version "phpize" "php-config"
|
|
90
|
+
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Function to setup the nightly build from shivammathur/php-builder
|
|
94
|
+
setup_nightly() {
|
|
95
|
+
run_script "php-builder" "${runner:?}" "$version"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
|
99
|
+
setup_old_versions() {
|
|
100
|
+
run_script "php5-ubuntu" "$version"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# Function to add PECL.
|
|
104
|
+
add_pecl() {
|
|
105
|
+
add_devtools phpize >/dev/null 2>&1
|
|
106
|
+
if ! command -v pecl >/dev/null; then
|
|
107
|
+
install_packages php-pear
|
|
108
|
+
fi
|
|
109
|
+
configure_pecl >/dev/null 2>&1
|
|
110
|
+
pear_version=$(get_tool_version "pecl" "version")
|
|
111
|
+
add_log "${tick:?}" "PECL" "Added PECL $pear_version"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Function to switch versions of PHP binaries.
|
|
115
|
+
switch_version() {
|
|
116
|
+
tools=("$@") && ! (( ${#tools[@]} )) && tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
|
|
117
|
+
to_wait=()
|
|
118
|
+
for tool in "${tools[@]}"; do
|
|
119
|
+
if [ -e "/usr/bin/$tool$version" ]; then
|
|
120
|
+
sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" &
|
|
121
|
+
to_wait+=($!)
|
|
122
|
+
fi
|
|
123
|
+
done
|
|
124
|
+
wait "${to_wait[@]}"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# Function to install packaged PHP
|
|
128
|
+
add_packaged_php() {
|
|
129
|
+
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
|
|
130
|
+
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
131
|
+
IFS=' ' read -r -a packages <<<"$(echo "cli curl dev mbstring xml intl" | sed "s/[^ ]*/php$version-&/g")"
|
|
132
|
+
install_packages "${packages[@]}"
|
|
133
|
+
else
|
|
134
|
+
run_script "php-ubuntu" "$version"
|
|
135
|
+
fi
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# Function to update PHP.
|
|
139
|
+
update_php() {
|
|
140
|
+
initial_version="$(php_semver)$(php_extra_version)"
|
|
141
|
+
add_php
|
|
142
|
+
updated_version="$(php_semver)$(php_extra_version)"
|
|
143
|
+
if [ "$updated_version" != "$initial_version" ]; then
|
|
144
|
+
status="Updated to"
|
|
145
|
+
else
|
|
146
|
+
status="Found"
|
|
147
|
+
fi
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
# Function to install PHP.
|
|
151
|
+
add_php() {
|
|
152
|
+
if [[ "$version" =~ ${nightly_versions:?} ]]; then
|
|
153
|
+
setup_nightly
|
|
154
|
+
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
|
155
|
+
setup_old_versions
|
|
156
|
+
else
|
|
157
|
+
add_packaged_php
|
|
158
|
+
switch_version >/dev/null 2>&1
|
|
159
|
+
fi
|
|
160
|
+
status="Installed"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# Function to ini file for pear and link it to each SAPI.
|
|
164
|
+
link_pecl_file() {
|
|
165
|
+
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
|
166
|
+
for file in "${ini_file[@]}"; do
|
|
167
|
+
sapi_scan_dir="$(realpath -m "$(dirname "$file")")/conf.d"
|
|
168
|
+
[ "$sapi_scan_dir" != "$scan_dir" ] && ! [ -h "$sapi_scan_dir" ] && sudo ln -sf "$pecl_file" "$sapi_scan_dir/99-pecl.ini"
|
|
169
|
+
done
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Function to get extra version.
|
|
173
|
+
php_extra_version() {
|
|
174
|
+
if [ -e /etc/php/"$version"/COMMIT ]; then
|
|
175
|
+
echo " ($(cat "/etc/php/$version/COMMIT"))"
|
|
176
|
+
fi
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# Function to Setup PHP
|
|
180
|
+
setup_php() {
|
|
181
|
+
step_log "Setup PHP"
|
|
182
|
+
sudo mkdir -m 777 -p /var/run /run/php
|
|
183
|
+
if [ "$(php-config --version 2>/dev/null | cut -c 1-3)" != "$version" ]; then
|
|
184
|
+
if [ ! -e "/usr/bin/php$version" ]; then
|
|
185
|
+
add_php >/dev/null 2>&1
|
|
186
|
+
else
|
|
187
|
+
if ! [[ "$version" =~ ${old_versions:?} ]]; then
|
|
188
|
+
switch_version >/dev/null 2>&1
|
|
189
|
+
fi
|
|
190
|
+
if [ "${update:?}" = "true" ]; then
|
|
191
|
+
update_php >/dev/null 2>&1
|
|
192
|
+
else
|
|
193
|
+
status="Switched to"
|
|
194
|
+
fi
|
|
195
|
+
fi
|
|
196
|
+
else
|
|
197
|
+
if [ "$update" = "true" ]; then
|
|
198
|
+
update_php >/dev/null 2>&1
|
|
199
|
+
else
|
|
200
|
+
status="Found"
|
|
201
|
+
fi
|
|
202
|
+
fi
|
|
203
|
+
if ! command -v php"$version" >/dev/null; then
|
|
204
|
+
add_log "$cross" "PHP" "Could not setup PHP $version"
|
|
205
|
+
exit 1
|
|
206
|
+
fi
|
|
207
|
+
semver=$(php_semver)
|
|
208
|
+
extra_version=$(php_extra_version)
|
|
209
|
+
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
|
210
|
+
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|
211
|
+
ini_dir=$(php --ini | grep "(php.ini)" | sed -e "s|.*: s*||")
|
|
212
|
+
pecl_file="$scan_dir"/99-pecl.ini
|
|
213
|
+
export ext_dir
|
|
214
|
+
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
|
|
215
|
+
link_pecl_file
|
|
216
|
+
configure_php
|
|
217
|
+
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
|
218
|
+
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
|
|
219
|
+
sudo cp "$dist"/../src/configs/pm/*.json "$RUNNER_TOOL_CACHE/"
|
|
220
|
+
echo "::set-output name=php-version::$semver"
|
|
221
|
+
add_log "${tick:?}" "PHP" "$status PHP $semver$extra_version"
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# Variables
|
|
225
|
+
version=$1
|
|
226
|
+
dist=$2
|
|
227
|
+
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|
228
|
+
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
|
|
229
|
+
scripts="${dist}"/../src/scripts
|
|
230
|
+
|
|
231
|
+
. /etc/os-release
|
|
232
|
+
# shellcheck source=.
|
|
233
|
+
. "${scripts:?}"/ext/source.sh
|
|
234
|
+
. "${scripts:?}"/tools/ppa.sh
|
|
235
|
+
. "${scripts:?}"/tools/add_tools.sh
|
|
236
|
+
. "${scripts:?}"/common.sh
|
|
237
|
+
read_env
|
|
238
|
+
self_hosted_setup
|
|
239
|
+
setup_php
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
Function Add-ToolsHelper() {
|
|
2
|
-
Param (
|
|
3
|
-
[Parameter(Position = 0, Mandatory = $true)]
|
|
4
|
-
[ValidateNotNull()]
|
|
5
|
-
$tool
|
|
6
|
-
)
|
|
7
|
-
if($tool -eq "codeception") {
|
|
8
|
-
Copy-Item $composer_bin\codecept.bat -Destination $composer_bin\codeception.bat
|
|
9
|
-
} elseif($tool -eq "composer") {
|
|
10
|
-
Edit-ComposerConfig $bin_dir\$tool
|
|
11
|
-
} elseif($tool -eq "cs2pr") {
|
|
12
|
-
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
|
|
13
|
-
} elseif($tool -eq "phan") {
|
|
14
|
-
Add-Extension fileinfo >$null 2>&1
|
|
15
|
-
Add-Extension ast >$null 2>&1
|
|
16
|
-
} elseif($tool -eq "phive") {
|
|
17
|
-
Add-Extension xml >$null 2>&1
|
|
18
|
-
} elseif($tool -eq "
|
|
19
|
-
Add-
|
|
20
|
-
|
|
21
|
-
} elseif($tool -
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
Function Add-ToolsHelper() {
|
|
2
|
+
Param (
|
|
3
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
4
|
+
[ValidateNotNull()]
|
|
5
|
+
$tool
|
|
6
|
+
)
|
|
7
|
+
if($tool -eq "codeception") {
|
|
8
|
+
Copy-Item $composer_bin\codecept.bat -Destination $composer_bin\codeception.bat
|
|
9
|
+
} elseif($tool -eq "composer") {
|
|
10
|
+
Edit-ComposerConfig $bin_dir\$tool
|
|
11
|
+
} elseif($tool -eq "cs2pr") {
|
|
12
|
+
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
|
|
13
|
+
} elseif($tool -eq "phan") {
|
|
14
|
+
Add-Extension fileinfo >$null 2>&1
|
|
15
|
+
Add-Extension ast >$null 2>&1
|
|
16
|
+
} elseif($tool -eq "phive") {
|
|
17
|
+
Add-Extension xml >$null 2>&1
|
|
18
|
+
} elseif($tool -eq "phpDocumentor") {
|
|
19
|
+
Add-Extension fileinfo >$null 2>&1
|
|
20
|
+
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
|
21
|
+
} elseif($tool -eq "symfony-cli") {
|
|
22
|
+
Add-ToProfile $current_profile "symfony" "New-Alias symfony $bin_dir\symfony-cli.exe"
|
|
23
|
+
Add-ToProfile $current_profile "symfony_cli" "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
|
24
|
+
} elseif($tool -match "vapor-cli") {
|
|
25
|
+
Copy-Item $composer_bin\vapor.bat -Destination $composer_bin\vapor-cli.bat
|
|
26
|
+
} elseif($tool -eq "wp-cli") {
|
|
27
|
+
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
|
28
|
+
}
|
|
26
29
|
}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
add_tools_helper() {
|
|
2
|
-
tool=$1
|
|
3
|
-
if [ "$tool" = "codeception" ]; then
|
|
4
|
-
sudo ln -s "${composer_bin:?}"/codecept "${composer_bin:?}"/codeception
|
|
5
|
-
elif [ "$tool" = "composer" ]; then
|
|
6
|
-
configure_composer "${tool_path:?}"
|
|
7
|
-
elif [ "$tool" = "cs2pr" ]; then
|
|
8
|
-
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}" 2>/dev/null ||
|
|
9
|
-
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}"
|
|
10
|
-
elif [ "$tool" = "phan" ]; then
|
|
11
|
-
add_extension fileinfo extension >/dev/null 2>&1
|
|
12
|
-
add_extension ast extension >/dev/null 2>&1
|
|
13
|
-
elif [ "$tool" = "phive" ]; then
|
|
14
|
-
add_extension curl extension >/dev/null 2>&1
|
|
15
|
-
add_extension mbstring extension >/dev/null 2>&1
|
|
16
|
-
add_extension xml extension >/dev/null 2>&1
|
|
17
|
-
elif [
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
add_tools_helper() {
|
|
2
|
+
tool=$1
|
|
3
|
+
if [ "$tool" = "codeception" ]; then
|
|
4
|
+
sudo ln -s "${composer_bin:?}"/codecept "${composer_bin:?}"/codeception
|
|
5
|
+
elif [ "$tool" = "composer" ]; then
|
|
6
|
+
configure_composer "${tool_path:?}"
|
|
7
|
+
elif [ "$tool" = "cs2pr" ]; then
|
|
8
|
+
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}" 2>/dev/null ||
|
|
9
|
+
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "${tool_path:?}"
|
|
10
|
+
elif [ "$tool" = "phan" ]; then
|
|
11
|
+
add_extension fileinfo extension >/dev/null 2>&1
|
|
12
|
+
add_extension ast extension >/dev/null 2>&1
|
|
13
|
+
elif [ "$tool" = "phive" ]; then
|
|
14
|
+
add_extension curl extension >/dev/null 2>&1
|
|
15
|
+
add_extension mbstring extension >/dev/null 2>&1
|
|
16
|
+
add_extension xml extension >/dev/null 2>&1
|
|
17
|
+
elif [ "$tool" = "phpDocumentor" ]; then
|
|
18
|
+
add_extension fileinfo extension >/dev/null 2>&1
|
|
19
|
+
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/phpdocumentor 2>/dev/null || true
|
|
20
|
+
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/phpdoc
|
|
21
|
+
elif [[ "$tool" =~ phpunit(-polyfills)?$ ]]; then
|
|
22
|
+
if [ -e "${tool_path_dir:?}"/phpunit ]; then
|
|
23
|
+
sudo cp "${tool_path_dir:?}"/phpunit "${composer_bin:?}"
|
|
24
|
+
fi
|
|
25
|
+
elif [[ "$tool" =~ (symfony|vapor|wp)-cli ]]; then
|
|
26
|
+
sudo ln -s "${tool_path:?}" "${tool_path_dir:?}"/"${tool%-*}"
|
|
27
|
+
fi
|
|
20
28
|
}
|