setup-php 2.13.0 → 2.17.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.
Files changed (134) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +990 -922
  3. package/lib/config.d.ts +3 -0
  4. package/lib/config.js +71 -71
  5. package/lib/config.js.map +1 -1
  6. package/lib/coverage.d.ts +5 -0
  7. package/lib/coverage.js +97 -87
  8. package/lib/coverage.js.map +1 -1
  9. package/lib/extensions.d.ts +4 -0
  10. package/lib/extensions.js +214 -200
  11. package/lib/extensions.js.map +1 -1
  12. package/lib/fetch.d.ts +1 -0
  13. package/lib/fetch.js +63 -0
  14. package/lib/fetch.js.map +1 -0
  15. package/lib/install.d.ts +2 -0
  16. package/lib/install.js +75 -81
  17. package/lib/install.js.map +1 -1
  18. package/lib/tools.d.ts +23 -0
  19. package/lib/tools.js +367 -386
  20. package/lib/tools.js.map +1 -1
  21. package/lib/utils.d.ts +21 -0
  22. package/lib/utils.js +261 -291
  23. package/lib/utils.js.map +1 -1
  24. package/package.json +67 -56
  25. package/src/config.ts +82 -82
  26. package/src/configs/brew_extensions +31 -0
  27. package/src/configs/composer.env +2 -0
  28. package/src/configs/ini/jit.ini +3 -0
  29. package/src/configs/ini/php.ini +2 -0
  30. package/src/configs/ini/xdebug.ini +1 -0
  31. package/src/configs/os_releases.csv +19 -17
  32. package/src/configs/php-versions.json +6 -5
  33. package/src/configs/php_packages +12 -0
  34. package/src/configs/{php.json → pm/php.json} +29 -29
  35. package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
  36. package/src/configs/tools.json +278 -235
  37. package/src/configs/tools_schema.json +125 -114
  38. package/src/coverage.ts +144 -142
  39. package/src/extensions.ts +367 -349
  40. package/src/fetch.ts +54 -0
  41. package/src/install.ts +66 -82
  42. package/src/scripts/darwin.sh +285 -249
  43. package/src/scripts/extensions/add_extensions.ps1 +194 -0
  44. package/src/scripts/extensions/add_extensions.sh +184 -0
  45. package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
  46. package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
  47. package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
  48. package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
  49. package/src/scripts/extensions/extension_map.php +132 -0
  50. package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
  51. package/src/scripts/{ext → extensions}/firebird.sh +39 -35
  52. package/src/scripts/{ext → extensions}/gearman.sh +22 -22
  53. package/src/scripts/{ext → extensions}/geos.sh +17 -17
  54. package/src/scripts/{ext → extensions}/http.ps1 +54 -54
  55. package/src/scripts/{ext → extensions}/http.sh +109 -120
  56. package/src/scripts/{ext → extensions}/intl.sh +23 -23
  57. package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
  58. package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
  59. package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
  60. package/src/scripts/{ext → extensions}/oci.sh +65 -63
  61. package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
  62. package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
  63. package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
  64. package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
  65. package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
  66. package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
  67. package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
  68. package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
  69. package/src/scripts/{ext → extensions}/source.sh +145 -144
  70. package/src/scripts/extensions/sqlsrv.sh +15 -0
  71. package/src/scripts/linux.sh +269 -256
  72. package/src/scripts/tools/add_tools.ps1 +239 -26
  73. package/src/scripts/tools/add_tools.sh +175 -20
  74. package/src/scripts/tools/blackfire.ps1 +19 -19
  75. package/src/scripts/tools/blackfire.sh +40 -39
  76. package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
  77. package/src/scripts/tools/grpc_php_plugin.sh +58 -58
  78. package/src/scripts/tools/ppa.sh +192 -151
  79. package/src/scripts/tools/protoc.ps1 +38 -38
  80. package/src/scripts/tools/protoc.sh +28 -28
  81. package/src/scripts/tools/symfony.ps1 +14 -0
  82. package/src/scripts/tools/symfony.sh +13 -0
  83. package/src/scripts/unix.sh +186 -0
  84. package/src/scripts/win32.ps1 +352 -494
  85. package/src/tools.ts +512 -538
  86. package/src/utils.ts +415 -500
  87. package/.eslintrc.json +0 -16
  88. package/.github/CODE_OF_CONDUCT.md +0 -76
  89. package/.github/CONTRIBUTING.md +0 -70
  90. package/.github/FUNDING.yml +0 -7
  91. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  92. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  93. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  94. package/.github/SECURITY.md +0 -29
  95. package/.github/workflows/docs.yml +0 -77
  96. package/.github/workflows/node-workflow.yml +0 -51
  97. package/.github/workflows/workflow.yml +0 -78
  98. package/.idea/workspace.xml +0 -113
  99. package/.prettierrc.json +0 -12
  100. package/__tests__/config.test.ts +0 -52
  101. package/__tests__/coverage.test.ts +0 -110
  102. package/__tests__/extensions.test.ts +0 -263
  103. package/__tests__/install.test.ts +0 -175
  104. package/__tests__/tools.test.ts +0 -524
  105. package/__tests__/utils.test.ts +0 -307
  106. package/action.yml +0 -29
  107. package/dist/index.js +0 -3051
  108. package/examples/bedrock.yml +0 -32
  109. package/examples/blackfire-player.yml +0 -31
  110. package/examples/blackfire.yml +0 -31
  111. package/examples/cakephp-mysql.yml +0 -114
  112. package/examples/cakephp-postgres.yml +0 -112
  113. package/examples/cakephp.yml +0 -92
  114. package/examples/codeigniter.yml +0 -34
  115. package/examples/laravel-mysql.yml +0 -74
  116. package/examples/laravel-postgres.yml +0 -74
  117. package/examples/laravel.yml +0 -42
  118. package/examples/lumen-mysql.yml +0 -74
  119. package/examples/lumen-postgres.yml +0 -74
  120. package/examples/lumen.yml +0 -38
  121. package/examples/phalcon-mysql.yml +0 -74
  122. package/examples/phalcon-postgres.yml +0 -73
  123. package/examples/sage.yml +0 -57
  124. package/examples/slim-framework.yml +0 -34
  125. package/examples/symfony-mysql.yml +0 -57
  126. package/examples/symfony-postgres.yml +0 -55
  127. package/examples/symfony.yml +0 -39
  128. package/examples/yii2-mysql.yml +0 -73
  129. package/examples/yii2-postgres.yml +0 -71
  130. package/examples/zend-framework.yml +0 -36
  131. package/jest.config.js +0 -12
  132. package/lib/sapi.js +0 -64
  133. package/src/scripts/common.sh +0 -314
  134. package/tsconfig.json +0 -18
