setup-php 2.30.0 → 2.30.1

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 CHANGED
@@ -71,11 +71,12 @@ Both `GitHub-hosted` and `self-hosted` runners are supported by `setup-php` on t
71
71
  | Virtual environment | YAML workflow label | Pre-installed PHP |
72
72
  |---------------------|------------------------------------|------------------------|
73
73
  | Ubuntu 22.04 | `ubuntu-latest` or `ubuntu-22.04` | `PHP 8.1` |
74
- | Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.2` |
75
- | Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.2` |
76
- | Windows Server 2019 | `windows-2019` | `PHP 8.2` |
77
- | macOS Ventura 13.x | `macos-13` | `PHP 8.2` |
78
- | macOS Monterey 12.x | `macos-latest` or `macos-12` | `PHP 8.2` |
74
+ | Ubuntu 20.04 | `ubuntu-20.04` | `PHP 7.4` to `PHP 8.3` |
75
+ | Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.3` |
76
+ | Windows Server 2019 | `windows-2019` | `PHP 8.3` |
77
+ | macOS Sonoma 14.x | `macos-14` | - |
78
+ | macOS Ventura 13.x | `macos-13` | `PHP 8.3` |
79
+ | macOS Monterey 12.x | `macos-latest` or `macos-12` | `PHP 8.3` |
79
80
 
80
81
  ### Self-Hosted Runners
81
82
 
@@ -116,7 +117,7 @@ On all supported OS/Platforms the following PHP versions can be set up as per th
116
117
  | `8.0` | `Stable` | `End of life` | `GitHub-hosted`, `self-hosted` |
117
118
  | `8.1` | `Stable` | `Security fixes only` | `GitHub-hosted`, `self-hosted` |
118
119
  | `8.2` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
119
- | `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
120
+ | `8.3` | `Stable` | `Active` | `GitHub-hosted`, `self-hosted` |
120
121
  | `8.4` | `Nightly` | `In development` | `GitHub-hosted`, `self-hosted` |
121
122
 
122
123
  **Notes:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-php",
3
- "version": "2.30.0",
3
+ "version": "2.30.1",
4
4
  "private": false,
5
5
  "description": "Setup PHP for use with GitHub Actions",
6
6
  "main": "lib/install.js",
@@ -19,7 +19,7 @@
19
19
  "lint": "eslint **/src/*.ts **/__tests__/*.ts --cache --fix",
20
20
  "format": "prettier --write **/src/*.ts **/__tests__/*.ts && git add -f __tests__/ ",
21
21
  "format-check": "prettier --check **/src/*.ts **/__tests__/*.ts",
22
- "release": "ncc build -o dist && git add -f dist/",
22
+ "release": "ncc build -m -o dist && git add -f dist/",
23
23
  "test": "jest"
24
24
  },
25
25
  "repository": {
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jest": "^29.5.12",
44
- "@types/node": "^20.11.24",
45
- "@typescript-eslint/eslint-plugin": "^7.1.0",
46
- "@typescript-eslint/parser": "^7.1.0",
44
+ "@types/node": "^20.11.30",
45
+ "@typescript-eslint/eslint-plugin": "^7.3.1",
46
+ "@typescript-eslint/parser": "^7.3.1",
47
47
  "@vercel/ncc": "^0.38.1",
48
48
  "eslint": "^8.57.0",
49
49
  "eslint-config-prettier": "^9.1.0",
@@ -54,9 +54,9 @@
54
54
  "jest-circus": "^29.7.0",
55
55
  "nock": "^13.5.4",
56
56
  "prettier": "^3.2.5",
57
- "simple-git-hooks": "^2.9.0",
57
+ "simple-git-hooks": "^2.11.0",
58
58
  "ts-jest": "^29.1.2",
59
- "typescript": "^5.3.3"
59
+ "typescript": "^5.4.3"
60
60
  },
