Skip to content

Commit

Permalink
Merge pull request #101 from shivammathur/develop
Browse files Browse the repository at this point in the history
1.5.7
  • Loading branch information
shivammathur authored Dec 2, 2019
2 parents 3039a72 + 747d45c commit 3164116
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 71 deletions.
27 changes: 19 additions & 8 deletions __tests__/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'xdebug, pcov, redis',
'7.4',
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension redis beta');

win32 = await extensions.addExtension(
'does_not_exist',
Expand All @@ -26,18 +25,21 @@ describe('Extension tests', () => {

it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'xdebug, pcov, redis',
'7.4',
'linux'
);
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-xdebug'
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug'
);
expect(linux).toContain('pecl install xdebug');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-pcov'
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
);
expect(linux).toContain('pecl install pcov');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis'
);

linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
expect(linux).toContain('phalcon.sh master 7.2');
Expand All @@ -47,6 +49,9 @@ describe('Extension tests', () => {
expect(linux).toContain('phalcon.sh master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 7.3');

linux = await extensions.addExtension('phalcon4', '7.4', 'linux');
expect(linux).toContain('phalcon.sh 4.0.x 7.4');

linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
});
Expand All @@ -72,6 +77,12 @@ describe('Extension tests', () => {
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug');

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

darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install redis');

darwin = await extensions.addExtension(
'does_not_exist',
'7.2',
Expand Down
11 changes: 6 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ branding:
color: 'purple'
inputs:
php-version:
description: 'PHP version you want to install.'
description: 'Setup PHP version.'
default: '7.4'
required: true
extension-csv:
description: '(Optional) PHP extensions you want to install.'
description: 'Setup PHP extensions.'
required: false
ini-values-csv:
description: '(Optional) Custom values you want to set in php.ini.'
description: 'Add values to php.ini.'
required: false
coverage:
description: '(Optional) Code coverage driver you want to install. (Accepts: xdebug, pcov and none)'
description: 'Setup code coverage driver.'
required: false
pecl:
description: '(Optional) Setup PECL on ubuntu'
description: 'Setup PECL on ubuntu'
required: false
runs:
using: 'node12'
Expand Down
16 changes: 15 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,9 @@ function addExtensionDarwin(extension_csv, version) {
case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break;
case '5.6redis':
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
break;
default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break;
Expand Down Expand Up @@ -1637,7 +1640,14 @@ function addExtensionWindows(extension_csv, version) {
yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () {
// add script to enable extension is already installed along with php
script += '\nAdd-Extension ' + extension;
switch (version + extension) {
case '7.4redis':
script += '\nAdd-Extension ' + extension + ' beta';
break;
default:
script += '\nAdd-Extension ' + extension;
break;
}
});
});
return script;
Expand All @@ -1660,6 +1670,10 @@ function addExtensionLinux(extension_csv, version) {
// add script to enable extension is already installed along with php
let install_command = '';
switch (version + extension) {
case '7.4redis':
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
break;
case '7.2phalcon3':
case '7.3phalcon3':
install_command =
Expand Down
80 changes: 33 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "setup-php",
"version": "1.5.6",
"version": "1.5.7",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"lint": "eslint **/*.ts --cache",
"format": "prettier --write **/*.ts",
"format": "prettier --write **/*.ts && git add .",
"format-check": "prettier --check **/*.ts",
"release": "ncc build src/install.ts -o dist && git add -f dist/",
"test": "jest"
Expand Down
Loading

0 comments on commit 3164116

Please sign in to comment.