setup-php 1.11.2 → 1.11.6
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/LICENSE +21 -21
- package/README.md +433 -458
- package/lib/config.d.ts +3 -0
- package/lib/config.js +71 -71
- package/lib/config.js.map +1 -1
- package/lib/coverage.d.ts +4 -0
- package/lib/coverage.js +97 -87
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.d.ts +4 -0
- package/lib/extensions.js +188 -200
- package/lib/extensions.js.map +1 -1
- package/lib/install.d.ts +2 -0
- package/lib/install.js +96 -81
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +18 -0
- package/lib/tools.js +306 -386
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +15 -0
- package/lib/utils.js +205 -291
- package/lib/utils.js.map +1 -1
- package/package.json +66 -56
- package/src/config.ts +82 -82
- package/src/configs/brew_extensions +28 -0
- package/src/configs/php-versions.json +5 -5
- package/src/configs/phpunit.json +24 -24
- package/src/coverage.ts +146 -146
- package/src/extensions.ts +235 -233
- package/src/install.ts +104 -104
- package/src/scripts/darwin.sh +341 -339
- package/src/scripts/ext/gearman.sh +22 -22
- package/src/scripts/ext/phalcon.ps1 +55 -55
- package/src/scripts/ext/phalcon.sh +70 -70
- package/src/scripts/linux.sh +361 -361
- package/src/scripts/win32.ps1 +326 -333
- package/src/tools.ts +472 -469
- package/src/utils.ts +319 -316
- package/.eslintrc.json +0 -16
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/CONTRIBUTING.md +0 -69
- package/.github/FUNDING.yml +0 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -38
- package/.github/SECURITY.md +0 -29
- package/.github/workflows/main-workflow.yml +0 -56
- package/.github/workflows/node-workflow.yml +0 -47
- package/.idea/workspace.xml +0 -113
- package/.prettierrc.json +0 -12
- package/__tests__/config.test.ts +0 -52
- package/__tests__/coverage.test.ts +0 -110
- package/__tests__/extensions.test.ts +0 -120
- package/__tests__/install.test.ts +0 -181
- package/__tests__/tools.test.ts +0 -476
- package/__tests__/utils.test.ts +0 -213
- package/action.yml +0 -38
- package/dist/index.js +0 -2854
- package/examples/bedrock.yml +0 -32
- package/examples/cakephp-mysql.yml +0 -114
- package/examples/cakephp-postgres.yml +0 -112
- package/examples/cakephp.yml +0 -92
- package/examples/codeigniter.yml +0 -34
- package/examples/laravel-mysql.yml +0 -74
- package/examples/laravel-postgres.yml +0 -74
- package/examples/laravel.yml +0 -42
- package/examples/lumen-mysql.yml +0 -74
- package/examples/lumen-postgres.yml +0 -74
- package/examples/lumen.yml +0 -38
- package/examples/phalcon-mysql.yml +0 -74
- package/examples/phalcon-postgres.yml +0 -73
- package/examples/sage.yml +0 -57
- package/examples/slim-framework.yml +0 -34
- package/examples/symfony-mysql.yml +0 -56
- package/examples/symfony-postgres.yml +0 -54
- package/examples/symfony.yml +0 -39
- package/examples/yii2-mysql.yml +0 -73
- package/examples/yii2-postgres.yml +0 -71
- package/examples/zend-framework.yml +0 -36
- package/jest.config.js +0 -12
- package/lib/sapi.js +0 -64
- package/tsconfig.json +0 -18
package/__tests__/utils.test.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as utils from '../src/utils';
|
|
4
|
-
|
|
5
|
-
jest.mock('@actions/core', () => ({
|
|
6
|
-
getInput: jest.fn().mockImplementation(key => {
|
|
7
|
-
return ['setup-php'].indexOf(key) !== -1 ? key : '';
|
|
8
|
-
})
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise<string> => {
|
|
12
|
-
return `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
async function cleanup(path: string): Promise<void> {
|
|
16
|
-
fs.unlink(path, error => {
|
|
17
|
-
if (error) {
|
|
18
|
-
console.log(error);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('Utils tests', () => {
|
|
24
|
-
it('checking readEnv', async () => {
|
|
25
|
-
process.env['test'] = 'setup-php';
|
|
26
|
-
expect(await utils.readEnv('test')).toBe('setup-php');
|
|
27
|
-
expect(await utils.readEnv('undefined')).toBe('');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('checking getInput', async () => {
|
|
31
|
-
expect(await utils.getInput('test', false)).toBe('setup-php');
|
|
32
|
-
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
|
33
|
-
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
|
34
|
-
expect(async () => {
|
|
35
|
-
await utils.getInput('DoesNotExist', true);
|
|
36
|
-
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('checking fetch', async () => {
|
|
40
|
-
expect(await utils.fetch('test_url')).toBe(
|
|
41
|
-
'{ "latest": "8.0", "5.x": "5.6", "url": "test_url" }'
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('checking parseVersion', async () => {
|
|
46
|
-
expect(await utils.parseVersion('latest')).toBe('8.0');
|
|
47
|
-
expect(await utils.parseVersion('7')).toBe('7.0');
|
|
48
|
-
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
|
49
|
-
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
|
50
|
-
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('checking asyncForEach', async () => {
|
|
54
|
-
const array: Array<string> = ['a', 'b', 'c'];
|
|
55
|
-
let concat = '';
|
|
56
|
-
await utils.asyncForEach(
|
|
57
|
-
array,
|
|
58
|
-
async function (str: string): Promise<void> {
|
|
59
|
-
concat += str;
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
expect(concat).toBe('abc');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('checking asyncForEach', async () => {
|
|
66
|
-
expect(await utils.color('error')).toBe('31');
|
|
67
|
-
expect(await utils.color('success')).toBe('32');
|
|
68
|
-
expect(await utils.color('any')).toBe('32');
|
|
69
|
-
expect(await utils.color('warning')).toBe('33');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('checking readScripts', async () => {
|
|
73
|
-
const darwin: string = fs.readFileSync(
|
|
74
|
-
path.join(__dirname, '../src/scripts/darwin.sh'),
|
|
75
|
-
'utf8'
|
|
76
|
-
);
|
|
77
|
-
const linux: string = fs.readFileSync(
|
|
78
|
-
path.join(__dirname, '../src/scripts/linux.sh'),
|
|
79
|
-
'utf8'
|
|
80
|
-
);
|
|
81
|
-
const win32: string = fs.readFileSync(
|
|
82
|
-
path.join(__dirname, '../src/scripts/win32.ps1'),
|
|
83
|
-
'utf8'
|
|
84
|
-
);
|
|
85
|
-
expect(await utils.readScript('darwin.sh')).toBe(darwin);
|
|
86
|
-
expect(await utils.readScript('darwin.sh')).toBe(darwin);
|
|
87
|
-
expect(await utils.readScript('linux.sh')).toBe(linux);
|
|
88
|
-
expect(await utils.readScript('linux.sh')).toBe(linux);
|
|
89
|
-
expect(await utils.readScript('win32.ps1')).toBe(win32);
|
|
90
|
-
expect(await utils.readScript('win32.ps1')).toBe(win32);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('checking writeScripts', async () => {
|
|
94
|
-
const testString = 'sudo apt-get install php';
|
|
95
|
-
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
|
|
96
|
-
const script_path: string = path.join(runner_dir, 'test.sh');
|
|
97
|
-
await utils.writeScript('test.sh', testString);
|
|
98
|
-
fs.readFile(script_path, function (error: Error | null, data: Buffer) {
|
|
99
|
-
expect(testString).toBe(data.toString());
|
|
100
|
-
});
|
|
101
|
-
await cleanup(script_path);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('checking extensionArray', async () => {
|
|
105
|
-
expect(await utils.extensionArray('a, b, php_c, php-d')).toEqual([
|
|
106
|
-
'a',
|
|
107
|
-
'b',
|
|
108
|
-
'c',
|
|
109
|
-
'd'
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
expect(await utils.extensionArray('')).toEqual([]);
|
|
113
|
-
expect(await utils.extensionArray(' ')).toEqual([]);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('checking INIArray', async () => {
|
|
117
|
-
expect(await utils.CSVArray('a=1, b=2, c=3')).toEqual([
|
|
118
|
-
'a=1',
|
|
119
|
-
'b=2',
|
|
120
|
-
'c=3'
|
|
121
|
-
]);
|
|
122
|
-
expect(await utils.CSVArray('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([
|
|
123
|
-
'a=1,2',
|
|
124
|
-
'b=3, 4',
|
|
125
|
-
'c=5',
|
|
126
|
-
"d='~e~'"
|
|
127
|
-
]);
|
|
128
|
-
expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([
|
|
129
|
-
'a=1,2',
|
|
130
|
-
'b=3, 4',
|
|
131
|
-
'c=5'
|
|
132
|
-
]);
|
|
133
|
-
expect(await utils.CSVArray('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([
|
|
134
|
-
'a=1,2',
|
|
135
|
-
'b=3, 4',
|
|
136
|
-
'c=5',
|
|
137
|
-
"d='~e~'"
|
|
138
|
-
]);
|
|
139
|
-
expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([
|
|
140
|
-
'a=1,2',
|
|
141
|
-
'b=3, 4',
|
|
142
|
-
'c=5'
|
|
143
|
-
]);
|
|
144
|
-
expect(await utils.CSVArray('')).toEqual([]);
|
|
145
|
-
expect(await utils.CSVArray(' ')).toEqual([]);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('checking log', async () => {
|
|
149
|
-
const message = 'Test message';
|
|
150
|
-
|
|
151
|
-
let warning_log: string = await utils.log(message, 'win32', 'warning');
|
|
152
|
-
expect(warning_log).toEqual('printf "\\033[33;1m' + message + ' \\033[0m"');
|
|
153
|
-
warning_log = await utils.log(message, 'linux', 'warning');
|
|
154
|
-
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
|
155
|
-
warning_log = await utils.log(message, 'darwin', 'warning');
|
|
156
|
-
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
|
157
|
-
|
|
158
|
-
let error_log: string = await utils.log(message, 'win32', 'error');
|
|
159
|
-
expect(error_log).toEqual('printf "\\033[31;1m' + message + ' \\033[0m"');
|
|
160
|
-
error_log = await utils.log(message, 'linux', 'error');
|
|
161
|
-
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
|
162
|
-
error_log = await utils.log(message, 'darwin', 'error');
|
|
163
|
-
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
|
164
|
-
|
|
165
|
-
let success_log: string = await utils.log(message, 'win32', 'success');
|
|
166
|
-
expect(success_log).toEqual('printf "\\033[32;1m' + message + ' \\033[0m"');
|
|
167
|
-
success_log = await utils.log(message, 'linux', 'success');
|
|
168
|
-
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
|
169
|
-
success_log = await utils.log(message, 'darwin', 'success');
|
|
170
|
-
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
|
171
|
-
|
|
172
|
-
let step_log: string = await utils.stepLog(message, 'win32');
|
|
173
|
-
expect(step_log).toEqual('Step-Log "Test message"');
|
|
174
|
-
step_log = await utils.stepLog(message, 'linux');
|
|
175
|
-
expect(step_log).toEqual('step_log "Test message"');
|
|
176
|
-
step_log = await utils.stepLog(message, 'darwin');
|
|
177
|
-
expect(step_log).toEqual('step_log "Test message"');
|
|
178
|
-
step_log = await utils.stepLog(message, 'openbsd');
|
|
179
|
-
expect(step_log).toContain('Platform openbsd is not supported');
|
|
180
|
-
|
|
181
|
-
let add_log: string = await utils.addLog(
|
|
182
|
-
'tick',
|
|
183
|
-
'xdebug',
|
|
184
|
-
'enabled',
|
|
185
|
-
'win32'
|
|
186
|
-
);
|
|
187
|
-
expect(add_log).toEqual('Add-Log "tick" "xdebug" "enabled"');
|
|
188
|
-
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'linux');
|
|
189
|
-
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
|
190
|
-
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
|
191
|
-
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
|
192
|
-
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'openbsd');
|
|
193
|
-
expect(add_log).toContain('Platform openbsd is not supported');
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it('checking getExtensionPrefix', async () => {
|
|
197
|
-
expect(await utils.getExtensionPrefix('extensionDoesNotExist')).toEqual(
|
|
198
|
-
'extension'
|
|
199
|
-
);
|
|
200
|
-
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
|
|
201
|
-
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
|
|
202
|
-
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('checking suppressOutput', async () => {
|
|
206
|
-
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
|
207
|
-
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
|
208
|
-
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
|
209
|
-
expect(await utils.suppressOutput('openbsd')).toContain(
|
|
210
|
-
'Platform openbsd is not supported'
|
|
211
|
-
);
|
|
212
|
-
});
|
|
213
|
-
});
|
package/action.yml
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
name: 'Setup PHP Action'
|
|
2
|
-
author: shivammathur
|
|
3
|
-
description: 'GitHub Action for PHP'
|
|
4
|
-
branding:
|
|
5
|
-
color: 'purple'
|
|
6
|
-
icon: 'play-circle'
|
|
7
|
-
inputs:
|
|
8
|
-
php-version:
|
|
9
|
-
description: 'Setup PHP version.'
|
|
10
|
-
default: '7.4'
|
|
11
|
-
required: true
|
|
12
|
-
extensions:
|
|
13
|
-
description: 'Setup PHP extensions.'
|
|
14
|
-
required: false
|
|
15
|
-
ini-values:
|
|
16
|
-
description: 'Add values to php.ini.'
|
|
17
|
-
required: false
|
|
18
|
-
coverage:
|
|
19
|
-
description: 'Setup code coverage driver.'
|
|
20
|
-
required: false
|
|
21
|
-
tools:
|
|
22
|
-
description: 'Setup popular tools globally.'
|
|
23
|
-
required: false
|
|
24
|
-
extension-csv:
|
|
25
|
-
description: 'Deprecated! Use extensions instead.'
|
|
26
|
-
deprecationMessage: 'The extension-csv property is deprecated. Use extensions instead.'
|
|
27
|
-
required: false
|
|
28
|
-
ini-values-csv:
|
|
29
|
-
description: 'Deprecated! Use ini-values instead.'
|
|
30
|
-
deprecationMessage: 'The ini-values-csv property is deprecated. Use ini-values instead.'
|
|
31
|
-
required: false
|
|
32
|
-
pecl:
|
|
33
|
-
description: 'Deprecated! Use tools instead to setup PECL.'
|
|
34
|
-
deprecationMessage: 'The pecl property is deprecated. Specify pecl in tools instead.'
|
|
35
|
-
required: false
|
|
36
|
-
runs:
|
|
37
|
-
using: 'node12'
|
|
38
|
-
main: 'dist/index.js'
|