Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dae796

Browse files
authored
Merge pull request shivammathur#263 from shivammathur/develop
2.4.1
2 parents 7961bc1 + 6d9aef8 commit 9dae796

33 files changed

+1600
-1547
lines changed

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The following versions of this project are supported for security updates.
77
| Version | Supported |
88
| ------- | ------------------ |
99
| 1.9.x | :white_check_mark: |
10-
| 2.3.x | :white_check_mark: |
10+
| 2.4.x | :white_check_mark: |
1111

1212
## Supported PHP Versions
1313

.github/workflows/node-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ jobs:
4848
- name: Send Coverage
4949
continue-on-error: true
5050
timeout-minutes: 1
51-
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
51+
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ with:
149149

150150
These tools can be setup globally using the `tools` input.
151151

152-
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`, `vapor-cli`
152+
`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-normalize`, `composer-prefetcher`, `composer-require-checker`, `composer-unused`, `cs2pr`, `deployer`, `flex`, `grpc_php_plugin`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `protoc`, `psalm`, `symfony`, `vapor-cli`
153153

154154
```yaml
155155
uses: shivammathur/setup-php@v2
@@ -544,7 +544,7 @@ If your project has node.js dependencies, you can persist npm's or yarn's cache
544544

545545
### Composer GitHub OAuth
546546

547-
If you have a number of workflows which setup multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. To avoid that you can add a `OAuth` token to the composer's config by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
547+
If you have a number of workflows which setup multiple tools or have many composer dependencies, you might hit the GitHub's rate limit for composer. To avoid that you can add an `OAuth` token to the composer's config by setting `COMPOSER_TOKEN` environment variable. You can use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token "GITHUB_TOKEN documentation") secret for this purpose.
548548

