mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Improve support for phive
This commit is contained in:
parent
8983fb3ae2
commit
77ac7d57f1
@ -200,14 +200,19 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking addPhive', async () => {
|
it('checking addPhive', async () => {
|
||||||
let script: string = await tools.addPhive('1.2.3', 'linux');
|
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
);
|
);
|
||||||
|
|
||||||
script = await tools.addPhive('latest', 'win32');
|
script = await tools.addPhive('latest', '5.6', 'win32');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://phar.io/releases/phive.phar phive'
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addPhive('latest', '7.1', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
13
dist/index.js
vendored
13
dist/index.js
vendored
@ -1808,9 +1808,18 @@ exports.getCodeceptionUri = getCodeceptionUri;
|
|||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
|
* @param php_version
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
async function addPhive(version, os_version) {
|
async function addPhive(version, php_version, os_version) {
|
||||||
|
switch (true) {
|
||||||
|
case /5\.6|7\.0/.test(php_version):
|
||||||
|
version = version.replace('latest', '0.12.1');
|
||||||
|
break;
|
||||||
|
case /7\.1/.test(php_version):
|
||||||
|
version = version.replace('latest', '0.13.5');
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
return ((await getCommand(os_version, 'tool')) +
|
return ((await getCommand(os_version, 'tool')) +
|
||||||
@ -2028,7 +2037,7 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case 'phive':
|
||||||
script += await addPhive(version, os_version);
|
script += await addPhive(version, php_version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
|
12
src/tools.ts
12
src/tools.ts
@ -180,12 +180,22 @@ export async function getCodeceptionUri(
|
|||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
|
* @param php_version
|
||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
export async function addPhive(
|
export async function addPhive(
|
||||||
version: string,
|
version: string,
|
||||||
|
php_version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
switch (true) {
|
||||||
|
case /5\.6|7\.0/.test(php_version):
|
||||||
|
version = version.replace('latest', '0.12.1');
|
||||||
|
break;
|
||||||
|
case /7\.1/.test(php_version):
|
||||||
|
version = version.replace('latest', '0.13.5');
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
return (
|
return (
|
||||||
@ -458,7 +468,7 @@ export async function addTools(
|
|||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case 'phive':
|
||||||
script += await addPhive(version, os_version);
|
script += await addPhive(version, php_version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
|
Loading…
Reference in New Issue
Block a user