mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for phive
This commit is contained in:
parent
5108c81610
commit
9d6b61c5af
@ -160,6 +160,18 @@ describe('Tools tests', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking addPhive', async () => {
|
||||||
|
let script: string = await tools.addPhive('1.2.3', 'linux');
|
||||||
|
expect(script).toContain(
|
||||||
|
'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');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://phar.io/releases/phive.phar phive'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking getPhpunitUri', async () => {
|
it('checking getPhpunitUri', async () => {
|
||||||
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
|
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
|
||||||
'https://phar.phpunit.de/tool.phar'
|
'https://phar.phpunit.de/tool.phar'
|
||||||
@ -289,7 +301,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it('checking addTools on linux', async () => {
|
it('checking addTools on linux', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, php-config, phpize',
|
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -302,6 +314,9 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://phar.io/releases/phive.phar phive'
|
||||||
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
||||||
);
|
);
|
||||||
@ -314,7 +329,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
it('checking addTools on darwin', async () => {
|
it('checking addTools on darwin', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, composer-prefetcher:1.2.3, phpize, php-config',
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config',
|
||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -337,6 +352,9 @@ describe('Tools tests', () => {
|
|||||||
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
|
||||||
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
);
|
);
|
||||||
@ -345,7 +363,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
it('checking addTools on windows', async () => {
|
it('checking addTools on windows', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'codeception, deployer, prestissimo, phpmd, phinx, php-config, phpize, does_not_exit',
|
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, does_not_exit',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -358,7 +376,13 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Composer-Tool prestissimo prestissimo hirak/'
|
'Add-Composer-Tool prestissimo prestissimo hirak/'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
|
||||||
|
);
|
||||||
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
|
||||||
|
);
|
||||||
expect(script).toContain('phpize is not a windows tool');
|
expect(script).toContain('phpize is not a windows tool');
|
||||||
expect(script).toContain('php-config is not a windows tool');
|
expect(script).toContain('php-config is not a windows tool');
|
||||||
expect(script).toContain('Tool does_not_exit is not supported');
|
expect(script).toContain('Tool does_not_exit is not supported');
|
||||||
|
28
dist/index.js
vendored
28
dist/index.js
vendored
@ -1731,6 +1731,31 @@ function getCodeceptionUri(version, php_version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getCodeceptionUri = getCodeceptionUri;
|
exports.getCodeceptionUri = getCodeceptionUri;
|
||||||
|
/**
|
||||||
|
* Helper function to get script to setup phive
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param version
|
||||||
|
* @param url
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
function addPhive(version, os_version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return ((yield getArchiveCommand(os_version)) +
|
||||||
|
'https://phar.io/releases/phive.phar phive');
|
||||||
|
default:
|
||||||
|
return ((yield getArchiveCommand(os_version)) +
|
||||||
|
'https://github.com/phar-io/phive/releases/download/' +
|
||||||
|
version +
|
||||||
|
'/phive-' +
|
||||||
|
version +
|
||||||
|
'.phar phive');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.addPhive = addPhive;
|
||||||
/**
|
/**
|
||||||
* Function to get the PHPUnit url
|
* Function to get the PHPUnit url
|
||||||
*
|
*
|
||||||
@ -1888,6 +1913,9 @@ function addTools(tools_csv, php_version, os_version) {
|
|||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += yield addArchive(tool, version, url, os_version);
|
script += yield addArchive(tool, version, url, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phive':
|
||||||
|
script += yield addPhive(version, os_version);
|
||||||
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += yield addArchive(tool, version, url, os_version);
|
script += yield addArchive(tool, version, url, os_version);
|
||||||
|
@ -67,6 +67,11 @@ add_tool() {
|
|||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ "$tool" = "phive" ]; then
|
||||||
|
add_extension curl >/dev/null 2>&1
|
||||||
|
add_extension mbstring >/dev/null 2>&1
|
||||||
|
add_extension xml >/dev/null 2>&1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_composer_tool() {
|
add_composer_tool() {
|
||||||
|
@ -83,6 +83,11 @@ add_tool() {
|
|||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
composer -q global config process-timeout 0
|
composer -q global config process-timeout 0
|
||||||
fi
|
fi
|
||||||
|
if [ "$tool" = "phive" ]; then
|
||||||
|
add_extension curl >/dev/null 2>&1
|
||||||
|
add_extension mbstring >/dev/null 2>&1
|
||||||
|
add_extension xml >/dev/null 2>&1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_composer_tool() {
|
add_composer_tool() {
|
||||||
|
@ -115,6 +115,11 @@ Function Add-Tool() {
|
|||||||
Add-Log $cross $tool "Could not add $tool"
|
Add-Log $cross $tool "Could not add $tool"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($tool -eq "phive") {
|
||||||
|
Add-Extension curl >$null 2>&1
|
||||||
|
Add-Extension mbstring >$null 2>&1
|
||||||
|
Add-Extension xml >$null 2>&1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Composer-Tool() {
|
Function Add-Composer-Tool() {
|
||||||
|
33
src/tools.ts
33
src/tools.ts
@ -180,6 +180,36 @@ export async function getCodeceptionUri(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to get script to setup phive
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param version
|
||||||
|
* @param url
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function addPhive(
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return (
|
||||||
|
(await getArchiveCommand(os_version)) +
|
||||||
|
'https://phar.io/releases/phive.phar phive'
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
(await getArchiveCommand(os_version)) +
|
||||||
|
'https://github.com/phar-io/phive/releases/download/' +
|
||||||
|
version +
|
||||||
|
'/phive-' +
|
||||||
|
version +
|
||||||
|
'.phar phive'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get the PHPUnit url
|
* Function to get the PHPUnit url
|
||||||
*
|
*
|
||||||
@ -354,6 +384,9 @@ export async function addTools(
|
|||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phive':
|
||||||
|
script += await addPhive(version, os_version);
|
||||||
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
|
Loading…
Reference in New Issue
Block a user