Skip to content

Commit d384d9f

Browse files
authored
Merge pull request #167 from shivammathur/develop
1.8.0
2 parents e01b2f0 + 4eeaf5f commit d384d9f

16 files changed

+294
-122
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
6767
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
6868
- On `macOS` extensions which are on `PECL` can be installed.
6969
- Extensions which are installed along with PHP if specified are enabled.
70+
- Extensions on `PECL` which do not have a latest stable version, their pre-release versions can be installed by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot` separated by a `-` like `msgpack-beta`.
7071
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
7172

7273
## :wrench: Tools Support
7374

7475
These tools can be setup globally using the `tools` input.
7576

76-
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
77+
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
7778

7879
```yaml
7980
uses: shivammathur/setup-php@v1
@@ -280,7 +281,7 @@ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
280281

281282
### Problem Matchers
282283

283-
You can setup problem matchers for your `PHPUnit` output. This will scan the errors in your tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
284+
You can setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
284285

285286
```yaml
286287
- name: Setup Problem Matchers for PHPUnit
@@ -327,10 +328,10 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
327328

328329
If this action helped you.
329330

330-
- Please star the project and share it, this helps reach more people.
331-
- If you blog, write about your experience using this.
332-
- Support this project on <a href="https://www.patreon.com/shivammathur"><img alt="Patreon" src="https://shivammathur.com/badges/patreon.svg"></a> or using <a href="https://www.paypal.me/shivammathur"><img alt="Paypal" src="https://shivammathur.com/badges/paypal.svg"></a>.
333-
- If you need any help using this, reach out here <a href="https://www.codementor.io/shivammathur?utm_source=github&utm_medium=button&utm_term=shivammathur&utm_campaign=github" title="Contact Shivam Mathur on Codementor"><img alt="Contact me on Codementor" src="https://cdn.codementor.io/badges/contact_me_github.svg"></a>
331+
- Please star the project and share it with the community.
332+
- If you blog, write about your experience while using this action.
333+
- I maintain this in my free time, please support me with a [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") subscription or a one time contribution using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
334+
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
334335

335336
## :bookmark: This action uses the following works
336337

__tests__/coverage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jest.mock('../src/extensions', () => ({
88

99
describe('Config tests', () => {
1010
it('checking addCoverage with PCOV on windows', async () => {
11-
let win32: string = await coverage.addCoverage('pcov', '7.4', 'win32');
11+
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
1212
expect(win32).toContain('add_extension pcov');
1313
expect(win32).toContain('Remove-Extension xdebug');
1414

__tests__/extensions.test.ts

+18-15
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import * as extensions from '../src/extensions';
33
describe('Extension tests', () => {
44
it('checking addExtensionOnWindows', async () => {
55
let win32: string = await extensions.addExtension(
6-
'xdebug, pcov, phalcon4',
6+
'xdebug, pcov, phalcon4, ast-beta',
77
'7.4',
88
'win32'
99
);
1010
expect(win32).toContain('Add-Extension xdebug');
1111
expect(win32).toContain('Add-Extension pcov');
1212
expect(win32).toContain('phalcon.ps1 phalcon4');
13+
expect(win32).toContain('Add-Extension ast beta');
1314

1415
win32 = await extensions.addExtension(
1516
'phalcon3, does_not_exist',
@@ -26,15 +27,16 @@ describe('Extension tests', () => {
2627

2728
it('checking addExtensionOnLinux', async () => {
2829
let linux: string = await extensions.addExtension(
29-
'xdebug, pcov',
30+
'xdebug, pcov, ast-beta',
3031
'7.4',
3132
'linux'
3233
);
3334
expect(linux).toContain('update_extension xdebug 2.9.0');
3435
expect(linux).toContain(
3536
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
3637
);
37-
expect(linux).toContain('pecl install pcov');
38+
expect(linux).toContain('pecl install -f pcov');
39+
expect(linux).toContain('install_extension ast-beta');
3840

3941
linux = await extensions.addExtension('gearman', '7.0', 'linux');
4042
expect(linux).toContain('gearman.sh 7.0');
@@ -60,12 +62,13 @@ describe('Extension tests', () => {
6062

6163
it('checking addExtensionOnDarwin', async () => {
6264
let darwin: string = await extensions.addExtension(
63-
'xdebug, pcov',
65+
'xdebug, pcov, ast-beta',
6466
'7.2',
6567
'darwin'
6668
);
67-
expect(darwin).toContain('sudo pecl install xdebug');
68-
expect(darwin).toContain('sudo pecl install pcov');
69+
expect(darwin).toContain('sudo pecl install -f xdebug');
70+
expect(darwin).toContain('sudo pecl install -f pcov');
71+
expect(darwin).toContain('install_extension ast-beta');
6972

7073
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
7174
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
@@ -74,33 +77,33 @@ describe('Extension tests', () => {
7477
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
7578

7679
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
77-
expect(darwin).toContain('sudo pecl install pcov');
80+
expect(darwin).toContain('sudo pecl install -f pcov');
7881

7982
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
80-
expect(darwin).toContain('sudo pecl install pcov');
83+
expect(darwin).toContain('sudo pecl install -f pcov');
8184

8285
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
83-
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
86+
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
8487

8588
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
86-
expect(darwin).toContain('sudo pecl install xdebug-2.9.0');
89+
expect(darwin).toContain('sudo pecl install -f xdebug-2.9.0');
8790

8891
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
89-
expect(darwin).toContain('sudo pecl install xdebug');
92+
expect(darwin).toContain('sudo pecl install -f xdebug');
9093

9194
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
92-
expect(darwin).toContain('sudo pecl install redis-2.2.8');
95+
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
9396

9497
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
95-
expect(darwin).toContain('sudo pecl install redis');
98+
expect(darwin).toContain('sudo pecl install -f redis');
9699

97100
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
98101
expect(darwin).toContain('brew install pkg-config imagemagick');
99-
expect(darwin).toContain('sudo pecl install imagick');
102+
expect(darwin).toContain('sudo pecl install -f imagick');
100103

101104
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
102105
expect(darwin).toContain('brew install pkg-config imagemagick');
103-
expect(darwin).toContain('sudo pecl install imagick');
106+
expect(darwin).toContain('sudo pecl install -f imagick');
104107

105108
darwin = await extensions.addExtension(
106109
'does_not_exist',

__tests__/matchers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Matchers', () => {
2323

2424
it('Test Regex', async () => {
2525
const regex1 = /^\d+\)\s.*$/;
26-
const regex2 = /^(.*)$/;
26+
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
2727
const regex3 = /^\s*$/;
2828
const regex4 = /^(.*):(\d+)$/;
2929
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);

__tests__/tools.test.ts

+39-3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,30 @@ describe('Tools tests', () => {
206206
).toStrictEqual(['composer', 'a', 'b']);
207207
});
208208

209+
it('checking getSymfonyUri', async () => {
210+
expect(await tools.getSymfonyUri('latest', 'linux')).toContain(
211+
'releases/latest/download/symfony_linux_amd64'
212+
);
213+
expect(await tools.getSymfonyUri('1.2.3', 'linux')).toContain(
214+
'releases/download/v1.2.3/symfony_linux_amd64'
215+
);
216+
expect(await tools.getSymfonyUri('latest', 'darwin')).toContain(
217+
'releases/latest/download/symfony_darwin_amd64'
218+
);
219+
expect(await tools.getSymfonyUri('1.2.3', 'darwin')).toContain(
220+
'releases/download/v1.2.3/symfony_darwin_amd64'
221+
);
222+
expect(await tools.getSymfonyUri('latest', 'win32')).toContain(
223+
'releases/latest/download/symfony_windows_amd64'
224+
);
225+
expect(await tools.getSymfonyUri('1.2.3', 'win32')).toContain(
226+
'releases/download/v1.2.3/symfony_windows_amd64'
227+
);
228+
expect(await tools.getSymfonyUri('1.2.3', 'fedora')).toContain(
229+
'Platform fedora is not supported'
230+
);
231+
});
232+
209233
it('checking getCleanedToolsList', async () => {
210234
const tools_list: string[] = await tools.getCleanedToolsList(
211235
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
@@ -301,7 +325,7 @@ describe('Tools tests', () => {
301325

302326
it('checking addTools on linux', async () => {
303327
const script: string = await tools.addTools(
304-
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize',
328+
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
305329
'7.4',
306330
'linux'
307331
);
@@ -320,6 +344,9 @@ describe('Tools tests', () => {
320344
expect(script).toContain(
321345
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
322346
);
347+
expect(script).toContain(
348+
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
349+
);
323350
expect(script).toContain('add_pecl');
324351
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
325352
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
@@ -329,7 +356,7 @@ describe('Tools tests', () => {
329356
});
330357
it('checking addTools on darwin', async () => {
331358
const script: string = await tools.addTools(
332-
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config',
359+
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
333360
'7.4',
334361
'darwin'
335362
);
@@ -358,12 +385,18 @@ describe('Tools tests', () => {
358385
expect(script).toContain(
359386
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
360387
);
388+
expect(script).toContain(
389+
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
390+
);
391+
expect(script).toContain(
392+
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
393+
);
361394
expect(script).toContain('add_log "$tick" "phpize" "Added"');
362395
expect(script).toContain('add_log "$tick" "php-config" "Added"');
363396
});
364397
it('checking addTools on windows', async () => {
365398
const script: string = await tools.addTools(
366-
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, does_not_exit',
399+
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exit',
367400
'7.4',
368401
'win32'
369402
);
@@ -383,6 +416,9 @@ describe('Tools tests', () => {
383416
expect(script).toContain(
384417
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
385418
);
419+
expect(script).toContain(
420+
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony'
421+
);
386422
expect(script).toContain('phpize is not a windows tool');
387423
expect(script).toContain('php-config is not a windows tool');
388424
expect(script).toContain('Tool does_not_exit is not supported');

0 commit comments

Comments
 (0)