61
61
  "bugs": {
62
62
  "url": "https://github.com/shivammathur/setup-php/issues"
@@ -113,17 +113,6 @@ add_pecl() {
113
113
  add_log "${tick:?}" "PECL" "Found PECL $pear_version"
114
114
  }
115
115
 
116
- # Function to link all libraries of a formula.
117
- link_libraries() {
118
- formula=$1
119
- formula_prefix="$(brew --prefix "$formula")"
120
- sudo mkdir -p "$formula_prefix"/lib
121
- for lib in "$formula_prefix"/lib/*.dylib; do
122
- lib_name=$(basename "$lib")
123
- sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
124
- done
125
- }
126
-
127
116
  # Link opcache extension to extensions directory.
128
117
  link_opcache() {
129
118
  opcache_ini="$brew_prefix"/etc/php/"$version"/conf.d/ext-opcache.ini
@@ -142,34 +131,15 @@ patch_brew() {
142
131
  trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
143
132
  }
144
133
 
145
- # Helper function to update the dependencies.
146
- update_dependencies_helper() {
147
- dependency=$1
148
- [[ "${dependency:0:3}" = "lib" ]] && prefix=lib || prefix="${dependency:0:1}"
149
- get -q -n "$core_repo/Formula/$prefix/$dependency.rb" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$prefix/$dependency.rb"
150
- link_libraries "$dependency"
151
- }
152
-
153
134
  # Function to update dependencies.
154
135
  update_dependencies() {
155
136
  patch_brew
156
137
  if ! [ -e /tmp/update_dependencies ]; then
157
- git -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
138
+ git_retry -C "$core_repo" fetch origin master && git -C "$core_repo" reset --hard origin/master
158
139
  echo '' | sudo tee /tmp/update_dependencies >/dev/null 2>&1
159
140
  fi
160
141
  }
161
142
 
162
- # Function to fix dependencies on install PHP version.
163
- fix_dependencies() {
164
- broken_deps_paths=$(php -v 2>&1 | grep -Eo '/opt/[a-zA-Z0-9@\.]+')
165
- if [ "x$broken_deps_paths" != "x" ]; then
166
- update_dependencies
167
- IFS=" " read -r -a formulae <<< "$(echo "$broken_deps_paths" | tr '\n' ' ' | sed 's|/opt/||g' 2>&1)$php_formula"
168
- brew reinstall "${formulae[@]}"
169
- brew link --force --overwrite "$php_formula" || true
170
- fi
171
- }
172
-
173
143
  # Function to get PHP version if it is already installed using Homebrew.
174
144
  get_brewed_php() {
175
145
  cellar="$brew_prefix"/Cellar
@@ -251,8 +221,8 @@ setup_php() {
251
221
  add_php "upgrade" "$existing_version" >/dev/null 2>&1
252
222
  status="Updated to"
253
223
  else
254
- status="Found"
255
- fix_dependencies >/dev/null 2>&1
224
+ add_php "upgrade" "$existing_version" >/dev/null 2>&1
225
+ status="Updated to"
256
226
  fi
257
227
  php_config="$(command -v php-config)"
258
228
  ext_dir="$(grep 'extension_dir=' "$php_config" | cut -d "'" -f 2)"
@@ -294,6 +264,7 @@ export HOMEBREW_NO_INSTALL_FROM_API=1
294
264
  # shellcheck source=.
295
265
  . "${scripts:?}"/unix.sh
296
266
  . "${scripts:?}"/tools/brew.sh
267
+ . "${scripts:?}"/tools/retry.sh
297
268
  . "${scripts:?}"/tools/add_tools.sh
298
269
  . "${scripts:?}"/extensions/source.sh
299
270
  . "${scripts:?}"/extensions/add_extensions.sh
@@ -39,9 +39,13 @@ add_oci_helper() {
39
39
  status='Installed and enabled'
40
40
  read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
41
41
  read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
42
- read -r "${ext}_PATH" <<< "ext/$ext"
43
42
  patch_phpize
44
- add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
43
+ if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
44
+ add_extension_from_source "$ext" https://github.com php pecl-database-"$ext" main extension get
45
+ else
46
+ read -r "${ext}_PATH" <<< "ext/$ext"
47
+ add_extension_from_source "$ext" https://github.com php php-src "$(php_src_tag)" extension get
48
+ fi
45
49
  restore_phpize
46
50
  else
47
51
  enable_extension "$ext" extension
@@ -8,19 +8,36 @@ Function Get-PhalconReleaseAssetUrl() {
8
8
  )
9
9
  $domain = 'https://api.github.com/repos'
10
10
  $releases = 'phalcon/cphalcon/releases'
11
+ $match = $null
11
12
  if($extension_version -match '[3-4]') {
12
13
  $nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
13
14
  try {
14
15
  $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 = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
16
+ } catch { }
17
+ if($null -eq $match) {
18
+ try {
19
+ $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
20
+ } catch { }
17
21
  }
18
22
  } else {
19
23
  $nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
20
24
  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 = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
25
+ $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
26
+ } catch { }
27
+ if($null -eq $match) {
28
+ try {
29
+ $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
30
+ } catch { }
31
+ }
32
+ if($null -eq $match) {
33
+ try {
34
+ $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
35
+ } catch { }
36
+ }
37
+ if($null -eq $match) {
38
+ try {
39
+ $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
40
+ } catch { }
24
41
  }
25
42
  }
26
43
  if($NULL -ne $match) {
@@ -54,6 +71,8 @@ Function Get-PhalconSemver() {
54
71
  return '3.4.5'
55
72
  } elseif (($extension_version -eq '4') -and ($version -eq '7.2')) {
56
73
  return '4.1.0'
74
+ } elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
75
+ return '5.4.0'
57
76
  }
58
77
  return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
59
78
  }
@@ -7,6 +7,8 @@ Function Get-SqlsrvReleaseVersion() {
7
7
  return '5.9.0'
8
8
  } elseif ($version -eq '7.4') {
9
9
  return '5.10.1'
10
+ } elseif ($version -eq '8.0') {
11
+ return '5.11.1'
10
12
  } else {
11
13
  return 'latest'
12
14
  }
@@ -4,6 +4,8 @@ get_sqlsrv_version() {
4
4
  echo '5.9.0'
5
5
  elif [[ "${version:?}" =~ 7.4 ]]; then
6
6
  echo '5.10.1'
7
+ elif [[ "${version:?}" =~ 8.0 ]]; then
8
+ echo '5.11.1'
7
9
  else
8
10
  # Return an empty string so that pecl will install the latest version.
9
11
  echo ''
@@ -0,0 +1,20 @@
1
+ function retry {
2
+ local try=0
3
+
4
+ until "$@"; do
5
+ exit_code="$?"
6
+ try=$((try + 1))
7
+
8
+ if [ $try -lt 10 ]; then
9
+ sleep "$((2 ** try))"
10
+ else
11
+ return $exit_code
12
+ fi
13
+ done
14
+
15
+ return 0
16
+ }
17
+
18
+ function git_retry {
19
+ retry git "$@"
20
+ }
@@ -133,14 +133,14 @@ Function Get-File {
133
133
  param (
134
134
  [string]$Url,
135
135
  [string]$FallbackUrl,
136
- [string]$OutFile,
136
+ [string]$OutFile = '',
137
137
  [int]$Retries = 3,
138
138
  [int]$TimeoutSec = 0
139
139
  )
140
140
 
141
141
  for ($i = 0; $i -lt $Retries; $i++) {
142
142
  try {
143
- if($null -ne $OutFile) {
143
+ if($OutFile -ne '') {
144
144
  Invoke-WebRequest -Uri $Url -OutFile $OutFile -TimeoutSec $TimeoutSec
145
145
  } else {
146
146
  Invoke-WebRequest -Uri $Url -TimeoutSec $TimeoutSec
@@ -150,7 +150,7 @@ Function Get-File {
150
150
  if ($i -eq ($Retries - 1)) {
151
151
  if($FallbackUrl) {
152
152
  try {
153
- if($null -ne $OutFile) {
153
+ if($OutFile -ne '') {
154
154
  Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
155
155
  } else {
156
156
  Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec