Skip to content

Commit

Permalink
Add support for behat and phpspec
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Oct 5, 2020
1 parent 30df32a commit d5acbac
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]);
});

Expand Down Expand Up @@ -424,6 +429,7 @@ describe('Tools tests', () => {
});
it('checking addTools on darwin', async () => {
const listOfTools = [
'behat',
'blackfire',
'blackfire-player',
'composer-normalize',
Expand All @@ -445,6 +451,7 @@ describe('Tools tests', () => {
'phpcs',
'phpize',
'phpmd',
'phpspec',
'protoc:v1.2.3',
'psalm',
'symfony',
Expand Down Expand Up @@ -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/');
Expand Down
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down Expand Up @@ -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"');
Expand Down
6 changes: 5 additions & 1 deletion src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\//,
''
);
})
Expand Down Expand Up @@ -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"');
Expand Down

0 comments on commit d5acbac

Please sign in to comment.