setup-php 2.12.0 → 2.16.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 (113) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +977 -936
  3. package/package.json +66 -56
  4. package/src/config.ts +82 -82
  5. package/src/configs/brew_extensions +30 -0
  6. package/src/configs/os_releases.csv +17 -0
  7. package/src/configs/php-versions.json +6 -5
  8. package/src/configs/{php.json → pm/php.json} +29 -29
  9. package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
  10. package/src/configs/tools.json +256 -234
  11. package/src/configs/tools_schema.json +114 -103
  12. package/src/coverage.ts +169 -142
  13. package/src/extensions.ts +363 -349
  14. package/src/install.ts +79 -82
  15. package/src/scripts/common.sh +366 -314
  16. package/src/scripts/darwin.sh +257 -248
  17. package/src/scripts/ext/blackfire.ps1 +32 -32
  18. package/src/scripts/ext/blackfire.sh +22 -21
  19. package/src/scripts/ext/couchbase.sh +43 -43
  20. package/src/scripts/ext/cubrid.sh +60 -60
  21. package/src/scripts/ext/extension_map.php +109 -0
  22. package/src/scripts/ext/firebird.ps1 +19 -19
  23. package/src/scripts/ext/firebird.sh +39 -35
  24. package/src/scripts/ext/gearman.sh +22 -22
  25. package/src/scripts/ext/geos.sh +17 -17
  26. package/src/scripts/ext/http.ps1 +54 -54
  27. package/src/scripts/ext/http.sh +120 -120
  28. package/src/scripts/ext/intl.sh +23 -23
  29. package/src/scripts/ext/ioncube.ps1 +33 -32
  30. package/src/scripts/ext/ioncube.sh +21 -19
  31. package/src/scripts/ext/oci.ps1 +60 -60
  32. package/src/scripts/ext/oci.sh +65 -63
  33. package/src/scripts/ext/patches/firebird.sh +11 -11
  34. package/src/scripts/ext/patches/geos.sh +7 -7
  35. package/src/scripts/ext/patches/http.sh +11 -11
  36. package/src/scripts/ext/patches/pdo_oci.sh +6 -6
  37. package/src/scripts/ext/patches/phpize.sh +26 -26
  38. package/src/scripts/ext/patches/protobuf.sh +4 -4
  39. package/src/scripts/ext/phalcon.ps1 +54 -55
  40. package/src/scripts/ext/phalcon.sh +59 -59
  41. package/src/scripts/ext/source.sh +144 -144
  42. package/src/scripts/linux.sh +239 -280
  43. package/src/scripts/tools/add_tools.ps1 +28 -25
  44. package/src/scripts/tools/add_tools.sh +27 -19
  45. package/src/scripts/tools/blackfire.ps1 +19 -21
  46. package/src/scripts/tools/blackfire.sh +40 -35
  47. package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
  48. package/src/scripts/tools/grpc_php_plugin.sh +58 -61
  49. package/src/scripts/tools/ppa.sh +189 -0
  50. package/src/scripts/tools/protoc.ps1 +38 -38
  51. package/src/scripts/tools/protoc.sh +28 -28
  52. package/src/scripts/win32.ps1 +566 -471
  53. package/src/tools.ts +538 -509
  54. package/src/utils.ts +503 -497
  55. package/.eslintrc.json +0 -16
  56. package/.github/CODE_OF_CONDUCT.md +0 -76
  57. package/.github/CONTRIBUTING.md +0 -70
  58. package/.github/FUNDING.yml +0 -7
  59. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  60. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
  61. package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
  62. package/.github/SECURITY.md +0 -29
  63. package/.github/workflows/docs.yml +0 -77
  64. package/.github/workflows/node-workflow.yml +0 -51
  65. package/.github/workflows/workflow.yml +0 -78
  66. package/.idea/workspace.xml +0 -113
  67. package/.prettierrc.json +0 -12
  68. package/__tests__/config.test.ts +0 -52
  69. package/__tests__/coverage.test.ts +0 -110
  70. package/__tests__/extensions.test.ts +0 -261
  71. package/__tests__/install.test.ts +0 -175
  72. package/__tests__/tools.test.ts +0 -490
  73. package/__tests__/utils.test.ts +0 -303
  74. package/action.yml +0 -29
  75. package/dist/index.js +0 -3001
  76. package/examples/bedrock.yml +0 -32
  77. package/examples/blackfire-player.yml +0 -31
  78. package/examples/blackfire.yml +0 -31
  79. package/examples/cakephp-mysql.yml +0 -114
  80. package/examples/cakephp-postgres.yml +0 -112
  81. package/examples/cakephp.yml +0 -92
  82. package/examples/codeigniter.yml +0 -34
  83. package/examples/laravel-mysql.yml +0 -74
  84. package/examples/laravel-postgres.yml +0 -74
  85. package/examples/laravel.yml +0 -42
  86. package/examples/lumen-mysql.yml +0 -74
  87. package/examples/lumen-postgres.yml +0 -74
  88. package/examples/lumen.yml +0 -38
  89. package/examples/phalcon-mysql.yml +0 -74
  90. package/examples/phalcon-postgres.yml +0 -73
  91. package/examples/sage.yml +0 -57
  92. package/examples/slim-framework.yml +0 -34
  93. package/examples/symfony-mysql.yml +0 -57
  94. package/examples/symfony-postgres.yml +0 -55
  95. package/examples/symfony.yml +0 -39
  96. package/examples/yii2-mysql.yml +0 -73
  97. package/examples/yii2-postgres.yml +0 -71
  98. package/examples/zend-framework.yml +0 -36
  99. package/jest.config.js +0 -12
  100. package/lib/config.js +0 -72
  101. package/lib/config.js.map +0 -1
  102. package/lib/coverage.js +0 -88
  103. package/lib/coverage.js.map +0 -1
  104. package/lib/extensions.js +0 -201
  105. package/lib/extensions.js.map +0 -1
  106. package/lib/install.js +0 -82
  107. package/lib/install.js.map +0 -1
  108. package/lib/sapi.js +0 -64
  109. package/lib/tools.js +0 -387
  110. package/lib/tools.js.map +0 -1
  111. package/lib/utils.js +0 -292
  112. package/lib/utils.js.map +0 -1
  113. package/tsconfig.json +0 -18
@@ -1,144 +1,144 @@
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
+ 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
+ disable_extension_helper "$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
+ }