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,115 +1,126 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/tools_schema.json",
4
- "type": "object",
5
- "title": "Tools",
6
- "default": {},
7
- "examples": [
8
- {
9
- "tool": {
10
- "alias": "tool_alias",
11
- "domain": "https://example.com",
12
- "extension": ".ext",
13
- "fetch_latest": "true",
14
- "function": "function_name",
15
- "repository": "user/tool",
16
- "type": "phar, composer, custom-package or custom-function",
17
- "version_parameter": "--version",
18
- "version_prefix": "v"
19
- }
20
- }
21
- ],
22
- "items": {
23
- "properties": {
24
- "alias": {
25
- "$id": "#/items/properties/alias",
26
- "type": "string",
27
- "title": "The alias schema",
28
- "description": "Alias for a tool.",
29
- "examples": [
30
- "tool_alias"
31
- ]
32
- },
33
- "domain": {
34
- "$id": "#/items/properties/domain",
35
- "type": "string",
36
- "title": "The domain schema",
37
- "description": "Domain URL of the tool.",
38
- "examples": [
39
- "https://example.com"
40
- ]
41
- },
42
- "extension": {
43
- "$id": "#/items/properties/extension",
44
- "type": "string",
45
- "title": "The extension schema",
46
- "description": "File extension of the tool.",
47
- "examples": [
48
- ".ext"
49
- ]
50
- },
51
- "fetch_latest": {
52
- "$id": "#/items/properties/fetch_latest",
53
- "type": "string",
54
- "title": "The fetch_latest schema",
55
- "description": "Fetch the latest version from GitHub releases.",
56
- "enum": [
57
- "true",
58
- "false"
59
- ]
60
- },
61
- "function": {
62
- "$id": "#/items/properties/function",
63
- "type": "string",
64
- "title": "The function schema",
65
- "description": "Function name in tools.ts which returns the script to setup the tool.",
66
- "examples": [
67
- "function_name"
68
- ]
69
- },
70
- "repository": {
71
- "$id": "#/items/properties/repository",
72
- "type": "string",
73
- "title": "The repository schema",
74
- "description": "GitHub repository of the tool.",
75
- "examples": [
76
- "user/tool"
77
- ]
78
- },
79
- "type": {
80
- "$id": "#/items/properties/type",
81
- "type": "string",
82
- "title": "The type schema",
83
- "description": "Type of tool: phar, composer, custom-package or custom-function.",
84
- "enum": [
85
- "phar",
86
- "composer",
87
- "custom-package",
88
- "custom-function"
89
- ]
90
- },
91
- "version_parameter": {
92
- "$id": "#/items/properties/version_parameter",
93
- "type": "string",
94
- "title": "The version_parameter schema",
95
- "description": "Parameter to get the tool version.",
96
- "examples": [
97
- "--version"
98
- ]
99
- },
100
- "version_prefix": {
101
- "$id": "#/items/properties/version_prefix",
102
- "type": "string",
103
- "title": "The version_prefix schema",
104
- "description": "Prefix of the version in the download URL.",
105
- "examples": [
106
- "v"
107
- ]
108
- }
109
- },
110
- "required": [
111
- "type"
112
- ],
113
- "additionalProperties": true
114
- }
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/tools_schema.json",
4
+ "type": "object",
5
+ "title": "Tools",
6
+ "default": {},
7
+ "examples": [
8
+ {
9
+ "tool": {
10
+ "alias": "tool_alias",
11
+ "domain": "https://example.com",
12
+ "extension": ".ext",
13
+ "fetch_latest": "true",
14
+ "function": "function_name",
15
+ "repository": "user/tool",
16
+ "scope": "global, scoped",
17
+ "type": "phar, composer, custom-package or custom-function",
18
+ "version_parameter": "--version",
19
+ "version_prefix": "v"
20
+ }
21
+ }
22
+ ],
23
+ "items": {
24
+ "properties": {
25
+ "alias": {
26
+ "$id": "#/items/properties/alias",
27
+ "type": "string",
28
+ "title": "The alias schema",
29
+ "description": "Alias for a tool.",
30
+ "examples": [
31
+ "tool_alias"
32
+ ]
33
+ },
34
+ "domain": {
35
+ "$id": "#/items/properties/domain",
36
+ "type": "string",
37
+ "title": "The domain schema",
38
+ "description": "Domain URL of the tool.",
39
+ "examples": [
40
+ "https://example.com"
41
+ ]
42
+ },
43
+ "extension": {
44
+ "$id": "#/items/properties/extension",
45
+ "type": "string",
46
+ "title": "The extension schema",
47
+ "description": "File extension of the tool.",
48
+ "examples": [
49
+ ".ext"
50
+ ]
51
+ },
52
+ "fetch_latest": {
53
+ "$id": "#/items/properties/fetch_latest",
54
+ "type": "string",
55
+ "title": "The fetch_latest schema",
56
+ "description": "Fetch the latest version from GitHub releases.",
57
+ "enum": [
58
+ "true",
59
+ "false"
60
+ ]
61
+ },
62
+ "function": {
63
+ "$id": "#/items/properties/function",
64
+ "type": "string",
65
+ "title": "The function schema",
66
+ "description": "Function name in tools.ts which returns the script to setup the tool.",
67
+ "examples": [
68
+ "function_name"
69
+ ]
70
+ },
71
+ "repository": {
72
+ "$id": "#/items/properties/repository",
73
+ "type": "string",
74
+ "title": "The repository schema",
75
+ "description": "GitHub repository of the tool.",
76
+ "examples": [
77
+ "user/tool"
78
+ ]
79
+ },
80
+ "scope": {
81
+ "$id": "#/items/properties/scope",
82
+ "type": "string",
83
+ "title": "The scope schema",
84
+ "description": "Scope of tool installation: global or scoped",
85
+ "enum": [
86
+ "global",
87
+ "scoped"
88
+ ]
89
+ },
90
+ "type": {
91
+ "$id": "#/items/properties/type",
92
+ "type": "string",
93
+ "title": "The type schema",
94
+ "description": "Type of tool: phar, composer, custom-package or custom-function.",
95
+ "enum": [
96
+ "phar",
97
+ "composer",
98
+ "custom-package",
99
+ "custom-function"
100
+ ]
101
+ },
102
+ "version_parameter": {
103
+ "$id": "#/items/properties/version_parameter",
104
+ "type": "string",
105
+ "title": "The version_parameter schema",
106
+ "description": "Parameter to get the tool version.",
107
+ "examples": [
108
+ "--version"
109
+ ]
110
+ },
111
+ "version_prefix": {
112
+ "$id": "#/items/properties/version_prefix",
113
+ "type": "string",
114
+ "title": "The version_prefix schema",
115
+ "description": "Prefix of the version in the download URL.",
116
+ "examples": [
117
+ "v"
118
+ ]
119
+ }
120
+ },
121
+ "required": [
122
+ "type"
123
+ ],
124
+ "additionalProperties": true
125
+ }
115
126
  }
