setup-php 2.31.1 → 2.33.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 +105 -100
- package/lib/config.js +17 -7
- package/lib/config.js.map +1 -1
- package/lib/coverage.js +17 -7
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.js +31 -21
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.js +17 -7
- package/lib/fetch.js.map +1 -1
- package/lib/install.js +17 -7
- package/lib/install.js.map +1 -1
- package/lib/packagist.js +17 -7
- package/lib/packagist.js.map +1 -1
- package/lib/tools.js +20 -7
- package/lib/tools.js.map +1 -1
- package/lib/utils.js +23 -10
- package/lib/utils.js.map +1 -1
- package/package.json +21 -18
- package/src/configs/mod_priority +1 -1
- package/src/configs/php-versions.json +4 -4
- package/src/configs/tools.json +7 -2
- package/src/extensions.ts +31 -31
- package/src/scripts/darwin.sh +10 -8
- 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 +9 -0
- package/src/scripts/extensions/source.sh +1 -1
- package/src/scripts/extensions/zephir_parser.ps1 +9 -2
- package/src/scripts/extensions/zephir_parser.sh +7 -3
- package/src/scripts/linux.sh +6 -5
- package/src/scripts/tools/add_tools.sh +0 -1
- package/src/scripts/tools/brew.sh +0 -1
- package/src/scripts/tools/grpc_php_plugin.ps1 +7 -1
- package/src/scripts/tools/ppa.sh +14 -11
- package/src/scripts/tools/protoc.sh +3 -1
- package/src/scripts/unix.sh +58 -1
- package/src/scripts/win32.ps1 +11 -2
- package/src/tools.ts +3 -0
- package/src/utils.ts +8 -3
package/src/scripts/unix.sh
CHANGED
|
@@ -55,6 +55,7 @@ read_env() {
|
|
|
55
55
|
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
|
56
56
|
[[ -z "${ImageOS}" && -z "${ImageVersion}" || -n ${ACT} ]] && _runner=self-hosted || _runner=github
|
|
57
57
|
runner="${runner:-${RUNNER:-$_runner}}"
|
|
58
|
+
tool_path_dir="${tools_dir:-${TOOLS_DIR:-/usr/local/bin}}"
|
|
58
59
|
|
|
59
60
|
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then
|
|
60
61
|
fail_fast=true
|
|
@@ -63,13 +64,45 @@ read_env() {
|
|
|
63
64
|
|
|
64
65
|
# Set Update to true if the ubuntu github image does not have PHP PPA.
|
|
65
66
|
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
|
66
|
-
check_ppa ondrej/php
|
|
67
|
+
if ! check_ppa ondrej/php; then
|
|
68
|
+
update=true
|
|
69
|
+
echo '' | sudo tee /tmp/sp_update >/dev/null 2>&1
|
|
70
|
+
elif [ -e /tmp/sp_update ]; then
|
|
71
|
+
update=true
|
|
72
|
+
fi
|
|
67
73
|
fi
|
|
68
74
|
|
|
69
75
|
export fail_fast
|
|
70
76
|
export runner
|
|
71
77
|
export update
|
|
72
78
|
export ts
|
|
79
|
+
export tools_dir_path
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Function to create a lock.
|
|
83
|
+
acquire_lock() {
|
|
84
|
+
lock_path="$1"
|
|
85
|
+
while true; do
|
|
86
|
+
if sudo mkdir "$lock_path" 2>/dev/null; then
|
|
87
|
+
echo $$ | sudo tee "$lock_path/pid" >/dev/null
|
|
88
|
+
return 0
|
|
89
|
+
else
|
|
90
|
+
if sudo test -f "$lock_path/pid"; then
|
|
91
|
+
lock_pid=$(sudo cat "$lock_path/pid")
|
|
92
|
+
if ! ps -p "$lock_pid" >/dev/null 2>&1; then
|
|
93
|
+
sudo rm -rf "$lock_path"
|
|
94
|
+
continue
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
sleep 1
|
|
98
|
+
fi
|
|
99
|
+
done
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# Function to release the lock.
|
|
103
|
+
release_lock() {
|
|
104
|
+
lock_path="$1"
|
|
105
|
+
sudo rm -rf "$lock_path"
|
|
73
106
|
}
|
|
74
107
|
|
|
75
108
|
# Function to download a file using cURL.
|
|
@@ -84,12 +117,23 @@ get() {
|
|
|
84
117
|
if [ "$mode" = "-s" ]; then
|
|
85
118
|
sudo curl "${curl_opts[@]}" "${links[0]}"
|
|
86
119
|
else
|
|
120
|
+
if [ "$runner" = "self-hosted" ]; then
|
|
121
|
+
lock_path="$file_path.lock"
|
|
122
|
+
acquire_lock "$lock_path"
|
|
123
|
+
if [ "$execute" = "-e" ]; then
|
|
124
|
+
until [ -z "$(fuser "$file_path" 2>/dev/null)" ]; do
|
|
125
|
+
sleep 1
|
|
126
|
+
done
|
|
127
|
+
fi
|
|
128
|
+
trap 'release_lock "$lock_path"' EXIT SIGINT SIGTERM
|
|
129
|
+
fi
|
|
87
130
|
for link in "${links[@]}"; do
|
|
88
131
|
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
|
|
89
132
|
[ "$status_code" = "200" ] && break
|
|
90
133
|
done
|
|
91
134
|
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
|
|
92
135
|
[ "$mode" = "-v" ] && echo "$status_code"
|
|
136
|
+
[ "$runner" = "self-hosted" ] && release_lock "$lock_path"
|
|
93
137
|
fi
|
|
94
138
|
}
|
|
95
139
|
|
|
@@ -168,6 +212,19 @@ self_hosted_setup() {
|
|
|
168
212
|
fi
|
|
169
213
|
}
|
|
170
214
|
|
|
215
|
+
# Function to check pre-installed PHP
|
|
216
|
+
check_pre_installed() {
|
|
217
|
+
if [ "$version" = "pre" ]; then
|
|
218
|
+
if [ -n "$php_config" ]; then
|
|
219
|
+
version="$(php_semver | cut -c 1-3)"
|
|
220
|
+
update=false
|
|
221
|
+
else
|
|
222
|
+
fail_fast=true
|
|
223
|
+
add_log "$cross" "PHP" "No pre-installed PHP version found"
|
|
224
|
+
fi
|
|
225
|
+
fi
|
|
226
|
+
}
|
|
227
|
+
|
|
171
228
|
# Function to configure PHP
|
|
172
229
|
configure_php() {
|
|
173
230
|
add_php_config
|
package/src/scripts/win32.ps1
CHANGED
|
@@ -3,7 +3,7 @@ param (
|
|
|
3
3
|
[ValidateNotNull()]
|
|
4
4
|
[ValidateLength(1, [int]::MaxValue)]
|
|
5
5
|
[string]
|
|
6
|
-
$version = '8.
|
|
6
|
+
$version = '8.4',
|
|
7
7
|
[Parameter(Position = 1, Mandatory = $true)]
|
|
8
8
|
[ValidateNotNull()]
|
|
9
9
|
[ValidateLength(1, [int]::MaxValue)]
|
|
@@ -401,6 +401,15 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|
|
401
401
|
}
|
|
402
402
|
$status = "Installed"
|
|
403
403
|
$extra_version = ""
|
|
404
|
+
if($version -eq 'pre') {
|
|
405
|
+
if($null -ne $installed) {
|
|
406
|
+
$version = $installed.MajorMinorVersion
|
|
407
|
+
$env:update = 'false'
|
|
408
|
+
} else {
|
|
409
|
+
Add-Log $cross "PHP" "No pre-installed PHP version found"
|
|
410
|
+
Write-Error "No pre-installed PHP version found" -ErrorAction Stop
|
|
411
|
+
}
|
|
412
|
+
}
|
|
404
413
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
|
405
414
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
|
406
415
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
|
@@ -434,7 +443,7 @@ if($installed.MajorMinorVersion -ne $version) {
|
|
|
434
443
|
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
|
435
444
|
}
|
|
436
445
|
if($version -lt "5.5") {
|
|
437
|
-
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel {
|
|
446
|
+
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
|
438
447
|
} else {
|
|
439
448
|
$enable_extensions += ('opcache')
|
|
440
449
|
}
|
package/src/tools.ts
CHANGED
|
@@ -422,6 +422,9 @@ export async function addPHPUnitTools(data: RS): Promise<string> {
|
|
|
422
422
|
'latest';
|
|
423
423
|
}
|
|
424
424
|
data['url'] = await getPharUrl(data);
|
|
425
|
+
if (data['url'].match(/-\d+/)) {
|
|
426
|
+
data['url'] += ',' + data['url'].replace(/-(\d+)\.\d+\.\d+/, '-$1');
|
|
427
|
+
}
|
|
425
428
|
return await addArchive(data);
|
|
426
429
|
}
|
|
427
430
|
|
package/src/utils.ts
CHANGED
|
@@ -436,12 +436,17 @@ export async function readPHPVersion(): Promise<string> {
|
|
|
436
436
|
const versionFile =
|
|
437
437
|
(await getInput('php-version-file', false)) || '.php-version';
|
|
438
438
|
if (fs.existsSync(versionFile)) {
|
|
439
|
-
|
|
439
|
+
const contents: string = fs.readFileSync(versionFile, 'utf8');
|
|
440
|
+
const match: RegExpMatchArray | null = contents.match(
|
|
441
|
+
/^(?:php\s)?(\d+\.\d+\.\d+)$/m
|
|
442
|
+
);
|
|
443
|
+
return match ? match[1] : contents.trim();
|
|
440
444
|
} else if (versionFile !== '.php-version') {
|
|
441
445
|
throw new Error(`Could not find '${versionFile}' file.`);
|
|
442
446
|
}
|
|
443
447
|
|
|
444
|
-
const
|
|
448
|
+
const composerProjectDir = await readEnv('COMPOSER_PROJECT_DIR');
|
|
449
|
+
const composerLock = path.join(composerProjectDir, 'composer.lock');
|
|
445
450
|
if (fs.existsSync(composerLock)) {
|
|
446
451
|
const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
|
|
447
452
|
if (
|
|
@@ -452,7 +457,7 @@ export async function readPHPVersion(): Promise<string> {
|
|
|
452
457
|
}
|
|
453
458
|
}
|
|
454
459
|
|
|
455
|
-
const composerJson = 'composer.json';
|
|
460
|
+
const composerJson = path.join(composerProjectDir, 'composer.json');
|
|
456
461
|
if (fs.existsSync(composerJson)) {
|
|
457
462
|
const composerFileContents = JSON.parse(
|
|
458
463
|
fs.readFileSync(composerJson, 'utf8')
|