549549
```yaml
550550
- name: Setup PHP
@@ -634,7 +634,7 @@ Examples of using `setup-php` with various PHP Frameworks and Packages.
634634
## :scroll: License
635635

636636
- The scripts and documentation in this project are released under the [MIT License](LICENSE "License for shivammathur/setup-php").
637-
- This project has multiple [dependencies](#bookmark-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
637+
- This project has multiple [dependencies](#package-dependencies "Dependencies for this PHP Action"). Their licenses can be found in their respective repositories.
638638
- The logo for `setup-php` is a derivative work of [php.net logo](https://www.php.net/download-logos.php) and is licensed under the [CC BY-SA 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/ "Creative Commons License").
639639

640640
## :+1: Contributions

__tests__/extensions.test.ts

Lines changed: 41 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import * as extensions from '../src/extensions';
22

33
describe('Extension tests', () => {
4-
it('checking getXdebugVersion', async () => {
5-
expect(await extensions.getXdebugVersion('5.3')).toContain('2.2.7');
6-
expect(await extensions.getXdebugVersion('5.4')).toContain('2.4.1');
7-
expect(await extensions.getXdebugVersion('5.5')).toContain('2.5.5');
8-
expect(await extensions.getXdebugVersion('5.6')).toContain('2.5.5');
9-
expect(await extensions.getXdebugVersion('7.0')).toContain('2.7.2');
10-
expect(await extensions.getXdebugVersion('7.2')).toContain('2.9.6');
11-
});
124
it('checking addExtensionOnWindows', async () => {
135
let win32: string = await extensions.addExtension(
146
'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
@@ -19,14 +11,19 @@ describe('Extension tests', () => {
1911
expect(win32).toContain('Add-Extension pcov');
2012
expect(win32).toContain('Add-Extension sqlite3');
2113
expect(win32).toContain('Remove-Extension intl');
22-
expect(win32).toContain('phalcon.ps1 phalcon4');
23-
expect(win32).toContain('ioncube.ps1 7.4');
24-
expect(win32).toContain('oci.ps1 oci8 7.4');
25-
expect(win32).toContain('oci.ps1 pdo_oci 7.4');
14+
expect(win32).toContain('Add-Phalcon phalcon4');
15+
expect(win32).toContain('Add-Ioncube');
16+
expect(win32).toContain('Add-OCI oci8');
17+
expect(win32).toContain('Add-OCI pdo_oci');
2618
expect(win32).toContain('Add-Extension ast beta');
2719
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
2820
expect(win32).toContain('Add-Extension inotify alpha 1.2.3');
2921

22+
win32 = await extensions.addExtension('pcov', '5.6', 'win32');
23+
expect(win32).toContain(
24+
'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
25+
);
26+
3027
win32 = await extensions.addExtension('mysql', '7.4', 'win32');
3128
expect(win32).toContain('Add-Extension mysqli');
3229
expect(win32).toContain('Add-Extension mysqlnd');
@@ -46,17 +43,17 @@ describe('Extension tests', () => {
4643
'win32',
4744
true
4845
);
49-
expect(win32).toContain('phalcon.ps1 phalcon3');
46+
expect(win32).toContain('Add-Phalcon phalcon3');
5047
expect(win32).toContain('Add-Extension does_not_exist');
5148

5249
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
5350
expect(win32).toContain('Platform fedora is not supported');
5451

5552
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
56-
expect(win32).toContain('blackfire.ps1 7.3 blackfire');
53+
expect(win32).toContain('Add-Blackfire blackfire');
5754

5855
win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32');
59-
expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0');
56+
expect(win32).toContain('Add-Blackfire blackfire-1.31.0');
6057
});
6158

6259
it('checking addExtensionOnLinux', async () => {
@@ -65,7 +62,6 @@ describe('Extension tests', () => {
6562
'7.4',
6663
'linux'
6764
);
68-
expect(linux).toContain('update_extension xdebug 2.9.6');
6965
expect(linux).toContain(
7066
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
7167
);
@@ -89,39 +85,35 @@ describe('Extension tests', () => {
8985
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
9086
);
9187

92-
linux = await extensions.addExtension('gearman', '7.0', 'linux');
93-
expect(linux).toContain('gearman.sh 7.0');
94-
linux = await extensions.addExtension('gearman', '7.1', 'linux');
95-
expect(linux).toContain('gearman.sh 7.1');
96-
97-
linux = await extensions.addExtension('gearman', '7.2', 'linux');
98-
expect(linux).toContain('gearman.sh 7.2');
99-
100-
linux = await extensions.addExtension('gearman', '7.3', 'linux');
101-
expect(linux).toContain('gearman.sh 7.3');
88+
linux = await extensions.addExtension('pcov', '5.6', 'linux');
89+
expect(linux).toContain(
90+
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
91+
);
10292

93+
linux = await extensions.addExtension('gearman', '7.0', 'linux');
94+
expect(linux).toContain('add_gearman');
10395
linux = await extensions.addExtension('gearman', '7.4', 'linux');
104-
expect(linux).toContain('gearman.sh 7.4');
96+
expect(linux).toContain('add_gearman');
10597

10698
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
10799
expect(linux).toContain('Platform fedora is not supported');
108100

109101
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
110-
expect(linux).toContain('phalcon.sh phalcon3 7.3');
111-
expect(linux).toContain('phalcon.sh phalcon4 7.3');
102+
expect(linux).toContain('add_phalcon phalcon3');
103+
expect(linux).toContain('add_phalcon phalcon4');
112104

113105
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
114-
expect(linux).toContain('ioncube.sh 7.3');
106+
expect(linux).toContain('add_ioncube');
115107

116108
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
117-
expect(linux).toContain('oci.sh oci8 7.3');
118-
expect(linux).toContain('oci.sh pdo_oci 7.3');
109+
expect(linux).toContain('add_oci oci8');
110+
expect(linux).toContain('add_oci pdo_oci');
119111

120112
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
121-
expect(linux).toContain('blackfire.sh 7.3 blackfire');
113+
expect(linux).toContain('add_blackfire blackfire');
122114

123115
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
124-
expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0');
116+
expect(linux).toContain('add_blackfire blackfire-1.31.0');
125117
});
126118

127119
it('checking addExtensionOnDarwin', async () => {
@@ -135,39 +127,32 @@ describe('Extension tests', () => {
135127
expect(darwin).toContain('add_brew_extension grpc');
136128
expect(darwin).toContain('add_brew_extension protobuf');
137129
expect(darwin).toContain('add_brew_extension swoole');
138-
expect(darwin).toContain('sudo pecl install -f sqlite3');
130+
expect(darwin).toContain('pecl_install sqlite3');
139131
expect(darwin).toContain('remove_extension intl');
140132
expect(darwin).toContain('add_unstable_extension ast beta extension');
141133
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');
142134

143135
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
144-
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
136+
expect(darwin).toContain('add_phalcon phalcon3');
145137

146138
darwin = await extensions.addExtension('phalcon4', '7.3', 'darwin');
147-
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
139+
expect(darwin).toContain('add_phalcon phalcon4');
148140

149141
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
150-
expect(darwin).toContain('ioncube.sh 7.3');
142+
expect(darwin).toContain('add_ioncube');
151143

152144
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
153-
expect(darwin).toContain('oci.sh oci8 7.3');
154-
expect(darwin).toContain('oci.sh pdo_oci 7.3');
145+
expect(darwin).toContain('add_oci oci8');
146+
expect(darwin).toContain('add_oci pdo_oci');
155147

156148
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
157-
expect(darwin).toContain('sudo pecl install -f pcov');
149+
expect(darwin).toContain(
150+
'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'
151+
);
158152

159153
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
160154
expect(darwin).toContain('add_brew_extension pcov');
161155

162-
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
163-
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
164-
165-
darwin = await extensions.addExtension('xdebug', '5.4', 'darwin');
166-
expect(darwin).toContain('sudo pecl install -f xdebug-2.4.1');
167-
168-
darwin = await extensions.addExtension('xdebug', '5.5', 'darwin');
169-
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
170-
171156
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
172157
expect(darwin).toContain('add_brew_extension xdebug');
173158

@@ -178,24 +163,24 @@ describe('Extension tests', () => {
178163
expect(darwin).toContain('add_brew_extension xdebug');
179164

180165
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
181-
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
166+
expect(darwin).toContain('pecl_install redis-2.2.8');
182167

183168
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
184-
expect(darwin).toContain('sudo pecl install -f redis');
169+
expect(darwin).toContain('pecl_install redis');
185170

186171
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
187172
expect(darwin).toContain('brew install pkg-config imagemagick');
188-
expect(darwin).toContain('sudo pecl install -f imagick');
173+
expect(darwin).toContain('pecl_install imagick');
189174

190175
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
191176
expect(darwin).toContain('brew install pkg-config imagemagick');
192-
expect(darwin).toContain('sudo pecl install -f imagick');
177+
expect(darwin).toContain('pecl_install imagick');
193178

194179
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
195-
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire');
180+
expect(darwin).toContain('add_blackfire blackfire');
196181

197182
darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin');
198-
expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0');
183+
expect(darwin).toContain('add_blackfire blackfire-1.31.0');
199184

200185
darwin = await extensions.addExtension(
201186
'does_not_exist',

__tests__/tools.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,20 @@ describe('Tools tests', () => {
402402
expect(script).toContain('Platform fedora is not supported');
403403
});
404404

405+
it('checking addCustomTool', async () => {
406+
let script: string = await tools.addCustomTool('tool', '1.2.3', 'linux');
407+
expect(script).toContain('tool.sh\nadd_tool 1.2.3');
408+
409+
script = await tools.addCustomTool('tool', '1.2.3', 'darwin');
410+
expect(script).toContain('tool.sh\nadd_tool 1.2.3');
411+
412+
script = await tools.addCustomTool('tool', '1.2.3', 'win32');
413+
expect(script).toContain('tool.ps1\nAdd-Tool 1.2.3');
414+
});
415+
405416
it('checking addTools on linux', async () => {
406417
const script: string = await tools.addTools(
407-
'blackfire, blackfire-player, cs2pr, flex, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony, wp-cli',
418+
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, php-cs-fixer, phplint, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, protoc, symfony, wp-cli',
408419
'7.4',
409420
'linux'
410421
);
@@ -436,6 +447,8 @@ describe('Tools tests', () => {
436447
expect(script).toContain(
437448
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli'
438449
);
450+
expect(script).toContain('add_protoc latest');
451+
expect(script).toContain('add_grpc_php_plugin latest');
439452
expect(script).toContain('add_pecl');
440453
expect(script).toContain('add_composertool flex flex symfony/');
441454
expect(script).toContain('add_composertool phinx phinx robmorgan/');
@@ -455,6 +468,7 @@ describe('Tools tests', () => {
455468
'composer-unused',
456469
'cs2pr:1.2.3',
457470
'flex',
471+
'grpc_php_plugin:1.2.3',
458472
'infection',
459473
'phan',
460474
'phan:2.7.2',
@@ -466,6 +480,7 @@ describe('Tools tests', () => {
466480
'phpcs',
467481
'phpize',
468482
'phpmd',
483+
'protoc:v1.2.3',
469484
'psalm',
470485
'symfony',
471486
'symfony:1.2.3',
@@ -519,6 +534,8 @@ describe('Tools tests', () => {
519534
expect(script).toContain(
520535
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
521536
);
537+
expect(script).toContain('add_grpc_php_plugin 1.2.3');
538+
expect(script).toContain('add_protoc 1.2.3');
522539
expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/');
523540
expect(script).toContain('add_composertool flex flex symfony/');
524541
expect(script).toContain('add_composertool phinx phinx robmorgan/');

__tests__/utils.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,23 @@ describe('Utils tests', () => {
167167
'Platform fedora is not supported'
168168
);
169169
});
170+
171+
it('checking getUnsupportedLog', async () => {
172+
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
173+
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
174+
);
175+
});
176+
177+
it('checking joins', async () => {
178+
expect(await utils.joins('a', 'b', 'c')).toBe('a b c');
179+
});
180+
181+
it('checking scriptExtension', async () => {
182+
expect(await utils.scriptExtension('linux')).toBe('.sh');
183+
expect(await utils.scriptExtension('darwin')).toBe('.sh');
184+
expect(await utils.scriptExtension('win32')).toBe('.ps1');
185+
expect(await utils.scriptExtension('fedora')).toContain(
186+
'Platform fedora is not supported'
187+
);
188+
});
170189
});

0 commit comments

Comments
 (0)