setup-php 2.21.2 → 2.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-php",
3
- "version": "2.21.2",
3
+ "version": "2.23.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.9.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": "^28.1.7",
43
- "@types/node": "^18.7.6",
44
- "@typescript-eslint/eslint-plugin": "^5.33.1",
45
- "@typescript-eslint/parser": "^5.33.1",
46
- "@vercel/ncc": "^0.34.0",
47
- "eslint": "^8.22.0",
42
+ "@types/jest": "^29.2.4",
43
+ "@types/node": "^18.11.17",
44
+ "@typescript-eslint/eslint-plugin": "^5.47.0",
45
+ "@typescript-eslint/parser": "^5.47.0",
46
+ "@vercel/ncc": "^0.36.0",
47
+ "eslint": "^8.30.0",
48
48
  "eslint-config-prettier": "^8.5.0",
49
49
  "eslint-plugin-import": "^2.26.0",
50
- "eslint-plugin-jest": "^26.8.3",
50
+ "eslint-plugin-jest": "^27.1.7",
51
51
  "eslint-plugin-prettier": "^4.2.1",
52
- "jest": "^28.1.3",
53
- "jest-circus": "^28.1.3",
52
+ "jest": "^29.3.1",
53
+ "jest-circus": "^29.3.1",
54
54
  "nock": "^13.2.9",
55
- "prettier": "^2.7.1",
56
- "simple-git-hooks": "^2.8.0",
57
- "ts-jest": "^28.0.8",
58
- "typescript": "^4.7.4"
55
+ "prettier": "^2.8.1",
56
+ "simple-git-hooks": "^2.8.1",
57
+ "ts-jest": "^29.0.3",
58
+ "typescript": "^4.9.4"
59
59
  },
60
60
  "bugs": {
61
61
  "url": "https://github.com/shivammathur/setup-php/issues"
@@ -2,13 +2,16 @@ amqp=amqp
2
2
  apcu=apcu
3
3
  ast=ast
4
4
  couchbase=couchbase
5
+ ds=ds
5
6
  event=event
6
7
  expect=expect
8
+ gearman=gearman
7
9
  gnupg=gnupg
8
10
  grpc=grpc
9
11
  igbinary=igbinary
10
12
  imagick=imagick
11
13
  imap=imap
14
+ lua=lua
12
15
  mailparse=mailparse
13
16
  mcrypt=mcrypt
14
17
  memcache=memcache
@@ -16,6 +19,7 @@ memcached=memcached
16
19
  mongodb=mongodb
17
20
  msgpack=msgpack
18
21
  pcov=pcov
22
+ pdo_sqlsrv=pdo_sqlsrv
19
23
  pecl_http=http
20
24
  phalcon3=phalcon
21
25
  phalcon4=phalcon
@@ -26,8 +30,10 @@ psr=psr
26
30
  raphf=raphf
27
31
  rdkafka=rdkafka
28
32
  redis=redis
33
+ sqlsrv=sqlsrv
29
34
  ssh2=ssh2
30
35
  swoole=swoole
36
+ v8js=v8js
31
37
  vips=vips
32
38
  xdebug=xdebug
33
39
  xdebug2=xdebug
@@ -1,2 +1,3 @@
1
1
  COMPOSER_PROCESS_TIMEOUT=0
2
2
  COMPOSER_NO_INTERACTION=1
3
+ COMPOSER_NO_AUDIT=1
@@ -1,7 +1,7 @@
1
1
  {
2
- "latest": "8.1",
3
- "nightly": "8.2",
2
+ "latest": "8.2",
3
+ "nightly": "8.3",
4
4
  "5.x": "5.6",
5
5
  "7.x": "7.4",
6
- "8.x": "8.1"
6
+ "8.x": "8.2"
7
7
  }
@@ -0,0 +1,11 @@
1
+ cgi
2
+ cli
3
+ curl
4
+ fpm
5
+ intl
6
+ mbstring
7
+ mysql
8
+ opcache
9
+ pgsql
10
+ xml
11
+ zip
@@ -7,6 +7,14 @@
7
7
  "version_prefix": "",
8
8
  "version_parameter": "-V"
9
9
  },
