Skip to content

Commit dd27d4e

Browse files
committed
Merge pull request #235 from shivammathur/develop
2.3.1
2 parents 70954fb + 248d04f commit dd27d4e

39 files changed

+498
-492
lines changed

.github/workflows/experimental-workflow.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/workflow.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest]
27-
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
27+
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
2828
env:
2929
extensions: xml, opcache, xdebug, pcov
3030
key: cache-v2
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@v2
3434

3535
- name: Setup cache environment
36-
id: cache-env
36+
id: extcache
3737
uses: shivammathur/cache-extensions@develop
3838
with:
3939
php-version: ${{ matrix.php-versions }}
@@ -43,9 +43,9 @@ jobs:
4343
- name: Cache extensions
4444
uses: actions/cache@v2
4545
with:
46-
path: ${{ steps.cache-env.outputs.dir }}
47-
key: ${{ steps.cache-env.outputs.key }}
48-
restore-keys: ${{ steps.cache-env.outputs.key }}
46+
path: ${{ steps.extcache.outputs.dir }}
47+
key: ${{ steps.extcache.outputs.key }}
48+
restore-keys: ${{ steps.extcache.outputs.key }}
4949

5050
- name: Setup PHP with extensions and custom config
5151
run: node dist/index.js

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ with:
185185
### Xdebug
186186

187187
Specify `coverage: xdebug` to use `Xdebug`.
188-
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action") except `8.0`.
188+
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action").
189189

190190
```yaml
191191
uses: shivammathur/setup-php@v2
@@ -338,7 +338,8 @@ steps:
338338
> Setup PHP on a self-hosted runner.
339339

340340
- To setup a dockerized self-hosted runner, refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Ubuntu) to setup in an `Ubuntu` container and refer to this [guide](https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Windows) to setup in a `Windows` container.
341-
- To setup the runner directly on the host OS or in a VM, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
341+
- To setup the runner directly on the host OS or in a virtual machine, follow this [requirements guide](https://github.com/shivammathur/setup-php/wiki/Requirements-for-self-hosted-runners "Requirements guide for self-hosted runner to run setup-php") before setting up the self-hosted runner.
342+
- If your workflow uses [services](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices "GitHub Actions Services"), then setup the runner on a Linux host or in a Linux virtual machine. GitHub Actions does not support nested virtualization on Linux, so services will not work in a dockerized container.
342343

343344
Specify the environment variable `runner` with the value `self-hosted`. Without this your workflow will fail.
344345

@@ -470,7 +471,7 @@ steps:
470471
uses: actions/checkout@v2
471472
472473
- name: Setup cache environment
473-
id: cache-env
474+
id: extcache
474475
uses: shivammathur/cache-extensions@v1
475476
with:
476477
php-version: ${{ matrix.php-versions }}
@@ -480,9 +481,9 @@ steps:
480481
- name: Cache extensions
481482
uses: actions/cache@v2
482483
with:
483-
path: ${{ steps.cache-env.outputs.dir }}
484-
key: ${{ steps.cache-env.outputs.key }}
485-
restore-keys: ${{ steps.cache-env.outputs.key }}
484+
path: ${{ steps.extcache.outputs.dir }}
485+
key: ${{ steps.extcache.outputs.key }}
486+
restore-keys: ${{ steps.extcache.outputs.key }}
486487
487488
- name: Setup PHP
488489
uses: shivammathur/setup-php@v2
@@ -499,13 +500,13 @@ If your project uses composer, you can persist composer's internal cache directo
499500

500501
```yaml
501502
- name: Get composer cache directory
502-
id: composer-cache
503+
id: composercache
503504
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
504505
505506
- name: Cache dependencies
506507
uses: actions/cache@v2
507508
with:
508-
path: ${{ steps.composer-cache.outputs.dir }}
509+
path: ${{ steps.composercache.outputs.dir }}
509510
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
510511
restore-keys: ${{ runner.os }}-composer-
511512
@@ -527,13 +528,13 @@ If your project has node.js dependencies, you can persist npm's or yarn's cache
527528

528529
```yaml
529530
- name: Get node.js cache directory
530-
id: node-cache-dir
531+
id: nodecache
531532
run: echo "::set-output name=dir::$(npm config get cache)" # Use $(yarn cache dir) for yarn
532533
533534
- name: Cache dependencies
534535
uses: actions/cache@v2
535536
with:
536-
path: ${{ steps.node-cache-dir.outputs.dir }}
537+
path: ${{ steps.nodecache.outputs.dir }}
537538
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Use '**/yarn.lock' for yarn
538539
restore-keys: ${{ runner.os }}-node-
539540
```

__tests__/coverage.test.ts

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import * as coverage from '../src/coverage';
22