package/src/coverage.ts CHANGED
@@ -1,142 +1,144 @@
1
- import * as utils from './utils';
2
- import * as extensions from './extensions';
3
- import * as config from './config';
4
-
5
- /**
6
- * Function to setup Xdebug
7
- *
8
- * @param extension
9
- * @param version
10
- * @param os_version
11
- * @param pipe
12
- */
13
- export async function addCoverageXdebug(
14
- extension: string,
15
- version: string,
16
- os_version: string,
17
- pipe: string
18
- ): Promise<string> {
19
- let script = '\n';
20
- script +=
21
- (await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
22
- script +=
23
- (await extensions.addExtension(extension, version, os_version, true)) +
24
- pipe;
25
- script += await utils.addLog(
26
- '$tick',
27
- extension,
28
- 'Xdebug enabled as coverage driver',
29
- os_version
30
- );
31
- return script;
32
- }
33
-
34
- /**
35
- * Function to setup PCOV
36
- *
37
- * @param version
38
- * @param os_version
39
- * @param pipe
40
- */
41
- export async function addCoveragePCOV(
42
- version: string,
43
- os_version: string,
44
- pipe: string
45
- ): Promise<string> {
46
- let script = '\n';
47
- switch (true) {
48
- default:
49
- script +=
50
- (await extensions.addExtension(':xdebug', version, os_version, true)) +
51
- pipe;
52
- script +=
53
- (await extensions.addExtension('pcov', version, os_version, true)) +
54
- pipe;
55
- script +=
56
- (await config.addINIValues('pcov.enabled=1', os_version, true)) + '\n';
57
-
58
- // success
59
- script += await utils.addLog(
60
- '$tick',
61
- 'coverage: pcov',
62
- 'PCOV enabled as coverage driver',
63
- os_version
64
- );
65
- // version is not supported
66
- break;
67
-
68
- case /5\.[3-6]|7\.0/.test(version):
69
- script += await utils.addLog(
70
- '$cross',
71
- 'pcov',
72
- 'PHP 7.1 or newer is required',
73
- os_version
74
- );
75
- break;
76
- }
77
-
78
- return script;
79
- }
80
-
81
- /**
82
- * Function to disable Xdebug and PCOV
83
- *
84
- * @param version
85
- * @param os_version
86
- * @param pipe
87
- */
88
- export async function disableCoverage(
89
- version: string,
90
- os_version: string,
91
- pipe: string
92
- ): Promise<string> {
93
- let script = '\n';
94
- script +=
95
- (await extensions.addExtension(':pcov', version, os_version, true)) + pipe;
96
- script +=
97
- (await extensions.addExtension(':xdebug', version, os_version, true)) +
98
- pipe;
99
- script += await utils.addLog(
100
- '$tick',
101
- 'none',
102
- 'Disabled Xdebug and PCOV',
103
- os_version
104
- );
105
-
106
- return script;
107
- }
108
-
109
- /**
110
- * Function to set coverage driver
111
- *
112
- * @param coverage_driver
113
- * @param version
114
- * @param os_version
115
- */
116
- export async function addCoverage(
117
- coverage_driver: string,
118
- version: string,
119
- os_version: string
120
- ): Promise<string> {
121
- coverage_driver = coverage_driver.toLowerCase();
122
- const script: string =
123
- '\n' + (await utils.stepLog('Setup Coverage', os_version));
124
- const pipe: string = (await utils.suppressOutput(os_version)) + '\n';
125
- switch (coverage_driver) {
126
- case 'pcov':
127
- return script + (await addCoveragePCOV(version, os_version, pipe));
128
- case 'xdebug':
129
- case 'xdebug3':
130
- return (
131
- script + (await addCoverageXdebug('xdebug', version, os_version, pipe))
132
- );
133
- case 'xdebug2':
134
- return (
135
- script + (await addCoverageXdebug('xdebug2', version, os_version, pipe))
136
- );
137
- case 'none':
138
- return script + (await disableCoverage(version, os_version, pipe));
139
- default:
140
- return '';
141
- }
142
- }
1
+ import * as utils from './utils';
2
+ import * as extensions from './extensions';
3
+ import * as config from './config';
4
+
5
+ export async function checkXdebugError(
6
+ extension: string,
7
+ version: string
8
+ ): Promise<string> {
9
+ if (
10
+ (/^5\.[3-6]$|^7\.[0-1]$/.test(version) && extension == 'xdebug3') ||
11
+ (/^8\.[0-9]$/.test(version) && extension == 'xdebug2')
12
+ ) {
13
+ return extension + ' is not supported on PHP ' + version;
14
+ }
15
+ return '';
16
+ }
17
+
18
+ /**
19
+ * Function to setup Xdebug
20
+ *
21
+ * @param extension
22
+ * @param version
23
+ * @param os
24
+ * @param pipe
25
+ */
26
+ export async function addCoverageXdebug(
27
+ extension: string,
28
+ version: string,
29
+ os: string,
30
+ pipe: string
31
+ ): Promise<string> {
32
+ let script = '\n';
33
+ let message: string = await checkXdebugError(extension, version);
34
+ let status = '$cross';
35
+ if (!message) {
36
+ script +=
37
+ (await extensions.addExtension(':pcov:false', version, os, true)) + pipe;
38
+ extension = extension == 'xdebug3' ? 'xdebug' : extension;
39
+ script +=
40
+ (await extensions.addExtension(extension, version, os, true)) + pipe;
41
+ message = 'Xdebug enabled as coverage driver';
42
+ status = '$tick';
43
+ }
44
+ script += await utils.addLog(status, extension, message, os);
45
+ return script;
46
+ }
47
+
48
+ /**
49
+ * Function to setup PCOV
50
+ *
51
+ * @param version
52
+ * @param os
53
+ * @param pipe
54
+ */
55
+ export async function addCoveragePCOV(
56
+ version: string,
57
+ os: string,
58
+ pipe: string
59
+ ): Promise<string> {
60
+ let script = '\n';
61
+ switch (true) {
62
+ default:
63
+ script +=
64
+ (await extensions.addExtension(':xdebug:false', version, os, true)) +
65
+ pipe;
66
+ script +=
67
+ (await extensions.addExtension('pcov', version, os, true)) + pipe;
68
+ script += (await config.addINIValues('pcov.enabled=1', os, true)) + '\n';
69
+
70
+ // success
71
+ script += await utils.addLog(
72
+ '$tick',
73
+ 'coverage: pcov',
74
+ 'PCOV enabled as coverage driver',
75
+ os
76
+ );
77
+ // version is not supported
78
+ break;
79
+
80
+ case /5\.[3-6]|7\.0/.test(version):
81
+ script += await utils.addLog(
82
+ '$cross',
83
+ 'pcov',
84
+ 'PHP 7.1 or newer is required',
85
+ os
86
+ );
87
+ break;
88
+ }
89
+
90
+ return script;
91
+ }
92
+
93
+ /**
94
+ * Function to disable Xdebug and PCOV
95
+ *
96
+ * @param version
97
+ * @param os
98
+ * @param pipe
99
+ */
100
+ export async function disableCoverage(
101
+ version: string,
102
+ os: string,
103
+ pipe: string
104
+ ): Promise<string> {
105
+ let script = '\n';
106
+ script +=
107
+ (await extensions.addExtension(':pcov:false', version, os, true)) + pipe;
108
+ script +=
109
+ (await extensions.addExtension(':xdebug:false', version, os, true)) + pipe;
110
+ script += await utils.addLog('$tick', 'none', 'Disabled Xdebug and PCOV', os);
111
+
112
+ return script;
113
+ }
114
+
115
+ /**
116
+ * Function to set coverage driver
117
+ *
118
+ * @param coverage_driver
119
+ * @param version
120
+ * @param os
121
+ */
122
+ export async function addCoverage(
123
+ coverage_driver: string,
124
+ version: string,
125
+ os: string
126
+ ): Promise<string> {
127
+ coverage_driver = coverage_driver.toLowerCase();
128
+ const script: string = '\n' + (await utils.stepLog('Setup Coverage', os));
129
+ const pipe: string = (await utils.suppressOutput(os)) + '\n';
130
+ switch (coverage_driver) {
131
+ case 'pcov':
132
+ return script + (await addCoveragePCOV(version, os, pipe));
133
+ case 'xdebug':
134
+ case 'xdebug2':
135
+ case 'xdebug3':
136
+ return (
137
+ script + (await addCoverageXdebug(coverage_driver, version, os, pipe))
138
+ );
139
+ case 'none':
140
+ return script + (await disableCoverage(version, os, pipe));
141
+ default:
142
+ return '';
143
+ }
144
+ }