10
+ "composer-unused": {
11
+ "type": "phar",
12
+ "repository": "composer-unused/composer-unused",
13
+ "extension": ".phar",
14
+ "domain": "https://github.com",
15
+ "version_prefix": "",
16
+ "version_parameter": "-V"
17
+ },
10
18
  "composer-normalize": {
11
19
  "type": "phar",
12
20
  "repository": "ergebnis/composer-normalize",
@@ -110,7 +118,7 @@
110
118
  "repository": "laravel/pint",
111
119
  "extension": ".phar",
112
120
  "domain": "https://github.com",
113
- "version_prefix": "Pint ",
121
+ "version_prefix": "v",
114
122
  "version_parameter": "-V"
115
123
  },
116
124
  "psalm": {
@@ -142,11 +150,6 @@
142
150
  "repository": "maglnet/composer-require-checker",
143
151
  "scope": "scoped"
144
152
  },
145
- "composer-unused": {
146
- "type": "composer",
147
- "repository": "icanhazstring/composer-unused",
148
- "scope": "scoped"
149
- },
150
153
  "flex": {
151
154
  "type": "composer",
152
155
  "repository": "symfony/flex",
@@ -0,0 +1,2 @@
1
+ xdebug
2
+ pcov
package/src/extensions.ts CHANGED
@@ -31,15 +31,15 @@ export async function addExtensionDarwin(
31
31
  case /.+-.+\/.+@.+/.test(extension):
32
32
  add_script += await utils.parseExtensionSource(extension, ext_prefix);
33
33
  return;
34
- // match 5.3blackfire...8.1blackfire
34
+ // match 5.3blackfire...8.2blackfire
35
35
  // match 5.3blackfire-(semver)...8.1blackfire-(semver)
36
36
  // match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
37
37
  // match 5.3ioncube...7.4ioncube
38
38
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
39
- case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
39
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
40
40
  version_extension
41
41
  ):
42
- case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
42
+ case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
43
43
  extension
44
44
  ):
45
45
  case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
@@ -76,14 +76,12 @@ export async function addExtensionDarwin(
76
76
  case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
77
77
  add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
78
78
  return;
79
- // match 5.6 and newer - amqp, apcu, expect, gnupg, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
80
- // match 7.1 and newer - pcov
81
- // match 5.6 to 7.4 - propro
82
- // match 7.0 and newer - vips, xlswriter
79
+ // match brew extensions
83
80
  case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
84
81
  version_extension
85
82
  ):
86
- case /(5\.6|7\.[0-4])propro/.test(version_extension):
83
+ case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
84
+ case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
87
85
  case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
88
86
  case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
