Skip to content

2.3.1 #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 19, 2020
Merged

2.3.1 #235

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions .github/workflows/experimental-workflow.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, windows-latest, macos-latest]
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
env:
extensions: xml, opcache, xdebug, pcov
key: cache-v2
Expand All @@ -33,7 +33,7 @@ jobs:
uses: actions/checkout@v2

- name: Setup cache environment
id: cache-env
id: extcache
uses: shivammathur/cache-extensions@develop
with:
php-version: ${{ matrix.php-versions }}
Expand All @@ -43,9 +43,9 @@ jobs:
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP with extensions and custom config
run: node dist/index.js
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ with:
### Xdebug

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

```yaml
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -470,7 +470,7 @@ steps:
uses: actions/checkout@v2

- name: Setup cache environment
id: cache-env
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
Expand All @@ -480,9 +480,9 @@ steps:
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -499,13 +499,13 @@ If your project uses composer, you can persist composer's internal cache directo

```yaml
- name: Get composer cache directory
id: composer-cache
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand All @@ -527,13 +527,13 @@ If your project has node.js dependencies, you can persist npm's or yarn's cache

```yaml
- name: Get node.js cache directory
id: node-cache-dir
id: nodecache
run: echo "::set-output name=dir::$(npm config get cache)" # Use $(yarn cache dir) for yarn

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.node-cache-dir.outputs.dir }}
path: ${{ steps.nodecache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Use '**/yarn.lock' for yarn
restore-keys: ${{ runner.os }}-node-
```
Expand Down
17 changes: 2 additions & 15 deletions __tests__/coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ describe('Config tests', () => {
expect(win32).toContain('add_extension xdebug');
});

it('checking addCoverage with Xdebug on windows', async () => {
const win32: string = await coverage.addCoverage('xdebug', '8.0', 'win32');
expect(win32).toContain('Xdebug currently only supports PHP 7.4 or lower');
});

it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
expect(linux).toContain('add_extension xdebug');
});

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

it('checking addCoverage with Xdebug on darwin', async () => {
Expand All @@ -60,15 +56,6 @@ describe('Config tests', () => {
expect(darwin).toContain('add_extension xdebug');
});

it('checking addCoverage with Xdebug on darwin', async () => {
const darwin: string = await coverage.addCoverage(
'xdebug',
'8.0',
'darwin'
);
expect(darwin).toContain('Xdebug currently only supports PHP 7.4 or lower');
});

it('checking disableCoverage windows', async () => {
const win32 = await coverage.addCoverage('none', '7.4', 'win32');
expect(win32).toContain('Remove-Extension xdebug');
Expand Down
18 changes: 12 additions & 6 deletions __tests__/extensions.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as extensions from '../src/extensions';

describe('Extension tests', () => {
it('checking getXdebugVersion', async () => {
expect(await extensions.getXdebugVersion('5.3')).toContain('2.2.7');
expect(await extensions.getXdebugVersion('5.4')).toContain('2.4.1');
expect(await extensions.getXdebugVersion('5.5')).toContain('2.5.5');
expect(await extensions.getXdebugVersion('5.6')).toContain('2.9.6');
});
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'Xdebug, pcov, sqlite, :intl, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
Expand Down Expand Up @@ -104,8 +110,8 @@ describe('Extension tests', () => {
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install -f xdebug');
expect(darwin).toContain('sudo pecl install -f pcov');
expect(darwin).toContain('add_brew_extension xdebug');
expect(darwin).toContain('add_brew_extension pcov');
expect(darwin).toContain('sudo pecl install -f sqlite3');
expect(darwin).toContain('remove_extension intl');
expect(darwin).toContain('add_unstable_extension ast beta extension');
Expand All @@ -121,7 +127,7 @@ describe('Extension tests', () => {
expect(darwin).toContain('sudo pecl install -f pcov');

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

darwin = await extensions.addExtension('xdebug', '5.3', 'darwin');
expect(darwin).toContain('sudo pecl install -f xdebug-2.2.7');
Expand All @@ -133,13 +139,13 @@ describe('Extension tests', () => {
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');

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

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

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

darwin = await extensions.addExtension('redis', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
Expand Down
66 changes: 40 additions & 26 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2147,16 +2147,15 @@ const config = __importStar(__webpack_require__(641));
* @param pipe
*/
async function addCoverageXdebug(version, os_version, pipe) {
switch (version) {
case '8.0':
return ('\n' +
(await utils.addLog('$cross', 'xdebug', 'Xdebug currently only supports PHP 7.4 or lower', os_version)));
case '7.4':
const xdebug = (await extensions.addExtension('xdebug', version, os_version, true)) + pipe;
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
const log = await utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version);
switch (true) {
case /8.[0-9]/.test(version):
return xdebug + '\n' + ini + '\n' + log;
case /5\.[3-6]|7.[0-4]/.test(version):
default:
return ((await extensions.addExtension('xdebug', version, os_version, true)) +
pipe +
'\n' +
(await utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version)));
return xdebug + '\n' + log;
}
}
exports.addCoverageXdebug = addCoverageXdebug;
Expand Down Expand Up @@ -2685,9 +2684,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = void 0;
exports.addExtension = exports.addExtensionLinux = exports.addExtensionWindows = exports.addExtensionDarwin = exports.getXdebugVersion = void 0;
const path = __importStar(__webpack_require__(622));
const utils = __importStar(__webpack_require__(163));
/**
* Function to get Xdebug version compatible with php versions
*
* @param version
*/
async function getXdebugVersion(version) {
switch (version) {
case '5.3':
return '2.2.7';
case '5.4':
return '2.4.1';
case '5.5':
return '2.5.5';
default:
return '2.9.6';
}
}
exports.getXdebugVersion = getXdebugVersion;
/**
* Install and enable extensions for darwin
*
Expand Down Expand Up @@ -2741,25 +2758,22 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
' ' +
ext_prefix;
return;
// match 5.3xdebug
case /5\.3xdebug/.test(version_extension):
command = command_prefix + 'xdebug-2.2.7' + pipe;
break;
// match 5.4xdebug
case /5\.4xdebug/.test(version_extension):
command = command_prefix + 'xdebug-2.4.1' + pipe;
// match 5.3xdebug...5.5xdebug
case /5\.[3-5]xdebug/.test(version_extension):
command =
command_prefix + 'xdebug-' + (await getXdebugVersion(version));
break;
// match 5.5xdebug and 5.6xdebug
case /5\.[5-6]xdebug/.test(version_extension):
command = command_prefix + 'xdebug-2.5.5' + pipe;
// match 5.6xdebug, 7.0xdebug...7.4xdebug, 8.0xdebug
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
command = 'add_brew_extension xdebug';
break;
// match 7.0redis
case /7\.0xdebug/.test(version_extension):
command = command_prefix + 'xdebug-2.9.0' + pipe;
// match 7.1pcov...7.4pcov, 8.0pcov
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
command = 'add_brew_extension pcov';
break;
// match 5.6redis
case /5\.6redis/.test(version_extension):
command = command_prefix + 'redis-2.2.8' + pipe;
command = command_prefix + 'redis-2.2.8';
break;
// match imagick
case /^imagick$/.test(extension):
Expand All @@ -2774,7 +2788,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
// match sqlite
case /^sqlite$/.test(extension):
extension = 'sqlite3';
command = command_prefix + extension + pipe;
command = command_prefix + extension;
break;
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
Expand All @@ -2787,7 +2801,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
version;
return;
default:
command = command_prefix + extension + pipe;
command = command_prefix + extension;
break;
}
add_script +=
Expand Down
Loading