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