89
87
  add_script += await utils.joins(
@@ -130,13 +128,13 @@ export async function addExtensionWindows(
130
128
  case /^none$/.test(ext_name):
131
129
  add_script += '\nDisable-AllShared';
132
130
  break;
133
- // match 5.3blackfire...8.1blackfire
131
+ // match 5.3blackfire...8.2blackfire
134
132
  // match 5.3blackfire-(semver)...8.1blackfire-(semver)
135
133
  // match pdo_oci and oci8
136
134
  // match 5.3ioncube...7.4ioncube
137
135
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5
138
136
  // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
139
- case /^(5\.[3-6]|7\.[0-4]|8\.1)blackfire(-\d+\.\d+\.\d+)?$/.test(
137
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
140
138
  version_extension
141
139
  ):
142
140
  case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
@@ -254,13 +252,13 @@ export async function addExtensionLinux(
254
252
  case /.+-.+\/.+@.+/.test(extension):
255
253
  add_script += await utils.parseExtensionSource(extension, ext_prefix);
256
254
  return;
257
- // match 5.3blackfire...8.1blackfire
255
+ // match 5.3blackfire...8.2blackfire
258
256
  // match 5.3blackfire-(semver)...8.1blackfire-(semver)
259
257
  // match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
260
258
  // match couchbase, geos, pdo_oci, oci8, http, pecl_http
261
259
  // match 5.3ioncube...7.4ioncube
262
260
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5
263
- case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
261
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test(
264
262
  version_extension
265
263
  ):
266
264
  case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
@@ -269,7 +267,7 @@ export async function addExtensionLinux(
269
267
  case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
270
268
  extension
271
269
  ):
272
- case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
270
+ case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
273
271
  case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
274
272
  case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
275
273
  version_extension
@@ -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,38 +24,11 @@ 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
66
30
  local extension
67
- extension=$(grep "$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
31
+ extension=$(grep -E "^$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
68
32
  [[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
69
33
  echo "$extension"
70
34
  }
@@ -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
@@ -161,10 +125,13 @@ update_dependencies() {
161
125
  patch_brew
162
126
  if ! [ -e /tmp/update_dependencies ]; then
163
127
  if [ "${runner:?}" != "self-hosted" ] && [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
164
- while read -r dependency; do
165
- update_dependencies_helper "$dependency" &
166
- to_wait+=($!)
167
- done <"$tap_dir/$php_tap/.github/deps/${ImageOS:?}_${ImageVersion:?}"
128
+ deps_file="$tap_dir/$php_tap/.github/deps/${ImageOS:?}_${ImageVersion:?}"
129
+ if [ -e "$deps_file" ]; then
130
+ while read -r dependency; do
131
+ update_dependencies_helper "$dependency" &
132
+ to_wait+=($!)
133
+ done <"$deps_file"
134
+ fi
168
135
  wait "${to_wait[@]}"
169
136
  else
170
137
  git -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
@@ -200,6 +167,7 @@ add_php() {
200
167
  existing_version=$2
201
168
  add_brew_tap "$php_tap"
202
169
  update_dependencies
170
+ [ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
203
171
  if [ "$existing_version" != "false" ]; then
204
172
  ([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
205
173
  else
@@ -276,16 +244,10 @@ setup_php() {
276
244
  }
277
245
 
278
246
  # Variables
279
- version=${1:-'8.1'}
247
+ version=${1:-'8.2'}
280
248
  ini=${2:-'production'}
281
249
  src=${0%/*}/..
282
250
  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
251
  scripts="$src"/scripts
290
252
  ext_tap=shivammathur/homebrew-extensions
291
253
  php_tap=shivammathur/homebrew-php
@@ -298,9 +260,11 @@ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
298
260
 
299
261
  # shellcheck source=.
300
262
  . "${scripts:?}"/unix.sh
263
+ . "${scripts:?}"/tools/brew.sh
301
264
  . "${scripts:?}"/tools/add_tools.sh
302
265
  . "${scripts:?}"/extensions/source.sh
303
266
  . "${scripts:?}"/extensions/add_extensions.sh
267
+ configure_brew
304
268
  read_env
305
269
  self_hosted_setup
306
270
  setup_php
@@ -6,8 +6,9 @@ Function Set-ExtensionPrerequisites
6
6
  [ValidateNotNull()]
7
7
  [ValidateLength(1, [int]::MaxValue)]
8
8
  [string]
9
- $deps_dir
9
+ $extension
10
10
  )
11
+ $deps_dir = "$ext_dir\$extension-vc$($installed.VCVersion)-$arch"
11
12
  $deps = Get-ChildItem -Recurse -Path $deps_dir
12
13
  if ($deps.Count -ne 0) {
13
14
  # Symlink dependencies instead of adding the directory to PATH ...
@@ -20,6 +21,41 @@ Function Set-ExtensionPrerequisites
20
21
  }
21
22
  }
22
23
 
24
+ # Function to enable extension.
25
+ Function Enable-Extension() {
26
+ Param (
27
+ [Parameter(Position = 0, Mandatory = $true)]
28
+ [ValidateNotNull()]
29
+ [ValidateLength(1, [int]::MaxValue)]
30
+ [string]
31
+ $extension
32
+ )
33
+ Enable-ExtensionDependencies $extension
34
+ Enable-PhpExtension -Extension $extension -Path $php_dir
35
+ Set-ExtensionPrerequisites $extension
36
+ Add-Log $tick $extension "Enabled"
37
+ }
38
+
39
+ # Function to add custom built PHP extension for nightly builds.
40
+ Function Add-NightlyExtension {
41
+ Param (
42
+ [Parameter(Position = 0, Mandatory = $true)]
43
+ [ValidateNotNull()]
44
+ [ValidateLength(1, [int]::MaxValue)]
45
+ [string]
46
+ $extension
47
+ )
48
+ if($ts) { $ts_part = 'ts' } else { $ts_part = 'nts' }
49
+ $repo = "$github/shivammathur/php-extensions-windows"
50
+ $url = "$repo/releases/download/builds/php$version`_$ts_part`_$arch`_$extension.dll"
51
+ Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile "$ext_dir\php_$extension.dll"
52
+ if(Test-Path "$ext_dir\php_$extension.dll") {
53
+ Enable-Extension $extension > $null
54
+ } else {
55
+ throw "Failed to download the $extension"
56
+ }
57
+ }
58
+
23
59
  # Function to add PHP extensions.
24
60
  Function Add-Extension {
25
61
  Param (
@@ -52,31 +88,32 @@ Function Add-Extension {
52
88
  Add-Log $tick $extension "Enabled"
53
89
  }
54
90
  default {
55
- Enable-ExtensionDependencies $extension
56
- Enable-PhpExtension -Extension $extension_info.Handle -Path $php_dir
57
- Set-ExtensionPrerequisites $deps_dir
58
- Add-Log $tick $extension "Enabled"
91
+ Enable-Extension $extension_info.Handle
59
92
  }
60
93
  }
61
94
  }
62
95
  else {
63
- # Patch till PHP 8.1 DLLs are released as stable.
64
- $minimumStability = $stability
65
- if($version -eq '8.1' -and $stability -eq 'stable') {
66
- $minimumStability = 'snapshot'
67
- }
96
+ if(($version -match $nightly_versions) -and (Select-String -Path $src\configs\windows_extensions -Pattern $extension -SimpleMatch -Quiet)) {
97
+ Add-NightlyExtension $extension
98
+ } else {
99
+ # Patch till DLLs for PHP 8.1 and 8.2 are released as stable.
100
+ $minimumStability = $stability
101
+ if ($version -match '8.[1-2]' -and $stability -eq 'stable') {
102
+ $minimumStability = 'snapshot'
103
+ }
68
104
 
69
- $params = @{ Extension = $extension; MinimumStability = $minimumStability; MaximumStability = $stability; Path = $php_dir; AdditionalFilesPath = $deps_dir; NoDependencies = $true }
70
- if($extension_version -ne '') {
71
- $params["Version"] = $extension_version
105
+ $params = @{ Extension = $extension; MinimumStability = $minimumStability; MaximumStability = $stability; Path = $php_dir; AdditionalFilesPath = $deps_dir; NoDependencies = $true }
106
+ if ($extension_version -ne '')
107
+ {
108
+ $params["Version"] = $extension_version
109
+ }
110
+ Install-PhpExtension @params
111
+ Set-ExtensionPrerequisites $extension
72
112
  }
73
- Install-PhpExtension @params
74
- Set-ExtensionPrerequisites $deps_dir
75
113
  Add-Log $tick $extension "Installed and enabled"
76
114
  }
77
- }
78
- catch {
79
- Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
115
+ } catch {
116
+ Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
80
117
  }
81
118
  }
82
119
 
@@ -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
- add_extension_log "$extension-$(php -r "echo phpversion('$extension');")" "Installed and enabled"
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="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
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/tag/"$firebird_tag" | grep -Eo "Firebird-.*.pkg" | head -n 1)
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
@@ -17,6 +17,10 @@ add_gearman_helper() {
17
17
  # Function to add gearman extension.
18
18
  add_gearman() {
19
19
  status="Enabled"
20
- add_gearman_helper >/dev/null 2>&1
21
- add_extension_log "gearman" "$status"
20
+ if [ "$(uname -s)" = 'Linux' ]; then
21
+ add_gearman_helper >/dev/null 2>&1
22
+ add_extension_log "gearman" "$status"
23
+ else
24
+ add_brew_extension gearman extension
25
+ fi
22
26
  }
@@ -1,21 +1,45 @@
1
- # Function to add phalcon using GitHub releases.
2
- Function Add-PhalconFromGitHub() {
1
+ # Function to get the url of the phalcon release asset.
2
+ Function Get-PhalconReleaseAssetUrl() {
3
3
  Param (
4
4
  [Parameter(Position = 0, Mandatory = $true)]
5
5
  [ValidateNotNull()]
6
6
  [string]
7
7
  $Semver
8
8
  )
9
- $domain = 'https://github.com'
10
- $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
11
- $match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
12
- if($NULL -eq $match) {
9
+ $domain = 'https://api.github.com/repos'
10
+ $releases = 'phalcon/cphalcon/releases'
11
+ if($extension_version -match '[3-4]') {
12
+ $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
13
+ try {
14
+ $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
15
+ } catch {
16
+ $match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
17
+ }
18
+ } else {
13
19
  $nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
14
- $match = Invoke-WebRequest -Uri "$domain/phalcon/cphalcon/releases/v$Semver" | Select-String -Pattern "href=`"(.*phalcon-php${version}${nts}-windows.*-x64.zip)`""
20
+ try {
21
+ $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
22
+ } catch {
23
+ $match = (Invoke-WebRequest -Uri "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
24
+ }
15
25
  }
16
26
  if($NULL -ne $match) {
17
- $zip_file = $match.Matches[0].Groups[1].Value
18
- Invoke-WebRequest -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
27
+ return "$github/$releases/download/v$Semver/$($match.Matches[0].Groups[1].Value)"
28
+ }
29
+ return false;
30
+ }
31
+
32
+ # Function to add phalcon using GitHub releases.
33
+ Function Add-PhalconFromGitHub() {
34
+ Param (
35
+ [Parameter(Position = 0, Mandatory = $true)]
36
+ [ValidateNotNull()]
37
+ [string]
38
+ $Semver
39
+ )
40
+ $zip_url = Get-PhalconReleaseAssetUrl $Semver
41
+ if($zip_url) {
42
+ Invoke-WebRequest -Uri $zip_url -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
19
43
  Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
20
44
  Copy-Item -Path "$ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll" -Destination "$ext_dir\php_phalcon.dll"
21
45
  Enable-PhpExtension -Extension phalcon -Path $php_dir
@@ -23,17 +47,28 @@ Function Add-PhalconFromGitHub() {
23
47
  throw "Unable to get Phalcon release from the GitHub release"
24
48
  }
25
49
  }
50
+
51
+ # Function to get phalcon semver.
52
+ Function Get-PhalconSemver() {
53
+ if($extension_version -eq '3') {
54
+ return '3.4.5'
55
+ } elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
56
+ return '4.1.0'
57
+ }
58
+ return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
59
+ }
60
+
26
61
  # Function to install phalcon
27
62
  Function Add-PhalconHelper() {
28
- if ($extension_version -eq '5') {
29
- Add-PhalconFromGitHub -Semver (Get-PeclPackageVersion phalcon 5 snapshot stable | Select-Object -First 1)
63
+ $semver = Get-PhalconSemver
64
+ if (($extension_version -eq '3') -or ($extension_version -eq '5')) {
65
+ Add-PhalconFromGitHub $semver
30
66
  } elseif ($extension_version -eq '4') {
31
- Install-Phpextension -Extension phalcon -MinimumStability stable -Path $php_dir
32
- } elseif ($extension_version -eq '3') {
33
- Add-PhalconFromGitHub -Semver 3.4.5
67
+ Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
34
68
  }
35
69
  }
36
70
 
71
+ # Function to add phalcon
37
72
  Function Add-Phalcon() {
38
73
  Param (
39
74
  [Parameter(Position = 0, Mandatory = $true)]