setup-php 2.21.2 → 2.22.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 +21 -1
- package/package.json +13 -13
- package/src/configs/composer.env +1 -0
- package/src/configs/php_debug_packages +11 -0
- package/src/configs/tools.json +1 -1
- package/src/scripts/darwin.sh +7 -46
- package/src/scripts/extensions/add_extensions.sh +4 -1
- package/src/scripts/extensions/couchbase.sh +2 -2
- package/src/scripts/extensions/firebird.sh +2 -1
- package/src/scripts/extensions/phalcon.ps1 +21 -10
- package/src/scripts/extensions/phalcon.sh +4 -5
- package/src/scripts/extensions/source.sh +1 -0
- package/src/scripts/extensions/sqlsrv.sh +1 -1
- package/src/scripts/linux.sh +17 -8
- package/src/scripts/tools/brew.sh +83 -0
- package/src/scripts/tools/grpc_php_plugin.sh +2 -0
- package/src/scripts/tools/ppa.sh +16 -0
- package/src/scripts/tools/symfony.sh +26 -7
- package/src/scripts/unix.sh +13 -1
- package/src/scripts/win32.ps1 +19 -1
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|
|
42
42
|
- [Basic Setup](#basic-setup)
|
|
43
43
|
- [Matrix Setup](#matrix-setup)
|
|
44
44
|
- [Nightly Build Setup](#nightly-build-setup)
|
|
45
|
+
- [Debug Build Setup](#debug-build-setup)
|
|
45
46
|
- [Thread Safe Setup](#thread-safe-setup)
|
|
46
47
|
- [Force Update Setup](#force-update-setup)
|
|
47
48
|
- [Verbose Setup](#verbose-setup)
|
|
@@ -309,6 +310,7 @@ These tools can be set up globally using the `tools` input. It accepts a string
|
|
|
309
310
|
- Input `tools` is useful to set up tools which are only used in CI workflows, thus keeping your `composer.json` tidy.
|
|
310
311
|
- If you do not want to use all your dev-dependencies in workflow, you can run composer with `--no-dev` and install required tools using `tools` input to speed up your workflow.
|
|
311
312
|
- By default, `COMPOSER_NO_INTERACTION` is set to `1` and `COMPOSER_PROCESS_TIMEOUT` is set to `0`. In effect, this means that Composer commands in your scripts do not need to specify `--no-interaction`.
|
|
313
|
+
- Also, `COMPOSER_NO_AUDIT` is set to `1`. So if you want to audit your dependencies for security vulnerabilities, it is recommended to add a `composer audit` step before you install them.
|
|
312
314
|
|
|
313
315
|
## :signal_strength: Coverage Support
|
|
314
316
|
|
|
@@ -539,6 +541,23 @@ steps:
|
|
|
539
541
|
tools: php-cs-fixer, phpunit
|
|
540
542
|
```
|
|
541
543
|
|
|
544
|
+
### Debug Build Setup
|
|
545
|
+
|
|
546
|
+
> Set up a PHP build with debugging symbols.
|
|
547
|
+
|
|
548
|
+
- Production release builds of PHP without debugging symbols are set up by default.
|
|
549
|
+
- You can use the `debug` environment variable to set up a build with debugging symbols for PHP 5.6 and above.
|
|
550
|
+
|
|
551
|
+
```yaml
|
|
552
|
+
steps:
|
|
553
|
+
- name: Setup PHP with debugging symbols
|
|
554
|
+
uses: shivammathur/setup-php@v2
|
|
555
|
+
with:
|
|
556
|
+
php-version: '8.1'
|
|
557
|
+
env:
|
|
558
|
+
debug: true # specify true or false
|
|
559
|
+
```
|
|
560
|
+
|
|
542
561
|
### Thread Safe Setup
|
|
543
562
|
|
|
544
563
|
> Set up `TS` or `NTS` PHP on `Windows`.
|
|
@@ -566,6 +585,7 @@ jobs:
|
|
|
566
585
|
> Update to the latest patch of PHP versions.
|
|
567
586
|
|
|
568
587
|
- Pre-installed PHP versions are not updated to their latest patch release by default.
|
|
588
|
+
- If `ppa:ondrej/php` is missing on the Ubuntu GitHub environment, the PHP version is updated to the latest patch release.
|
|
569
589
|
- You can specify the `update` environment variable to `true` for updating to the latest release.
|
|
570
590
|
|
|
571
591
|
```yaml
|
|
@@ -713,7 +733,7 @@ If your project uses composer, you can persist the composer's internal cache dir
|
|
|
713
733
|
```yaml
|
|
714
734
|
- name: Get composer cache directory
|
|
715
735
|
id: composer-cache
|
|
716
|
-
run: echo "
|
|
736
|
+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
717
737
|
|
|
718
738
|
- name: Cache dependencies
|
|
719
739
|
uses: actions/cache@v2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "setup-php",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Setup PHP for use with GitHub Actions",
|
|
6
6
|
"main": "lib/install.js",
|
|
@@ -34,28 +34,28 @@
|
|
|
34
34
|
"author": "shivammathur",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@actions/core": "^1.
|
|
37
|
+
"@actions/core": "^1.10.0",
|
|
38
38
|
"@actions/exec": "^1.1.1",
|
|
39
39
|
"@actions/io": "^1.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/jest": "^
|
|
43
|
-
"@types/node": "^18.7
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
45
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
+
"@types/jest": "^29.2.0",
|
|
43
|
+
"@types/node": "^18.11.7",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
45
|
+
"@typescript-eslint/parser": "^5.41.0",
|
|
46
46
|
"@vercel/ncc": "^0.34.0",
|
|
47
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.26.0",
|
|
48
48
|
"eslint-config-prettier": "^8.5.0",
|
|
49
49
|
"eslint-plugin-import": "^2.26.0",
|
|
50
|
-
"eslint-plugin-jest": "^
|
|
50
|
+
"eslint-plugin-jest": "^27.1.3",
|
|
51
51
|
"eslint-plugin-prettier": "^4.2.1",
|
|
52
|
-
"jest": "^
|
|
53
|
-
"jest-circus": "^
|
|
52
|
+
"jest": "^29.2.2",
|
|
53
|
+
"jest-circus": "^29.2.2",
|
|
54
54
|
"nock": "^13.2.9",
|
|
55
55
|
"prettier": "^2.7.1",
|
|
56
|
-
"simple-git-hooks": "^2.8.
|
|
57
|
-
"ts-jest": "^
|
|
58
|
-
"typescript": "^4.
|
|
56
|
+
"simple-git-hooks": "^2.8.1",
|
|
57
|
+
"ts-jest": "^29.0.3",
|
|
58
|
+
"typescript": "^4.8.4"
|
|
59
59
|
},
|
|
60
60
|
"bugs": {
|
|
61
61
|
"url": "https://github.com/shivammathur/setup-php/issues"
|
package/src/configs/composer.env
CHANGED
package/src/configs/tools.json
CHANGED
package/src/scripts/darwin.sh
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
# Function to setup environment for self-hosted runners.
|
|
2
|
-
self_hosted_helper() {
|
|
3
|
-
if ! command -v brew >/dev/null; then
|
|
4
|
-
step_log "Setup Brew"
|
|
5
|
-
get -q -e "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" && /tmp/install.sh >/dev/null 2>&1
|
|
6
|
-
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
|
7
|
-
fi
|
|
8
|
-
}
|
|
9
|
-
|
|
10
1
|
# Disable dependency extensions
|
|
11
2
|
disable_dependency_extensions() {
|
|
12
3
|
local extension=$1
|
|
13
|
-
formula_file="$tap_dir/$ext_tap/Formula/$extension@${version:?}.rb"
|
|
4
|
+
formula_file="${tap_dir:?}/$ext_tap/Formula/$extension@${version:?}.rb"
|
|
14
5
|
if [ -e "$formula_file" ]; then
|
|
15
6
|
IFS=" " read -r -a dependency_extensions <<< "$(grep -Eo "shivammathur.*@" "$formula_file" | xargs -I {} -n 1 basename '{}' | cut -d '@' -f 1 | tr '\n' ' ')"
|
|
16
7
|
for dependency_extension in "${dependency_extensions[@]}"; do
|
|
@@ -33,33 +24,6 @@ disable_extension_helper() {
|
|
|
33
24
|
echo '' | sudo tee /tmp/extdisabled/"$version"/"$extension" >/dev/null 2>&1
|
|
34
25
|
}
|
|
35
26
|
|
|
36
|
-
# Function to fetch a brew tap.
|
|
37
|
-
fetch_brew_tap() {
|
|
38
|
-
tap=$1
|
|
39
|
-
tap_user=$(dirname "$tap")
|
|
40
|
-
tap_name=$(basename "$tap")
|
|
41
|
-
mkdir -p "$tap_dir/$tap_user"
|
|
42
|
-
get -s -n "" "https://github.com/$tap/archive/master.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user"
|
|
43
|
-
if [ -d "$tap_dir/$tap_user/$tap_name-master" ]; then
|
|
44
|
-
sudo mv "$tap_dir/$tap_user/$tap_name-master" "$tap_dir/$tap_user/$tap_name"
|
|
45
|
-
fi
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Function to add a brew tap.
|
|
49
|
-
add_brew_tap() {
|
|
50
|
-
tap=$1
|
|
51
|
-
if ! [ -d "$tap_dir/$tap" ]; then
|
|
52
|
-
if [ "${runner:?}" = "self-hosted" ]; then
|
|
53
|
-
brew tap "$tap" >/dev/null 2>&1
|
|
54
|
-
else
|
|
55
|
-
fetch_brew_tap "$tap" >/dev/null 2>&1
|
|
56
|
-
if ! [ -d "$tap_dir/$tap" ]; then
|
|
57
|
-
brew tap "$tap" >/dev/null 2>&1
|
|
58
|
-
fi
|
|
59
|
-
fi
|
|
60
|
-
fi
|
|
61
|
-
}
|
|
62
|
-
|
|
63
27
|
# Function to get extension name from brew formula.
|
|
64
28
|
get_extension_from_formula() {
|
|
65
29
|
local formula=$1
|
|
@@ -76,7 +40,7 @@ copy_brew_extensions() {
|
|
|
76
40
|
deps="$(grep -Eo 'depends_on "shivammathur[^"]+' "$formula_file" | cut -d '/' -f 3 | tr '\n' ' ')"
|
|
77
41
|
IFS=' ' read -r -a deps <<< "$formula@$version $deps"
|
|
78
42
|
for dependency in "${deps[@]}"; do
|
|
79
|
-
extension_file="$brew_prefix/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
|
|
43
|
+
extension_file="${brew_prefix:?}/opt/$dependency/$(get_extension_from_formula "${dependency%@*}").so"
|
|
80
44
|
[ -e "$extension_file" ] && sudo cp "$extension_file" "$ext_dir"
|
|
81
45
|
done
|
|
82
46
|
sudo find -- "$brew_prefix"/Cellar/"$formula"@"$version" -name "*.dylib" -exec cp {} "$ext_dir" \;
|
|
@@ -93,7 +57,7 @@ add_brew_extension() {
|
|
|
93
57
|
else
|
|
94
58
|
add_brew_tap "$php_tap"
|
|
95
59
|
add_brew_tap "$ext_tap"
|
|
96
|
-
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "$core_repo/Formula/" 2>/dev/null || true
|
|
60
|
+
sudo mv "$tap_dir"/"$ext_tap"/.github/deps/"$formula"/* "${core_repo:?}/Formula/" 2>/dev/null || true
|
|
97
61
|
update_dependencies >/dev/null 2>&1
|
|
98
62
|
disable_dependency_extensions "$extension" >/dev/null 2>&1
|
|
99
63
|
brew install -f "$ext_tap/$formula@$version" >/dev/null 2>&1
|
|
@@ -142,7 +106,7 @@ link_libraries() {
|
|
|
142
106
|
|
|
143
107
|
# Patch brew to overwrite packages.
|
|
144
108
|
patch_brew() {
|
|
145
|
-
formula_installer="$brew_repo"/Library/Homebrew/formula_installer.rb
|
|
109
|
+
formula_installer="${brew_repo:?}"/Library/Homebrew/formula_installer.rb
|
|
146
110
|
code=" keg.link\(verbose: verbose\?"
|
|
147
111
|
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
|
|
148
112
|
# shellcheck disable=SC2064
|
|
@@ -200,6 +164,7 @@ add_php() {
|
|
|
200
164
|
existing_version=$2
|
|
201
165
|
add_brew_tap "$php_tap"
|
|
202
166
|
update_dependencies
|
|
167
|
+
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
|
|
203
168
|
if [ "$existing_version" != "false" ]; then
|
|
204
169
|
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
|
|
205
170
|
else
|
|
@@ -280,12 +245,6 @@ version=${1:-'8.1'}
|
|
|
280
245
|
ini=${2:-'production'}
|
|
281
246
|
src=${0%/*}/..
|
|
282
247
|
php_formula=shivammathur/php/php@"$version"
|
|
283
|
-
brew_path="$(command -v brew)"
|
|
284
|
-
brew_path_dir="$(dirname "$brew_path")"
|
|
285
|
-
brew_prefix="$brew_path_dir"/..
|
|
286
|
-
brew_repo="$brew_path_dir/$(dirname "$(readlink "$brew_path")")"/..
|
|
287
|
-
tap_dir="$brew_repo"/Library/Taps
|
|
288
|
-
core_repo="$tap_dir"/homebrew/homebrew-core
|
|
289
248
|
scripts="$src"/scripts
|
|
290
249
|
ext_tap=shivammathur/homebrew-extensions
|
|
291
250
|
php_tap=shivammathur/homebrew-php
|
|
@@ -298,9 +257,11 @@ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
|
|
298
257
|
|
|
299
258
|
# shellcheck source=.
|
|
300
259
|
. "${scripts:?}"/unix.sh
|
|
260
|
+
. "${scripts:?}"/tools/brew.sh
|
|
301
261
|
. "${scripts:?}"/tools/add_tools.sh
|
|
302
262
|
. "${scripts:?}"/extensions/source.sh
|
|
303
263
|
. "${scripts:?}"/extensions/add_extensions.sh
|
|
264
|
+
configure_brew
|
|
304
265
|
read_env
|
|
305
266
|
self_hosted_setup
|
|
306
267
|
setup_php
|
|
@@ -120,6 +120,7 @@ disable_all_shared() {
|
|
|
120
120
|
|
|
121
121
|
# Function to configure PECL.
|
|
122
122
|
configure_pecl() {
|
|
123
|
+
[ -z "${pecl_file:-${ini_file[@]}}" ] && return
|
|
123
124
|
if ! [ -e /tmp/pecl_config ]; then
|
|
124
125
|
for script in pear pecl; do
|
|
125
126
|
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
|
@@ -191,7 +192,9 @@ add_pecl_extension() {
|
|
|
191
192
|
disable_extension_helper "$extension" >/dev/null 2>&1
|
|
192
193
|
[ -n "$pecl_version" ] && pecl_version="-$pecl_version"
|
|
193
194
|
pecl_install "$extension$pecl_version" || add_extension "$extension" "$(get_extension_prefix "$extension")" >/dev/null 2>&1
|
|
194
|
-
|
|
195
|
+
extension_version="$(php -r "echo phpversion('$extension');")"
|
|
196
|
+
[ -n "$extension_version" ] && extension_version="-$extension_version"
|
|
197
|
+
add_extension_log "$extension$extension_version" "Installed and enabled"
|
|
195
198
|
fi
|
|
196
199
|
}
|
|
197
200
|
|
|
@@ -5,7 +5,7 @@ add_couchbase_clibs() {
|
|
|
5
5
|
if [[ "$ext" =~ couchbase-2.+ ]]; then
|
|
6
6
|
release="2.10.9"
|
|
7
7
|
else
|
|
8
|
-
release
|
|
8
|
+
release=$(get -s -n "" "$trunk"/latest | grep -Eo -m 1 "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1)
|
|
9
9
|
fi
|
|
10
10
|
[ "$VERSION_ID" = "22.04" ] && vid=20.04 || vid="$VERSION_ID"
|
|
11
11
|
[ "$VERSION_CODENAME" = "jammy" ] && vcn=focal || vcn="$VERSION_CODENAME"
|
|
@@ -69,7 +69,7 @@ add_couchbase() {
|
|
|
69
69
|
fi
|
|
70
70
|
else
|
|
71
71
|
if [ -e "${ext_dir:?}"/libcouchbase_php_core.dylib ]; then
|
|
72
|
-
sudo cp "${ext_dir:?}"/libcouchbase_php_core.dylib ${brew_prefix:?}/lib
|
|
72
|
+
sudo cp "${ext_dir:?}"/libcouchbase_php_core.dylib "${brew_prefix:?}"/lib
|
|
73
73
|
fi
|
|
74
74
|
add_brew_extension couchbase extension
|
|
75
75
|
fi
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
add_firebird_client_darwin() {
|
|
2
2
|
firebird_tag='R3_0_7'
|
|
3
|
-
pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/
|
|
3
|
+
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
|
|
4
|
+
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
|
|
4
5
|
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name"
|
|
5
6
|
sudo installer -pkg /tmp/firebird.pkg -target /
|
|
6
7
|
sudo mkdir -p /opt/firebird/include /opt/firebird/lib
|
|
@@ -6,16 +6,16 @@ Function Add-PhalconFromGitHub() {
|
|
|
6
6
|
[string]
|
|
7
7
|
$Semver
|
|
8
8
|
)
|
|
9
|
-
$domain = 'https://github.com'
|
|
9
|
+
$domain = 'https://api.github.com/repos'
|
|
10
10
|
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
|
|
11
|
-
$match = Invoke-
|
|
11
|
+
$match = $match = (Invoke-RestMethod -Uri "$domain/phalcon/cphalcon/releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=(.*phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
|
|
12
12
|
if($NULL -eq $match) {
|
|
13
13
|
$nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
|
|
14
|
-
$match = Invoke-
|
|
14
|
+
$match = (Invoke-RestMethod -Uri "$domain/phalcon/cphalcon/releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=(.*phalcon-php${version}${nts}-windows.*-x64.zip)"
|
|
15
15
|
}
|
|
16
16
|
if($NULL -ne $match) {
|
|
17
|
-
$
|
|
18
|
-
Invoke-WebRequest -Uri $
|
|
17
|
+
$zip_url = $match.Matches[0].Groups[1].Value
|
|
18
|
+
Invoke-WebRequest -Uri $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
|
|
19
19
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
|
|
20
20
|
Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
|
|
21
21
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
|
@@ -23,17 +23,28 @@ Function Add-PhalconFromGitHub() {
|
|
|
23
23
|
throw "Unable to get Phalcon release from the GitHub release"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
# Function to get phalcon semver.
|
|
28
|
+
Function Get-PhalconSemver() {
|
|
29
|
+
if($extension_version -eq '3') {
|
|
30
|
+
return '3.4.5'
|
|
31
|
+
} elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
|
|
32
|
+
return '4.1.0'
|
|
33
|
+
}
|
|
34
|
+
return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
# Function to install phalcon
|
|
27
38
|
Function Add-PhalconHelper() {
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
$semver = Get-PhalconSemver
|
|
40
|
+
if (($extension_version -eq '3') -or ($extension_version -eq '5')) {
|
|
41
|
+
Add-PhalconFromGitHub $semver
|
|
30
42
|
} elseif ($extension_version -eq '4') {
|
|
31
|
-
|
|
32
|
-
} elseif ($extension_version -eq '3') {
|
|
33
|
-
Add-PhalconFromGitHub -Semver 3.4.5
|
|
43
|
+
Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
|
|
47
|
+
# Function to add phalcon
|
|
37
48
|
Function Add-Phalcon() {
|
|
38
49
|
Param (
|
|
39
50
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# Helper function to get phalcon version
|
|
2
2
|
get_phalcon_version() {
|
|
3
3
|
if [ "$extension" = "phalcon5" ]; then
|
|
4
|
-
|
|
5
|
-
([ -n "$semver" ] && echo "$semver") || get_pecl_version phalcon rc 5
|
|
4
|
+
get_pecl_version phalcon stable 5
|
|
6
5
|
elif [ "$extension" = "phalcon4" ]; then
|
|
7
|
-
echo '4.1.
|
|
6
|
+
echo '4.1.2'
|
|
8
7
|
elif [ "$extension" = "phalcon3" ]; then
|
|
9
8
|
echo '3.4.5'
|
|
10
9
|
fi
|
|
@@ -33,7 +32,7 @@ add_phalcon_helper() {
|
|
|
33
32
|
package="php${version:?}-$extension"
|
|
34
33
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
35
34
|
[ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
|
|
36
|
-
(check_package "$package" && install_packages "$package") || add_phalcon_from_repo
|
|
35
|
+
(check_package "$package" && install_packages "$package") || pecl_install phalcon-"$(get_phalcon_version)" || add_phalcon_from_repo
|
|
37
36
|
fi
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -86,7 +85,7 @@ add_phalcon5() {
|
|
|
86
85
|
|
|
87
86
|
# Function to add phalcon.
|
|
88
87
|
add_phalcon() {
|
|
89
|
-
extension=$1
|
|
88
|
+
local extension=$1
|
|
90
89
|
status='Enabled'
|
|
91
90
|
extension_major_version=${extension: -1}
|
|
92
91
|
if [[ "$extension_major_version" =~ [3-5] ]]; then
|
|
@@ -146,6 +146,7 @@ add_extension_from_source() {
|
|
|
146
146
|
add_log "${cross:?}" "$source" "$source does not have a PHP extension"
|
|
147
147
|
else
|
|
148
148
|
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
|
149
|
+
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
|
149
150
|
patch_extension "$extension" >/dev/null 2>&1
|
|
150
151
|
run_group "phpize" "phpize"
|
|
151
152
|
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
package/src/scripts/linux.sh
CHANGED
|
@@ -75,9 +75,10 @@ check_package() {
|
|
|
75
75
|
# Helper function to add an extension.
|
|
76
76
|
add_extension_helper() {
|
|
77
77
|
local extension=$1
|
|
78
|
-
|
|
78
|
+
packages=(php"$version"-"$extension")
|
|
79
79
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
80
|
-
|
|
80
|
+
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
|
81
|
+
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
|
81
82
|
add_extension_log "$extension" "Installed and enabled"
|
|
82
83
|
sudo chmod 777 "${ini_file[@]}"
|
|
83
84
|
}
|
|
@@ -88,14 +89,14 @@ add_devtools() {
|
|
|
88
89
|
if ! command -v "$tool$version" >/dev/null; then
|
|
89
90
|
install_packages "php$version-dev"
|
|
90
91
|
fi
|
|
91
|
-
add_extension xml extension >/dev/null 2>&1
|
|
92
92
|
switch_version "phpize" "php-config"
|
|
93
|
+
add_extension xml extension >/dev/null 2>&1
|
|
93
94
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
# Function to setup the nightly build from shivammathur/php-builder
|
|
97
98
|
setup_nightly() {
|
|
98
|
-
run_script "php-builder" "${runner:?}" "$version"
|
|
99
|
+
run_script "php-builder" "${runner:?}" "$version" "${debug:?}" ${ts:?}
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
|
@@ -133,15 +134,22 @@ switch_version() {
|
|
|
133
134
|
wait "${to_wait[@]}"
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
# Function to get packages to install
|
|
138
|
+
get_php_packages() {
|
|
139
|
+
sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' '
|
|
140
|
+
if [ "${debug:?}" = "debug" ]; then
|
|
141
|
+
sed "s/[^ ]*/php$version-&-dbgsym/g" "$src"/configs/php_debug_packages | tr '\n' ' '
|
|
142
|
+
fi
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
# Function to install packaged PHP
|
|
137
146
|
add_packaged_php() {
|
|
138
147
|
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
|
|
139
148
|
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
|
140
|
-
IFS=' ' read -r -a packages <<<"$(
|
|
149
|
+
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
|
141
150
|
install_packages "${packages[@]}"
|
|
142
|
-
add_pecl
|
|
143
151
|
else
|
|
144
|
-
run_script "php-ubuntu" "$version"
|
|
152
|
+
run_script "php-ubuntu" "$version" "${debug:?}"
|
|
145
153
|
fi
|
|
146
154
|
}
|
|
147
155
|
|
|
@@ -159,13 +167,14 @@ update_php() {
|
|
|
159
167
|
|
|
160
168
|
# Function to install PHP.
|
|
161
169
|
add_php() {
|
|
162
|
-
if [[ "$version" =~ ${nightly_versions:?} ]]; then
|
|
170
|
+
if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${ts:?}" = "zts" ]]; then
|
|
163
171
|
setup_nightly
|
|
164
172
|
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
|
165
173
|
setup_old_versions
|
|
166
174
|
else
|
|
167
175
|
add_packaged_php
|
|
168
176
|
switch_version >/dev/null 2>&1
|
|
177
|
+
add_pecl
|
|
169
178
|
fi
|
|
170
179
|
status="Installed"
|
|
171
180
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Function to fetch a brew tap.
|
|
2
|
+
fetch_brew_tap() {
|
|
3
|
+
tap=$1
|
|
4
|
+
tap_user=$(dirname "$tap")
|
|
5
|
+
tap_name=$(basename "$tap")
|
|
6
|
+
mkdir -p "$tap_dir/$tap_user"
|
|
7
|
+
branch="$(get -s -n "" "https://api.github.com/repos/$tap" | grep default_branch | cut -d: -f 2 | grep -Eo '[^\", ]+' | tr -d '\n')"
|
|
8
|
+
get -s -n "" "https://github.com/$tap/archive/$branch.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user"
|
|
9
|
+
sudo mv "$tap_dir/$tap_user/$tap_name-$branch" "$tap_dir/$tap_user/$tap_name"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
# Function to add a brew tap.
|
|
13
|
+
add_brew_tap() {
|
|
14
|
+
tap=$1
|
|
15
|
+
if ! [ -d "$tap_dir/$tap" ]; then
|
|
16
|
+
if [ "${runner:?}" = "self-hosted" ]; then
|
|
17
|
+
brew tap "$tap" >/dev/null 2>&1
|
|
18
|
+
else
|
|
19
|
+
fetch_brew_tap "$tap" >/dev/null 2>&1
|
|
20
|
+
if ! [ -d "$tap_dir/$tap" ]; then
|
|
21
|
+
brew tap "$tap" >/dev/null 2>&1
|
|
22
|
+
fi
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Function to get brew prefix.
|
|
28
|
+
get_brew_prefix() {
|
|
29
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
30
|
+
echo /home/linuxbrew/.linuxbrew
|
|
31
|
+
else
|
|
32
|
+
if [ "$(uname -m)" = "arm64" ]; then
|
|
33
|
+
echo /opt/homebrew
|
|
34
|
+
else
|
|
35
|
+
echo /usr/local
|
|
36
|
+
fi
|
|
37
|
+
fi
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Function to add brew's bin directories to the PATH.
|
|
41
|
+
add_brew_bins_to_path() {
|
|
42
|
+
local brew_prefix=${1:-$(get_brew_prefix)}
|
|
43
|
+
add_path "$brew_prefix"/bin
|
|
44
|
+
add_path "$brew_prefix"/sbin
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Function to add brew.
|
|
48
|
+
add_brew() {
|
|
49
|
+
brew_prefix="$(get_brew_prefix)"
|
|
50
|
+
if ! [ -d "$brew_prefix"/bin ]; then
|
|
51
|
+
step_log "Setup Brew"
|
|
52
|
+
get -s "" "/tmp/install.sh" "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" | bash -s >/dev/null 2>&1
|
|
53
|
+
add_log "${tick:?}" "Brew" "Installed Homebrew"
|
|
54
|
+
fi
|
|
55
|
+
add_brew_bins_to_path "$brew_prefix"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# Function to configure brew constants.
|
|
59
|
+
configure_brew() {
|
|
60
|
+
brew_path="$(command -v brew)"
|
|
61
|
+
if [ -z "$brew_path" ]; then
|
|
62
|
+
add_brew
|
|
63
|
+
brew_path="$(command -v brew)"
|
|
64
|
+
fi
|
|
65
|
+
brew_path_dir="$(dirname "$brew_path")"
|
|
66
|
+
brew_prefix="$brew_path_dir"/..
|
|
67
|
+
brew_repo="$brew_path_dir/$(dirname "$(readlink "$brew_path")")"/..
|
|
68
|
+
tap_dir="$brew_repo"/Library/Taps
|
|
69
|
+
core_repo="$tap_dir"/homebrew/homebrew-core
|
|
70
|
+
|
|
71
|
+
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
|
|
72
|
+
export HOMEBREW_DEVELOPER=1
|
|
73
|
+
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
74
|
+
export HOMEBREW_NO_ENV_HINTS=1
|
|
75
|
+
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
76
|
+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
|
77
|
+
export brew_path
|
|
78
|
+
export brew_path_dir
|
|
79
|
+
export brew_prefix
|
|
80
|
+
export brew_repo
|
|
81
|
+
export tap_dir
|
|
82
|
+
export core_repo
|
|
83
|
+
}
|
|
@@ -22,6 +22,8 @@ get_grpc_tag() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
add_grpc_php_plugin_brew() {
|
|
25
|
+
. "${0%/*}"/tools/brew.sh
|
|
26
|
+
configure_brew
|
|
25
27
|
brew install grpc
|
|
26
28
|
brew link --force --overwrite grpc >/dev/null 2>&1
|
|
27
29
|
grpc_tag="v$(brew info grpc | grep "grpc:" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
|
package/src/scripts/tools/ppa.sh
CHANGED
|
@@ -140,6 +140,20 @@ add_list() {
|
|
|
140
140
|
return 0;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
# Function to check if a PPA exists
|
|
144
|
+
check_ppa() {
|
|
145
|
+
ppa=$1
|
|
146
|
+
ppa_url=${2:-"$lp_ppa/$ppa/ubuntu"}
|
|
147
|
+
package_dist=${3:-"$VERSION_CODENAME"}
|
|
148
|
+
branches=${4:-main}
|
|
149
|
+
ppa_search="deb .*$ppa_url $package_dist .*$branches"
|
|
150
|
+
if check_lists "$ppa" "$ppa_search"; then
|
|
151
|
+
return 0;
|
|
152
|
+
else
|
|
153
|
+
return 1;
|
|
154
|
+
fi
|
|
155
|
+
}
|
|
156
|
+
|
|
143
157
|
# Function to remove a PPA.
|
|
144
158
|
remove_list() {
|
|
145
159
|
ppa=${1-ondrej/php}
|
|
@@ -153,8 +167,10 @@ add_ppa() {
|
|
|
153
167
|
set_base_version
|
|
154
168
|
ppa=${1:-ondrej/php}
|
|
155
169
|
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
|
170
|
+
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
|
156
171
|
add_list "$ppa"
|
|
157
172
|
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
|
173
|
+
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
|
|
158
174
|
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
|
|
159
175
|
else
|
|
160
176
|
add_list "$ppa"
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
add_symfony_with_brew() {
|
|
2
|
+
add_brew_tap symfony-cli/homebrew-tap
|
|
3
|
+
brew install symfony-cli/tap/symfony-cli
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
get_symfony_artifact_url() {
|
|
6
7
|
arch=$(dpkg --print-architecture)
|
|
7
|
-
get -s -n ""
|
|
8
|
-
|
|
8
|
+
url=$(get -s -n "" https://raw.githubusercontent.com/symfony-cli/homebrew-tap/main/Formula/symfony-cli.rb 2<&1 | grep -m 1 "url.*linux.*${arch}" | cut -d\" -f 2)
|
|
9
|
+
if [ -z "$url" ]; then
|
|
10
|
+
url=$(get -s -n "" https://api.github.com/repos/symfony-cli/symfony-cli/releases 2<&1 | grep -m 1 "url.*linux.*${arch}.*gz\"" | cut -d\" -f 4)
|
|
11
|
+
fi
|
|
12
|
+
echo "$url"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
add_symfony_helper() {
|
|
16
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
17
|
+
url="$(get_symfony_artifact_url)"
|
|
18
|
+
if [ -z "$url" ]; then
|
|
19
|
+
. "${0%/*}"/tools/brew.sh
|
|
20
|
+
configure_brew
|
|
21
|
+
add_symfony_with_brew
|
|
22
|
+
else
|
|
23
|
+
get -s -n "" "$url" | sudo tar -xz -C "${tool_path_dir:?}" 2>/dev/null
|
|
24
|
+
sudo chmod a+x /usr/local/bin/symfony
|
|
25
|
+
fi
|
|
26
|
+
elif [ "$(uname -s)" = "Darwin" ]; then
|
|
27
|
+
add_symfony_with_brew
|
|
9
28
|
fi
|
|
10
29
|
}
|
|
11
30
|
|
package/src/scripts/unix.sh
CHANGED
|
@@ -43,13 +43,15 @@ set_output() {
|
|
|
43
43
|
name=$1
|
|
44
44
|
value=$2
|
|
45
45
|
if [ "${GITHUB_ACTIONS}" = "true" ]; then
|
|
46
|
-
echo "
|
|
46
|
+
echo "${name}=${value}" | tee -a "$GITHUB_OUTPUT" >/dev/null 2>&1
|
|
47
47
|
fi
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
# Function to read env inputs.
|
|
51
51
|
read_env() {
|
|
52
52
|
update="${update:-${UPDATE:-false}}"
|
|
53
|
+
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
|
54
|
+
[ "${phpts:-${PHPTS:-nts}}" = "ts" ] && ts=zts && update=true || ts=nts
|
|
53
55
|
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
|
54
56
|
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github
|
|
55
57
|
runner="${runner:-${RUNNER:-$_runner}}"
|
|
@@ -58,6 +60,16 @@ read_env() {
|
|
|
58
60
|
fail_fast=true
|
|
59
61
|
add_log "$cross" "Runner" "Runner set as github in self-hosted environment"
|
|
60
62
|
fi
|
|
63
|
+
|
|
64
|
+
# Set Update to true if the ubuntu github image does not have PHP PPA.
|
|
65
|
+
if [[ "$runner" = "github" && "${ImageOS}" =~ ubuntu.* ]]; then
|
|
66
|
+
check_ppa ondrej/php || update=true
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
export fail_fast
|
|
70
|
+
export runner
|
|
71
|
+
export update
|
|
72
|
+
export ts
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
# Function to download a file using cURL.
|
package/src/scripts/win32.ps1
CHANGED
|
@@ -43,7 +43,7 @@ Function Set-Output() {
|
|
|
43
43
|
$value
|
|
44
44
|
)
|
|
45
45
|
if ($env:GITHUB_ACTIONS -eq 'true') {
|
|
46
|
-
|
|
46
|
+
Add-Content "$output=$value" -Path $env:GITHUB_OUTPUT -Encoding utf8
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -229,6 +229,20 @@ Function Set-PhpCache {
|
|
|
229
229
|
} catch { }
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
# Function to add debug symbols to PHP.
|
|
233
|
+
Function Add-DebugSymbols {
|
|
234
|
+
$release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version
|
|
235
|
+
$dev = if ($version -match $nightly_versions) { '-dev' } else { '' }
|
|
236
|
+
$asset = $release.assets | ForEach-Object {
|
|
237
|
+
if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
|
|
238
|
+
return $_.name
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
|
242
|
+
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
|
|
243
|
+
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir
|
|
244
|
+
}
|
|
245
|
+
|
|
232
246
|
# Function to install nightly version of PHP
|
|
233
247
|
Function Install-PhpNightly {
|
|
234
248
|
Invoke-WebRequest -UseBasicParsing -Uri $php_builder/releases/latest/download/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
|
@@ -351,6 +365,10 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|
|
351
365
|
Add-PhpConfig
|
|
352
366
|
}
|
|
353
367
|
|
|
368
|
+
if($env:DEBUG -eq 'true') {
|
|
369
|
+
Add-DebugSymbols
|
|
370
|
+
}
|
|
371
|
+
|
|
354
372
|
$installed = Get-Php -Path $php_dir
|
|
355
373
|
if($installed.MajorMinorVersion -ne $version) {
|
|
356
374
|
Add-Log $cross "PHP" "Could not setup PHP $version"
|