mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
commit
3164116a42
@ -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',
|
||||
@ -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');
|
||||
@ -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');
|
||||
});
|
||||
@ -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',
|
||||
|
11
action.yml
11
action.yml
@ -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'
|
||||
|
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -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;
|
||||
@ -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
|
||||
switch (version + extension) {
|
||||
case '7.4redis':
|
||||
script += '\nAdd-Extension ' + extension + ' beta';
|
||||
break;
|
||||
default:
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
return script;
|
||||
@ -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 =
|
||||
|
80
package-lock.json
generated
80
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "1.5.6",
|
||||
"version": "1.5.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -543,12 +543,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.9.0.tgz",
|
||||
"integrity": "sha512-98rfOt3NYn5Gr9wekTB8TexxN6oM8ZRvYuphPs1Atfsy419SDLYCaE30aJkRiiTCwGEY98vOhFsEVm7Zs4toQQ==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.10.0.tgz",
|
||||
"integrity": "sha512-rT51fNLW0u3fnDGnAHVC5nu+Das+y2CpW10yqvf6/j5xbuUV3FxA3mBaIbM24CXODXjbgUznNb4Kg9XZOUxKAw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/experimental-utils": "2.9.0",
|
||||
"@typescript-eslint/experimental-utils": "2.10.0",
|
||||
"eslint-utils": "^1.4.3",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"regexpp": "^3.0.0",
|
||||
@ -556,32 +556,32 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/experimental-utils": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.9.0.tgz",
|
||||
"integrity": "sha512-0lOLFdpdJsCMqMSZT7l7W2ta0+GX8A3iefG3FovJjrX+QR8y6htFlFdU7aOVPL6pDvt6XcsOb8fxk5sq+girTw==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.10.0.tgz",
|
||||
"integrity": "sha512-FZhWq6hWWZBP76aZ7bkrfzTMP31CCefVIImrwP3giPLcoXocmLTmr92NLZxuIcTL4GTEOE33jQMWy9PwelL+yQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.3",
|
||||
"@typescript-eslint/typescript-estree": "2.9.0",
|
||||
"@typescript-eslint/typescript-estree": "2.10.0",
|
||||
"eslint-scope": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.9.0.tgz",
|
||||
"integrity": "sha512-fJ+dNs3CCvEsJK2/Vg5c2ZjuQ860ySOAsodDPwBaVlrGvRN+iCNC8kUfLFL8cT49W4GSiLPa/bHiMjYXA7EhKQ==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.10.0.tgz",
|
||||
"integrity": "sha512-wQNiBokcP5ZsTuB+i4BlmVWq6o+oAhd8en2eSm/EE9m7BgZUIfEeYFd6z3S+T7bgNuloeiHA1/cevvbBDLr98g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-visitor-keys": "^1.0.0",
|
||||
"@typescript-eslint/experimental-utils": "2.9.0",
|
||||
"@typescript-eslint/typescript-estree": "2.9.0",
|
||||
"@typescript-eslint/experimental-utils": "2.10.0",
|
||||
"@typescript-eslint/typescript-estree": "2.10.0",
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.9.0.tgz",
|
||||
"integrity": "sha512-v6btSPXEWCP594eZbM+JCXuFoXWXyF/z8kaSBSdCb83DF+Y7+xItW29SsKtSULgLemqJBT+LpT+0ZqdfH7QVmA==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.10.0.tgz",
|
||||
"integrity": "sha512-oOYnplddQNm/LGVkqbkAwx4TIBuuZ36cAQq9v3nFIU9FmhemHuVzAesMSXNQDdAzCa5bFgCrfD3JWhYVKlRN2g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
@ -1614,9 +1614,9 @@
|
||||
}
|
||||
},
|
||||
"eslint": {
|
||||
"version": "6.7.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.1.tgz",
|
||||
"integrity": "sha512-UWzBS79pNcsDSxgxbdjkmzn/B6BhsXMfUaOHnNwyE8nD+Q6pyT96ow2MccVayUTV4yMid4qLhMiQaywctRkBLA==",
|
||||
"version": "6.7.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.2.tgz",
|
||||
"integrity": "sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
@ -1776,9 +1776,9 @@
|
||||
}
|
||||
},
|
||||
"eslint-plugin-jest": {
|
||||
"version": "23.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.1.0.tgz",
|
||||
"integrity": "sha512-KHy1K0647bn86NTcWhWGoEIF9VgQ8YxR9hHZf/wQ4OvDwjRx27uk+mqvyZakWnRvIWFS/L25JNs4rnhsiE0adg==",
|
||||
"version": "23.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.1.1.tgz",
|
||||
"integrity": "sha512-2oPxHKNh4j1zmJ6GaCBuGcb8FVZU7YjFUOJzGOPnl9ic7VA/MGAskArLJiRIlnFUmi1EUxY+UiATAy8dv8s5JA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/experimental-utils": "^2.5.0"
|
||||
@ -2249,14 +2249,12 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -2271,20 +2269,17 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@ -2401,8 +2396,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@ -2414,7 +2408,6 @@
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@ -2429,7 +2422,6 @@
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -2437,14 +2429,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@ -2463,7 +2453,6 @@
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@ -2544,8 +2533,7 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@ -2557,7 +2545,6 @@
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@ -2679,7 +2666,6 @@
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
@ -5974,9 +5960,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.7.0",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.0.tgz",
|
||||
"integrity": "sha512-PC/ee458NEMITe1OufAjal65i6lB58R1HWMRcxwvdz1UopW0DYqlRL3xdu3IcTvTXsB02CRHykidkTRL+A3hQA==",
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.1.tgz",
|
||||
"integrity": "sha512-pnOF7jY82wdIhATVn87uUY/FHU+MDUdPLkmGFvGoclQmeu229eTkbG5gjGGBi3R7UuYYSEeYXY/TTY5j2aym2g==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
@ -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"
|
||||
|
@ -21,6 +21,9 @@ export async function addExtensionDarwin(
|
||||
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;
|
||||
@ -50,7 +53,14 @@ export async function addExtensionWindows(
|
||||
let script = '\n';
|
||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||
// add script to enable extension is already installed along with php
|
||||
switch (version + extension) {
|
||||
case '7.4redis':
|
||||
script += '\nAdd-Extension ' + extension + ' beta';
|
||||
break;
|
||||
default:
|
||||
script += '\nAdd-Extension ' + extension;
|
||||
break;
|
||||
}
|
||||
});
|
||||
return script;
|
||||
}
|
||||
@ -73,6 +83,10 @@ export async function addExtensionLinux(
|
||||
|
||||
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 =
|
||||
|
@ -20,13 +20,8 @@ add_log() {
|
||||
step_log "Setup PHP and Composer"
|
||||
version=$1
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then
|
||||
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$1" = "7.4" ]; then
|
||||
brew update >/dev/null 2>&1
|
||||
fi
|
||||
brew install php@"$1" composer >/dev/null 2>&1
|
||||
brew tap shivammathur/homebrew-php >/dev/null 2>&1
|
||||
brew install shivammathur/php/php@"$1" composer >/dev/null 2>&1
|
||||
brew link --force --overwrite php@"$1" >/dev/null 2>&1
|
||||
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
echo "date.timezone=UTC" >> "$ini_file"
|
||||
|
Loading…
Reference in New Issue
Block a user