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.
- package/LICENSE +21 -21
- package/README.md +990 -922
- 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 +5 -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 +214 -200
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +63 -0
- package/lib/fetch.js.map +1 -0
- package/lib/install.d.ts +2 -0
- package/lib/install.js +75 -81
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +23 -0
- package/lib/tools.js +367 -386
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +261 -291
- package/lib/utils.js.map +1 -1
- package/package.json +67 -56
- package/src/config.ts +82 -82
- package/src/configs/brew_extensions +31 -0
- package/src/configs/composer.env +2 -0
- package/src/configs/ini/jit.ini +3 -0
- package/src/configs/ini/php.ini +2 -0
- package/src/configs/ini/xdebug.ini +1 -0
- package/src/configs/os_releases.csv +19 -17
- package/src/configs/php-versions.json +6 -5
- package/src/configs/php_packages +12 -0
- package/src/configs/{php.json → pm/php.json} +29 -29
- package/src/configs/{phpunit.json → pm/phpunit.json} +24 -24
- package/src/configs/tools.json +278 -235
- package/src/configs/tools_schema.json +125 -114
- package/src/coverage.ts +144 -142
- package/src/extensions.ts +367 -349
- package/src/fetch.ts +54 -0
- package/src/install.ts +66 -82
- package/src/scripts/darwin.sh +285 -249
- package/src/scripts/extensions/add_extensions.ps1 +194 -0
- package/src/scripts/extensions/add_extensions.sh +184 -0
- package/src/scripts/{ext → extensions}/blackfire.ps1 +32 -32
- package/src/scripts/{ext → extensions}/blackfire.sh +22 -21
- package/src/scripts/{ext → extensions}/couchbase.sh +43 -43
- package/src/scripts/{ext → extensions}/cubrid.sh +60 -60
- package/src/scripts/extensions/extension_map.php +132 -0
- package/src/scripts/{ext → extensions}/firebird.ps1 +19 -19
- package/src/scripts/{ext → extensions}/firebird.sh +39 -35
- package/src/scripts/{ext → extensions}/gearman.sh +22 -22
- package/src/scripts/{ext → extensions}/geos.sh +17 -17
- package/src/scripts/{ext → extensions}/http.ps1 +54 -54
- package/src/scripts/{ext → extensions}/http.sh +109 -120
- package/src/scripts/{ext → extensions}/intl.sh +23 -23
- package/src/scripts/{ext → extensions}/ioncube.ps1 +33 -32
- package/src/scripts/{ext → extensions}/ioncube.sh +21 -19
- package/src/scripts/{ext → extensions}/oci.ps1 +85 -60
- package/src/scripts/{ext → extensions}/oci.sh +65 -63
- package/src/scripts/{ext → extensions}/patches/firebird.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/geos.sh +7 -7
- package/src/scripts/{ext → extensions}/patches/http.sh +11 -11
- package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +6 -6
- package/src/scripts/{ext → extensions}/patches/phpize.sh +26 -26
- package/src/scripts/{ext → extensions}/patches/protobuf.sh +4 -4
- package/src/scripts/{ext → extensions}/phalcon.ps1 +54 -54
- package/src/scripts/{ext → extensions}/phalcon.sh +58 -58
- package/src/scripts/{ext → extensions}/source.sh +145 -144
- package/src/scripts/extensions/sqlsrv.sh +15 -0
- package/src/scripts/linux.sh +269 -256
- package/src/scripts/tools/add_tools.ps1 +239 -26
- package/src/scripts/tools/add_tools.sh +175 -20
- package/src/scripts/tools/blackfire.ps1 +19 -19
- package/src/scripts/tools/blackfire.sh +40 -39
- package/src/scripts/tools/grpc_php_plugin.ps1 +21 -21
- package/src/scripts/tools/grpc_php_plugin.sh +58 -58
- package/src/scripts/tools/ppa.sh +192 -151
- package/src/scripts/tools/protoc.ps1 +38 -38
- package/src/scripts/tools/protoc.sh +28 -28
- package/src/scripts/tools/symfony.ps1 +14 -0
- package/src/scripts/tools/symfony.sh +13 -0
- package/src/scripts/unix.sh +186 -0
- package/src/scripts/win32.ps1 +352 -494
- package/src/tools.ts +512 -538
- package/src/utils.ts +415 -500
- package/.eslintrc.json +0 -16
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/CONTRIBUTING.md +0 -70
- package/.github/FUNDING.yml +0 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -37
- package/.github/SECURITY.md +0 -29
- package/.github/workflows/docs.yml +0 -77
- package/.github/workflows/node-workflow.yml +0 -51
- package/.github/workflows/workflow.yml +0 -78
- 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 -263
- package/__tests__/install.test.ts +0 -175
- package/__tests__/tools.test.ts +0 -524
- package/__tests__/utils.test.ts +0 -307
- package/action.yml +0 -29
- package/dist/index.js +0 -3051
- package/examples/bedrock.yml +0 -32
- package/examples/blackfire-player.yml +0 -31
- package/examples/blackfire.yml +0 -31
- 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 -57
- package/examples/symfony-postgres.yml +0 -55
- 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/src/scripts/common.sh +0 -314
- package/tsconfig.json +0 -18
package/src/fetch.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {IncomingMessage, OutgoingHttpHeaders} from 'http';
|
|
2
|
+
import * as https from 'https';
|
|
3
|
+
import * as url from 'url';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Function to fetch an URL
|
|
7
|
+
*
|
|
8
|
+
* @param input_url
|
|
9
|
+
* @param auth_token
|
|
10
|
+
*/
|
|
11
|
+
export async function fetch(
|
|
12
|
+
input_url: string,
|
|
13
|
+
auth_token?: string,
|
|
14
|
+
redirect_count = 5
|
|
15
|
+
): Promise<Record<string, string>> {
|
|
16
|
+
const fetch_promise: Promise<Record<string, string>> = new Promise(
|
|
17
|
+
resolve => {
|
|
18
|
+
const url_object: url.UrlObject = new url.URL(input_url);
|
|
19
|
+
const headers: OutgoingHttpHeaders = {
|
|
20
|
+
'User-Agent': `Mozilla/5.0 (${process.platform} ${process.arch}) setup-php`
|
|
21
|
+
};
|
|
22
|
+
if (auth_token) {
|
|
23
|
+
headers.authorization = 'Bearer ' + auth_token;
|
|
24
|
+
}
|
|
25
|
+
const options: https.RequestOptions = {
|
|
26
|
+
hostname: url_object.hostname,
|
|
27
|
+
path: url_object.pathname,
|
|
28
|
+
headers: headers
|
|
29
|
+
};
|
|
30
|
+
const req = https.get(options, (res: IncomingMessage) => {
|
|
31
|
+
if (res.statusCode === 200) {
|
|
32
|
+
let body = '';
|
|
33
|
+
res.setEncoding('utf8');
|
|
34
|
+
res.on('data', chunk => (body += chunk));
|
|
35
|
+
res.on('end', () => resolve({data: `${body}`}));
|
|
36
|
+
} else if (
|
|
37
|
+
[301, 302, 303, 307, 308].includes(res.statusCode as number)
|
|
38
|
+
) {
|
|
39
|
+
if (redirect_count > 0 && res.headers.location) {
|
|
40
|
+
fetch(res.headers.location, auth_token, redirect_count--).then(
|
|
41
|
+
resolve
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
resolve({error: `${res.statusCode}: Redirect error`});
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
resolve({error: `${res.statusCode}: ${res.statusMessage}`});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
req.end();
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
return await fetch_promise;
|
|
54
|
+
}
|
package/src/install.ts
CHANGED
|
@@ -1,82 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
*/
|
|
16
|
-
export async function getScript(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (extension_csv) {
|
|
34
|
-
script += await extensions.addExtension(extension_csv, version,
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
script += '\n' + (await utils.stepLog(
|
|
44
|
-
script += '\n' + (await utils.addLog('$tick',
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const location = await getScript(script, version, os_version);
|
|
68
|
-
await exec(await utils.joins(tool, location, version, __dirname));
|
|
69
|
-
} else {
|
|
70
|
-
core.setFailed('Unable to get the PHP version');
|
|
71
|
-
}
|
|
72
|
-
} catch (error) {
|
|
73
|
-
core.setFailed(error.message);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// call the run function
|
|
78
|
-
(async () => {
|
|
79
|
-
await run();
|
|
80
|
-
})().catch(error => {
|
|
81
|
-
core.setFailed(error.message);
|
|
82
|
-
});
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import {exec} from '@actions/exec';
|
|
4
|
+
import * as core from '@actions/core';
|
|
5
|
+
import * as config from './config';
|
|
6
|
+
import * as coverage from './coverage';
|
|
7
|
+
import * as extensions from './extensions';
|
|
8
|
+
import * as tools from './tools';
|
|
9
|
+
import * as utils from './utils';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Build the script
|
|
13
|
+
*
|
|
14
|
+
* @param os
|
|
15
|
+
*/
|
|
16
|
+
export async function getScript(os: string): Promise<string> {
|
|
17
|
+
const url = 'https://setup-php.com/sponsor';
|
|
18
|
+
const filename = os + (await utils.scriptExtension(os));
|
|
19
|
+
const script_path = path.join(__dirname, '../src/scripts', filename);
|
|
20
|
+
const run_path = script_path.replace(os, 'run');
|
|
21
|
+
process.env['fail_fast'] = await utils.getInput('fail-fast', false);
|
|
22
|
+
const extension_csv: string = await utils.getInput('extensions', false);
|
|
23
|
+
const ini_values_csv: string = await utils.getInput('ini-values', false);
|
|
24
|
+
const coverage_driver: string = await utils.getInput('coverage', false);
|
|
25
|
+
const tools_csv: string = await utils.getInput('tools', false);
|
|
26
|
+
const version: string = await utils.parseVersion(
|
|
27
|
+
await utils.getInput('php-version', true)
|
|
28
|
+
);
|
|
29
|
+
const ini_file: string = await utils.parseIniFile(
|
|
30
|
+
await utils.getInput('ini-file', false)
|
|
31
|
+
);
|
|
32
|
+
let script = await utils.joins('.', script_path, version, ini_file);
|
|
33
|
+
if (extension_csv) {
|
|
34
|
+
script += await extensions.addExtension(extension_csv, version, os);
|
|
35
|
+
}
|
|
36
|
+
script += await tools.addTools(tools_csv, version, os);
|
|
37
|
+
if (coverage_driver) {
|
|
38
|
+
script += await coverage.addCoverage(coverage_driver, version, os);
|
|
39
|
+
}
|
|
40
|
+
if (ini_values_csv) {
|
|
41
|
+
script += await config.addINIValues(ini_values_csv, os);
|
|
42
|
+
}
|
|
43
|
+
script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os));
|
|
44
|
+
script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os));
|
|
45
|
+
|
|
46
|
+
fs.writeFileSync(run_path, script, {mode: 0o755});
|
|
47
|
+
|
|
48
|
+
return run_path;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Run the script
|
|
53
|
+
*/
|
|
54
|
+
export async function run(): Promise<void> {
|
|
55
|
+
const os: string = process.platform;
|
|
56
|
+
const tool = await utils.scriptTool(os);
|
|
57
|
+
const run_path = await getScript(os);
|
|
58
|
+
await exec(tool + run_path);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// call the run function
|
|
62
|
+
(async () => {
|
|
63
|
+
await run();
|
|
64
|
+
})().catch(error => {
|
|
65
|
+
core.setFailed(error.message);
|
|
66
|
+
});
|