@@ -1,144 +1,145 @@
1
- # Function to parse extension environment variables
2
- parse_args() {
3
- extension=$1
4
- suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]')
5
- up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
6
- var="${extension}_${suffix}"
7
- up_var="${up_ext_name}_${suffix}"
8
- ! [[ "$suffix" =~ .*PREFIX|LIBS|PATH.* ]] && hyp='-'
9
- output=$(echo "${!var} ${!up_var}" | sed "s/, *$hyp/ $hyp/g" | sed -E "s/^,|,$//g")
10
- echo "$output" | xargs -n 1 | sort | uniq | xargs
11
- }
12
-
13
- # Function to log if a library is installed
14
- add_lib_log() {
15
- lib=$1
16
- if check_lib "$lib"; then
17
- add_log "${tick:?}" "$lib" "Installed"
18
- else
19
- add_log "${cross:?}" "$lib" "Could not install $lib"
20
- fi
21
- }
22
-
23
- # Function to check if a library is installed
24
- check_lib() {
25
- lib=$1
26
- if [ "$(uname -s)" = "Linux" ]; then
27
- [ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
28
- else
29
- [ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
30
- fi
31
- }
32
-
33
- # Function to add a library on linux
34
- add_linux_libs() {
35
- lib=$1
36
- if ! check_lib "$lib"; then
37
- install_packages "$lib" >/dev/null 2>&1 || true
38
- fi
39
- add_lib_log "$lib"
40
- }
41
-
42
- # Function to add a library on macOS
43
- add_darwin_libs() {
44
- lib=$1
45
- if ! check_lib "$lib"; then
46
- brew install "$lib" >/dev/null 2>&1 || true
47
- if [[ "$lib" = *@* ]]; then
48
- brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
49
- fi
50
- fi
51
- add_lib_log "$lib"
52
- }
53
-
54
- # Function to add required libraries
55
- add_libs() {
56
- all_libs=("$@")
57
- for lib in "${all_libs[@]}"; do
58
- if [ "$(uname -s)" = "Linux" ]; then
59
- add_linux_libs "$lib"
60
- else
61
- add_darwin_libs "$lib"
62
- fi
63
- done
64
- }
65
-
66
- # Function to run command in a group
67
- run_group() {
68
- command=$1
69
- log=$2
70
- echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
71
- echo "::group::$log"
72
- . ./run_group.sh
73
- rm ./run_group.sh
74
- echo "::endgroup::"
75
- }
76
-
77
- patch_extension() {
78
- extension=$1
79
- if [ -e "${scripts:?}"/ext/patches/"$extension".sh ]; then
80
- # shellcheck source=.
81
- . "${scripts:?}"/ext/patches/"$extension".sh
82
- patch_"${extension}"
83
- fi
84
- }
85
-
86
- fetch_extension() {
87
- fetch=$1
88
- if [ "$fetch" = "clone" ]; then
89
- run_group "git clone -nv $url/$org/$repo /tmp/$repo-$release" "git clone"
90
- cd /tmp/"$repo-$release" || exit 1
91
- git checkout -q "$release"
92
- cd "$sub_dir" || exit 1
93
- if [ -e .gitmodules ]; then
94
- jobs="$(grep -c "\[submodule" .gitmodules)"
95
- run_group "git submodule update --jobs $jobs --init --recursive" "git submodule"
96
- fi
97
- elif [ "$fetch" = "get" ]; then
98
- get -q -n /tmp/"$extension".tar.gz "$url/$org/$repo/archive/$release.tar.gz"
99
- tar -xzf /tmp/"$extension".tar.gz -C /tmp
100
- cd /tmp/"$repo"-"$release"/"$sub_dir" || exit
101
- elif [ "$fetch" = "pecl" ]; then
102
- source="pecl"
103
- pecl_name=${extension/http/pecl_http}
104
- get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
105
- tar -xzf /tmp/"$pecl_name".tgz -C /tmp
106
- cd /tmp/"$pecl_name"-"$release" || exit
107
- fi
108
- }
109
-
110
- # Function to install extension from a git repository
111
- add_extension_from_source() {
112
- extension="${1/pecl_/}"
113
- url=$2
114
- org=$3
115
- repo=$4
116
- release=$5
117
- prefix=$6
118
- fetch=${7:-clone}
119
- slug="$extension-$release"
120
- source="$url/$org/$repo"
121
- libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
122
- opts="$(parse_args "$extension" CONFIGURE_OPTS)"
123
- prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
124
- suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
125
- sub_dir="$(parse_args "$extension" PATH)"
126
- step_log "Setup $slug"
127
- (
128
- add_devtools phpize >/dev/null 2>&1
129
- delete_extension "$extension"
130
- fetch_extension "$fetch"
131
- if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
132
- add_log "${cross:?}" "$source" "$source does not have a PHP extension"
133
- else
134
- [[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
135
- patch_extension "$extension" >/dev/null 2>&1
136
- run_group "phpize" "phpize"
137
- run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
138
- run_group "sudo make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
139
- run_group "sudo make install" "make install"
140
- enable_extension "$extension" "$prefix"
141
- fi
142
- )
143
- add_extension_log "$slug" "Installed from $source and enabled"
144
- }
1
+ # Function to parse extension environment variables
2
+ parse_args() {
3
+ local extension=$1
4
+ suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]')
5
+ up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
6
+ var="${extension}_${suffix}"
7
+ up_var="${up_ext_name}_${suffix}"
8
+ ! [[ "$suffix" =~ .*PREFIX|LIBS|PATH.* ]] && hyp='-'
9
+ output=$(echo "${!var} ${!up_var}" | sed "s/, *$hyp/ $hyp/g" | sed -E "s/^,|,$//g")
10
+ echo "$output" | xargs -n 1 | sort | uniq | xargs
11
+ }
12
+
13
+ # Function to log if a library is installed
14
+ add_lib_log() {
15
+ local lib=$1
16
+ if check_lib "$lib"; then
17
+ add_log "${tick:?}" "$lib" "Installed"
18
+ else
19
+ add_log "${cross:?}" "$lib" "Could not install $lib"
20
+ fi
21
+ }
22
+
23
+ # Function to check if a library is installed
24
+ check_lib() {
25
+ local lib=$1
26
+ if [ "$(uname -s)" = "Linux" ]; then
27
+ [ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
28
+ else
29
+ [ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
30
+ fi
31
+ }
32
+
33
+ # Function to add a library on linux
34
+ add_linux_libs() {
35
+ local lib=$1
36
+ if ! check_lib "$lib"; then
37
+ install_packages "$lib" >/dev/null 2>&1 || true
38
+ fi
39
+ add_lib_log "$lib"
40
+ }
41
+
42
+ # Function to add a library on macOS
43
+ add_darwin_libs() {
44
+ local lib=$1
45
+ if ! check_lib "$lib"; then
46
+ brew install "$lib" >/dev/null 2>&1 || true
47
+ if [[ "$lib" = *@* ]]; then
48
+ brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
49
+ fi
50
+ fi
51
+ add_lib_log "$lib"
52
+ }
53
+
54
+ # Function to add required libraries
55
+ add_libs() {
56
+ local all_libs=("$@")
57
+ for lib in "${all_libs[@]}"; do
58
+ if [ "$(uname -s)" = "Linux" ]; then
59
+ add_linux_libs "$lib"
60
+ else
61
+ add_darwin_libs "$lib"
62
+ fi
63
+ done
64
+ }
65
+
66
+ # Function to run command in a group
67
+ run_group() {
68
+ local command=$1
69
+ local log=$2
70
+ echo "$command" | sudo tee ./run_group.sh >/dev/null 2>&1
71
+ echo "$GROUP$log"
72
+ . ./run_group.sh
73
+ rm ./run_group.sh
74
+ echo "$END_GROUP"
75
+ }
76
+
77
+ patch_extension() {
78
+ local extension=$1
79
+ if [ -e "${scripts:?}"/extensions/patches/"$extension".sh ]; then
80
+ # shellcheck source=.
81
+ . "${scripts:?}"/extensions/patches/"$extension".sh
82
+ patch_"${extension}"
83
+ fi
84
+ }
85
+
86
+ fetch_extension() {
87
+ local extension=$1
88
+ local fetch=$2
89
+ if [ "$fetch" = "clone" ]; then
90
+ run_group "git clone -nv $url/$org/$repo /tmp/$repo-$release" "git clone"
91
+ cd /tmp/"$repo-$release" || exit 1
92
+ git checkout -q "$release"
93
+ cd "$sub_dir" || exit 1
94
+ if [ -e .gitmodules ]; then
95
+ jobs="$(grep -c "\[submodule" .gitmodules)"
96
+ run_group "git submodule update --jobs $jobs --init --recursive" "git submodule"
97
+ fi
98
+ elif [ "$fetch" = "get" ]; then
99
+ get -q -n /tmp/"$extension".tar.gz "$url/$org/$repo/archive/$release.tar.gz"
100
+ tar -xzf /tmp/"$extension".tar.gz -C /tmp
101
+ cd /tmp/"$repo"-"$release"/"$sub_dir" || exit
102
+ elif [ "$fetch" = "pecl" ]; then
103
+ source="pecl"
104
+ pecl_name=${extension/http/pecl_http}
105
+ get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
106
+ tar -xzf /tmp/"$pecl_name".tgz -C /tmp
107
+ cd /tmp/"$pecl_name"-"$release" || exit
108
+ fi
109
+ }
110
+
111
+ # Function to install extension from a git repository
112
+ add_extension_from_source() {
113
+ local extension="${1/pecl_/}"
114
+ local url=$2
115
+ local org=$3
116
+ local repo=$4
117
+ local release=$5
118
+ local prefix=$6
119
+ local fetch=${7:-clone}
120
+ slug="$extension-$release"
121
+ source="$url/$org/$repo"
122
+ libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
123
+ opts="$(parse_args "$extension" CONFIGURE_OPTS)"
124
+ prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
125
+ suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
126
+ sub_dir="$(parse_args "$extension" PATH)"
127
+ step_log "Setup $slug"
128
+ (
129
+ add_devtools phpize >/dev/null 2>&1
130
+ disable_extension_helper "$extension"
131
+ fetch_extension "$extension" "$fetch"
132
+ if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
133
+ add_log "${cross:?}" "$source" "$source does not have a PHP extension"
134
+ else
135
+ [[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
136
+ patch_extension "$extension" >/dev/null 2>&1
137
+ run_group "phpize" "phpize"
138
+ run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
139
+ run_group "sudo make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
140
+ run_group "sudo make install" "make install"
141
+ enable_extension "$extension" "$prefix"
142
+ fi
143
+ )
144
+ add_extension_log "$slug" "Installed from $source and enabled"
145
+ }
@@ -0,0 +1,15 @@
1
+ # Function to get sqlsrv and pdo_sqlsrv version.
2
+ get_sqlsrv_version() {
3
+ if [[ "${version:?}" =~ 7.[0-2] ]]; then
4
+ echo '5.9.0'
5
+ else
6
+ echo '5.10.0beta2'
7
+ fi
8
+ }
9
+
10
+ # Function to install sqlsrv and pdo_sqlsrv.
11
+ add_sqlsrv() {
12
+ ext=$1
13
+ ext_version=$(get_sqlsrv_version)
14
+ add_pecl_extension "$ext" "$ext_version" extension
15
+ }