Add support for behat and phpspec

This commit is contained in:
Shivam Mathur 2020-10-05 09:11:15 +05:30
parent 9e663851ce
commit b8f0b066dc
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 22 additions and 5 deletions

View File

@ -168,7 +168,7 @@ Both `GitHub-hosted` runners and `self-hosted` runners are supported on the foll
These tools can be setup globally using the `tools` input.
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
`behat`, `blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phing`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpspec`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
```yaml
- name: Setup PHP with tools

View File

@ -277,14 +277,19 @@ describe('Tools tests', () => {
it('checking getCleanedToolsList', async () => {
const tools_list: string[] = await tools.getCleanedToolsList(
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
'tool, composer:1.2.3, behat/behat, icanhazstring/composer-unused, laravel/vapor-cli, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher, phpspec/phpspec, symfony/flex'
);
expect(tools_list).toStrictEqual([
'composer',
'tool',
'behat',
'composer-unused',
'vapor-cli',
'phinx',
'prestissimo',
'composer-prefetcher'
'composer-prefetcher',
'phpspec',
'flex'
]);
});
@ -424,6 +429,7 @@ describe('Tools tests', () => {
});
it('checking addTools on darwin', async () => {
const listOfTools = [
'behat',
'blackfire',
'blackfire-player',
'composer-normalize',
@ -445,6 +451,7 @@ describe('Tools tests', () => {
'phpcs',
'phpize',
'phpmd',
'phpspec',
'protoc:v1.2.3',
'psalm',
'symfony',
@ -501,6 +508,8 @@ describe('Tools tests', () => {
);
expect(script).toContain('add_grpc_php_plugin 1.2.3');
expect(script).toContain('add_protoc 1.2.3');
expect(script).toContain('add_composertool behat behat behat/');
expect(script).toContain('add_composertool phpspec phpspec phpspec/');
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
expect(script).toContain('add_composertool flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/');

6
dist/index.js vendored
View File

@ -2053,7 +2053,7 @@ async function getCleanedToolsList(tools_csv) {
.map(function (extension) {
return extension
.trim()
.replace(/-agent|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
.replace(/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//, '');
})
.filter(Boolean);
return [...new Set(tools_list)];
@ -2127,6 +2127,10 @@ async function addTools(tools_csv, php_version, os_version) {
case 'protoc':
script += await utils.customPackage(tool, 'tools', version, os_version);
break;
case 'behat':
case 'phpspec':
script += await addPackage(tool, release, tool + '/', os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, url, os_version, '"-V"');

View File

@ -334,7 +334,7 @@ export async function getCleanedToolsList(
return extension
.trim()
.replace(
/-agent|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
''
);
})
@ -445,6 +445,10 @@ export async function addTools(
case 'protoc':
script += await utils.customPackage(tool, 'tools', version, os_version);
break;
case 'behat':
case 'phpspec':
script += await addPackage(tool, release, tool + '/', os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, url, os_version, '"-V"');