setup-php 2.32.0 → 2.34.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/README.md +65 -53
- package/lib/extensions.js +12 -12
- package/lib/tools.js +6 -0
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +13 -4
- package/lib/utils.js.map +1 -1
- package/package.json +16 -16
- package/src/configs/mod_priority +1 -1
- package/src/configs/os_releases.csv +2 -0
- package/src/configs/tools.json +11 -3
- package/src/extensions.ts +27 -27
- package/src/scripts/darwin.sh +9 -3
- package/src/scripts/extensions/add_extensions.ps1 +4 -0
- package/src/scripts/extensions/couchbase.sh +1 -1
- package/src/scripts/extensions/firebird.sh +1 -0
- package/src/scripts/extensions/intl.sh +6 -3
- package/src/scripts/extensions/oci.ps1 +10 -14
- package/src/scripts/extensions/oci.sh +14 -6
- package/src/scripts/extensions/patches/common.sh +2 -2
- package/src/scripts/extensions/phalcon.ps1 +2 -2
- package/src/scripts/extensions/phalcon.sh +1 -1
- package/src/scripts/extensions/relay.sh +15 -1
- package/src/scripts/extensions/source.sh +6 -4
- package/src/scripts/extensions/zephir_parser.ps1 +9 -2
- package/src/scripts/extensions/zephir_parser.sh +7 -3
- package/src/scripts/linux.sh +1 -1
- package/src/scripts/tools/add_tools.ps1 +5 -0
- package/src/scripts/tools/add_tools.sh +5 -1
- package/src/scripts/tools/grpc_php_plugin.ps1 +7 -1
- package/src/scripts/tools/ppa.sh +14 -9
- package/src/scripts/tools/protoc.sh +3 -1
- package/src/scripts/unix.sh +53 -11
- package/src/tools.ts +6 -0
- package/src/utils.ts +12 -5
package/src/scripts/unix.sh
CHANGED
|
@@ -53,8 +53,11 @@ read_env() {
|
|
|
53
53
|
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
|
54
54
|
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
|
|
55
55
|
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
|
56
|
-
[[ -z "$
|
|
56
|
+
[[ ( -z "$ImageOS" && -z "$ImageVersion" ) ||
|
|
57
|
+
( -n "$RUNNER_ENVIRONMENT" && "$RUNNER_ENVIRONMENT" = "self-hosted" ) ||
|
|
58
|
+
-n "$ACT" || -n "$CONTAINER" ]] && _runner=self-hosted || _runner=github
|
|
57
59
|
runner="${runner:-${RUNNER:-$_runner}}"
|
|
60
|
+
tool_path_dir="${setup_php_tools_dir:-${SETUP_PHP_TOOLS_DIR:-/usr/local/bin}}"
|
|
58
61
|
|
|
59
62
|
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
|
60
63
|
fail_fast=true
|
|
@@ -75,6 +78,45 @@ read_env() {
|
|
|
75
78
|
export runner
|
|
76
79
|
export update
|
|
77
80
|
export ts
|
|
81
|
+
export tool_path_dir
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# Function to create a lock.
|
|
85
|
+
acquire_lock() {
|
|
86
|
+
lock_path="$1"
|
|
87
|
+
while true; do
|
|
88
|
+
if sudo mkdir "$lock_path" 2>/dev/null; then
|
|
89
|
+
echo $$ | sudo tee "$lock_path/pid" >/dev/null
|
|
90
|
+
return 0
|
|
91
|
+
else
|
|
92
|
+
if sudo test -f "$lock_path/pid"; then
|
|
93
|
+
lock_pid=$(sudo cat "$lock_path/pid")
|
|
94
|
+
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
|
|
95
|
+
sudo rm -rf "$lock_path"
|
|
96
|
+
continue
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
sleep 1
|
|
100
|
+
fi
|
|
101
|
+
done
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Function to release the lock.
|
|
105
|
+
release_lock() {
|
|
106
|
+
lock_path="$1"
|
|
107
|
+
sudo rm -rf "$lock_path"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# Function to get the SHA256 hash of a string.
|
|
111
|
+
get_sha256() {
|
|
112
|
+
local input=$1
|
|
113
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
114
|
+
printf '%s' "$input" | sha256sum | cut -d' ' -f1
|
|
115
|
+
elif command -v shasum >/dev/null 2>&1; then
|
|
116
|
+
printf '%s' "$input" | shasum -a 256 | cut -d' ' -f1
|
|
117
|
+
elif command -v openssl >/dev/null 2>&1; then
|
|
118
|
+
printf '%s' "$input" | openssl dgst -sha256 | cut -d' ' -f2
|
|
119
|
+
fi
|
|
78
120
|
}
|
|
79
121
|
|
|
80
122
|
# Function to download a file using cURL.
|
|
@@ -89,23 +131,23 @@ get() {
|
|
|
89
131
|
if [ "$mode" = "-s" ]; then
|
|
90
132
|
sudo curl "${curl_opts[@]}" "${links[0]}"
|
|
91
133
|
else
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
134
|
+
if [ "$runner" = "self-hosted" ]; then
|
|
135
|
+
lock_path="/tmp/sp-lck-$(get_sha256 "$file_path")"
|
|
136
|
+
acquire_lock "$lock_path"
|
|
137
|
+
if [ "$execute" = "-e" ]; then
|
|
138
|
+
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
|
139
|
+
sleep 1
|
|
140
|
+
done
|
|
141
|
+
fi
|
|
142
|
+
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
|
|
100
143
|
fi
|
|
101
|
-
trap 'sudo rm -rf "$lock_path"' EXIT SIGINT SIGTERM
|
|
102
144
|
for link in "${links[@]}"; do
|
|
103
145
|
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
|
104
146
|
[ "$status_code" = "200" ] && break
|
|
105
147
|
done
|
|
106
148
|
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
|
107
149
|
[ "$mode" = "-v" ] && echo "$status_code"
|
|
108
|
-
|
|
150
|
+
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
|
|
109
151
|
fi
|
|
110
152
|
}
|
|
111
153
|
|
package/src/tools.ts
CHANGED
|
@@ -401,6 +401,9 @@ export async function addPhive(data: RS): Promise<string> {
|
|
|
401
401
|
case /7\.2/.test(data['php_version']):
|
|
402
402
|
data['version'] = '0.14.5';
|
|
403
403
|
break;
|
|
404
|
+
case /7\.3|7\.4/.test(data['php_version']):
|
|
405
|
+
data['version'] = '0.15.3';
|
|
406
|
+
break;
|
|
404
407
|
case /^latest$/.test(data['version']):
|
|
405
408
|
data['version'] = await getLatestVersion(data);
|
|
406
409
|
break;
|
|
@@ -422,6 +425,9 @@ export async function addPHPUnitTools(data: RS): Promise<string> {
|
|
|
422
425
|
'latest';
|
|
423
426
|
}
|
|
424
427
|
data['url'] = await getPharUrl(data);
|
|
428
|
+
if (data['url'].match(/-\d+/)) {
|
|
429
|
+
data['url'] += ',' + data['url'].replace(/-(\d+)\.\d+\.\d+/, '-$1');
|
|
430
|
+
}
|
|
425
431
|
return await addArchive(data);
|
|
426
432
|
}
|
|
427
433
|
|
package/src/utils.ts
CHANGED
|
@@ -48,8 +48,11 @@ export async function getInput(
|
|
|
48
48
|
/**
|
|
49
49
|
* Function to get manifest URL
|
|
50
50
|
*/
|
|
51
|
-
export async function
|
|
52
|
-
return
|
|
51
|
+
export async function getManifestURLS(): Promise<string[]> {
|
|
52
|
+
return [
|
|
53
|
+
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json',
|
|
54
|
+
'https://setup-php.com/php-versions.json'
|
|
55
|
+
];
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/**
|
|
@@ -60,9 +63,13 @@ export async function getManifestURL(): Promise<string> {
|
|
|
60
63
|
export async function parseVersion(version: string): Promise<string> {
|
|
61
64
|
switch (true) {
|
|
62
65
|
case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
for (const manifestURL of await getManifestURLS()) {
|
|
67
|
+
const fetchResult = await fetch.fetch(manifestURL);
|
|
68
|
+
if (fetchResult['data'] ?? false) {
|
|
69
|
+
return JSON.parse(fetchResult['data'])[version];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new Error(`Could not fetch the PHP version manifest.`);
|
|
66
73
|
default:
|
|
67
74
|
switch (true) {
|
|
68
75
|
case version.length > 1:
|