3-
jest.mock('../src/extensions', () => ({
4-
addExtension: jest.fn().mockImplementation(extension => {
5-
return 'add_extension ' + extension + '\n';
6-
})
7-
}));
8-
93
describe('Config tests', () => {
104
it('checking addCoverage with PCOV on windows', async () => {
115
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
12-
expect(win32).toContain('add_extension pcov');
6+
expect(win32).toContain('Add-Extension pcov');
137
expect(win32).toContain('Remove-Extension xdebug');
148

159
win32 = await coverage.addCoverage('pcov', '7.0', 'win32');
@@ -33,22 +27,30 @@ describe('Config tests', () => {
3327

3428
it('checking addCoverage with Xdebug on windows', async () => {
3529
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
36-
expect(win32).toContain('add_extension xdebug');
30+
expect(win32).toContain('Add-Extension xdebug');
3731
});
3832

39-
it('checking addCoverage with Xdebug on windows', async () => {
40-
const win32: string = await coverage.addCoverage('xdebug', '8.0', 'win32');
41-
expect(win32).toContain('Xdebug currently only supports PHP 7.4 or lower');
33+
it('checking addCoverage with Xdebug on linux', async () => {
34+
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
35+
expect(linux).toContain('add_extension xdebug');
4236
});
4337

44-
it('checking addCoverage with Xdebug on linux', async () => {
45-
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
38+
it('checking addCoverage with Xdebug3 on linux', async () => {
39+
const linux: string = await coverage.addCoverage('xdebug3', '7.4', 'linux');
40+
expect(linux).toContain('add_extension_from_source xdebug');
41+
expect(linux).toContain('echo "xdebug.mode=coverage"');
42+
});
43+
44+
it('checking addCoverage with Xdebug3 on linux', async () => {
45+
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
4646
expect(linux).toContain('add_extension xdebug');
47+
expect(linux).toContain('echo "xdebug.mode=coverage"');
4748
});
4849

4950
it('checking addCoverage with Xdebug on linux', async () => {
5051
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
51-
expect(linux).toContain('Xdebug currently only supports PHP 7.4 or lower');
52+
expect(linux).toContain('add_extension xdebug');
53+
expect(linux).toContain('echo "xdebug.mode=coverage"');
5254
});
5355

5456
it('checking addCoverage with Xdebug on darwin', async () => {
@@ -60,15 +62,6 @@ describe('Config tests', () => {
6062
expect(darwin).toContain('add_extension xdebug');
6163
});
6264

63-
it('checking addCoverage with Xdebug on darwin', async () => {
64-
const darwin: string = await coverage.addCoverage(
65-
'xdebug',
66-
'8.0',
67-
'darwin'
68-
);
69-
expect(darwin).toContain('Xdebug currently only supports PHP 7.4 or lower');
70-
});
71-
7265
it('checking disableCoverage windows', async () => {
7366
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
7467
expect(win32).toContain('Remove-Extension xdebug');

__tests__/extensions.test.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
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.9.6');
9+
});
410
it('checking addExtensionOnWindows', async () => {
511
let win32: string = await extensions.addExtension(
612
'Xdebug, pcov, sqlite, :intl, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
@@ -50,11 +56,14 @@ describe('Extension tests', () => {
5056

5157
it('checking addExtensionOnLinux', async () => {
5258
let linux: string = await extensions.addExtension(
53-
'Xdebug, pcov, sqlite, :intl, ast, uopz, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
59+
'Xdebug, xdebug3, pcov, sqlite, :intl, ast, uopz, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
5460
'7.4',
5561
'linux'
5662
);
57-
expect(linux).toContain('update_extension xdebug 2.9.3');
63+
expect(linux).toContain('update_extension xdebug 2.9.6');
64+
expect(linux).toContain(
65+
'add_extension_from_source xdebug xdebug/xdebug master --enable-xdebug zend_extension'
66+
);
5867
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
5968
expect(linux).toContain(
6069
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
@@ -70,6 +79,11 @@ describe('Extension tests', () => {
7079
'add_unstable_extension xdebug alpha zend_extension'
7180
);
7281

82+
linux = await extensions.addExtension('xdebug3', '8.0', 'linux');
83+
expect(linux).toContain(
84+
'sudo $debconf_fix apt-get install -y php8.0-xdebug'
85+
);
86+
7387
linux = await extensions.addExtension('gearman', '7.0', 'linux');
7488
expect(linux).toContain('gearman.sh 7.0');
7589
linux = await extensions.addExtension('gearman', '7.1', 'linux');
@@ -104,8 +118,8 @@ describe('Extension tests', () => {
104118
'7.2',
105119
'darwin'
106120
);
107-
expect(darwin).toContain('sudo pecl install -f xdebug');
108-
expect(darwin).toContain('sudo pecl install -f pcov');
121+
expect(darwin).toContain('add_brew_extension xdebug');
122+
expect(darwin).toContain('add_brew_extension pcov');
109123
expect(darwin).toContain('sudo pecl install -f sqlite3');
110124
expect(darwin).toContain('remove_extension intl');
111125
expect(darwin).toContain('add_unstable_extension ast beta extension');
@@ -121,7 +135,7 @@ describe('Extension tests', () => {
121135
expect(darwin).toContain('sudo pecl install -f pcov');
122136

123137
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
124-
expect(darwin).toContain('sudo pecl install -f pcov');
138+
expect(darwin).toContain('add_brew_extension pcov');
125139

126140
darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
127141
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
@@ -133,13 +147,13 @@ describe('Extension tests', () => {
133147
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
134148

135149
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
136-
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
150+
expect(darwin).toContain('add_brew_extension xdebug');
137151

138152
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
139-
expect(darwin).toContain('sudo pecl install -f xdebug-2.9.0');
153+
expect(darwin).toContain('add_brew_extension xdebug');
140154

141155
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
142-
expect(darwin).toContain('sudo pecl install -f xdebug');
156+
expect(darwin).toContain('add_brew_extension xdebug');
143157

144158
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
145159
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');

__tests__/utils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ describe('Utils tests', () => {
155155
);
156156
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
157157
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
158+
expect(await utils.getExtensionPrefix('xdebug3')).toEqual('zend_extension');
158159
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
159160
});
160161

0 commit comments

Comments
 (0)