Compare commits

...

11 Commits
1.3.4 ... 1.3.6

Author SHA1 Message Date
eaf140ca8b Fix xdebug version 2019-09-28 16:40:37 +05:30
dcd432d918 Remove log output from 7.4 on darwin 2019-09-28 08:01:23 +05:30
91a03a2865 Fix kerberos package name 2019-09-28 08:01:23 +05:30
ca33947c62 Fix logs 2019-09-28 08:01:23 +05:30
932b66f3fc Fix config.yaml path 2019-09-28 07:23:27 +05:30
651d2619bb Install extensions with PHP7.4 on darwin. 2019-09-28 01:15:33 +05:30
16f13a69eb Add extension to php.ini in windows using Add-Content 2019-09-27 00:15:03 +05:30
9134867822 Add coverage support, improve logs and fix bugs 2019-09-26 20:24:24 +05:30
36104f0983 Fix scripts and action workflow 2019-09-25 17:04:10 +05:30
a0b0e58cb3 Improve composer installer on darwin
- Check to signature.
- Add error handling.
2019-09-25 08:46:37 +05:30
c6f956927a Improve composer installer
- Check to signature.
- Add error handling.
- See Also https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
2019-09-25 08:46:37 +05:30
32 changed files with 1140 additions and 358 deletions

View File

@ -1,9 +1,5 @@
name: Main workflow name: Main workflow
on: on: [push]
push:
paths:
- '*'
- '!*.md'
jobs: jobs:
run: run:
name: Run name: Run

View File

@ -46,6 +46,26 @@ Setup PHP with required extensions, php.ini configuration and composer in [GitHu
- Extensions which are installed along with PHP if specified are enabled. - Extensions which are installed along with PHP if specified are enabled.
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interruped. - Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interruped.
## :signal_strength: Coverage support
- Specify `coverage: xdebug` to use `Xdebug`.
- Runs on all [PHP versions supported](#tada-php-support)
```
uses: shivammathur/setup-php@master
with:
php-version: 7.3
coverage: xdebug
```
- Specify `coverage: pcov` to use `PCOV`. `PCOV` is way faster than `Xdebug`
- For `pcov.directory` to be other than `src`, `lib` or, `app`, specify it using the `ini-values-csv` input.
- `PCOV` needs `PHPUnit >= 8.0` and `PHP >= 7.1`, `PHPUnit` needs `PHP >= 7.2`. So use `PHP >= 7.2` with `PCOV`
```
uses: shivammathur/setup-php@master
with:
php-version: 7.3
ini-values-csv: 'pcov.directory=api' #optional, see above for usage.
coverage: pcov
```
## :memo: Usage ## :memo: Usage
Inputs supported by this GitHub Action. Inputs supported by this GitHub Action.
@ -53,6 +73,7 @@ Inputs supported by this GitHub Action.
- php-version - php-version
- extension-csv (optional) - extension-csv (optional)
- ini-values-csv (optional) - ini-values-csv (optional)
- coverage (optional)
See [action.yml](action.yml) for more info See [action.yml](action.yml) for more info
@ -68,6 +89,7 @@ steps:
php-version: 7.3 php-version: 7.3
extension-csv: mbstring, xdebug #optional extension-csv: mbstring, xdebug #optional
ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional
coverage: xdebug #optional
- name: Check PHP Version - name: Check PHP Version
run: php -v run: php -v
- name: Check Composer Version - name: Check Composer Version
@ -97,6 +119,7 @@ jobs:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xdebug #optional extension-csv: mbstring, xdebug #optional
ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional ini-values-csv: "post_max_size=256M, short_open_tag=On" #optional
coverage: xdebug #optional
- name: Check PHP Version - name: Check PHP Version
run: php -v run: php -v
- name: Check Composer Version - name: Check Composer Version

View File

@ -22,17 +22,17 @@ describe('Features tests', () => {
); );
win32 = await features.addExtension('xdebug, pcov', '7.4', 'win32'); win32 = await features.addExtension('xdebug, pcov', '7.4', 'win32');
expect(win32).toContain( expect(win32).toContain(
'Install-PhpExtension xdebug -MinimumStability alpha' 'Install-PhpExtension xdebug -Version 2.8 -MinimumStability beta'
);
expect(win32).toContain(
'Install-PhpExtension pcov -MinimumStability alpha'
); );
expect(win32).toContain('Install-PhpExtension pcov -MinimumStability beta');
win32 = await features.addExtension('DoesNotExist', '7.2', 'win32'); win32 = await features.addExtension('does_not_exist', '7.2', 'win32');
expect(win32).not.toContain( expect(win32).toContain('Could not find does_not_exist for PHP7.2 on PECL');
'Install-PhpExtension DoesNotExist -MinimumStability stable'
); win32 = await features.addExtension('xdebug', '7.2', 'fedora');
expect(win32).toContain('Platform fedora is not supported');
}); });
it('checking addExtensionOnLinux', async () => { it('checking addExtensionOnLinux', async () => {
let linux: string = await features.addExtension( let linux: string = await features.addExtension(
'xdebug, pcov', 'xdebug, pcov',
@ -45,7 +45,11 @@ describe('Features tests', () => {
expect(linux).toContain( expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov' 'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov'
); );
linux = await features.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
}); });
it('checking addExtensionOnDarwin', async () => { it('checking addExtensionOnDarwin', async () => {
let darwin: string = await features.addExtension( let darwin: string = await features.addExtension(
'xdebug, pcov', 'xdebug, pcov',
@ -55,8 +59,25 @@ describe('Features tests', () => {
expect(darwin).toContain('sudo pecl install xdebug'); expect(darwin).toContain('sudo pecl install xdebug');
expect(darwin).toContain('sudo pecl install pcov'); expect(darwin).toContain('sudo pecl install pcov');
darwin = await features.addExtension('DoesNotExist', '7.2', 'darwin'); darwin = await features.addExtension('pcov', '5.6', 'darwin');
expect(darwin).not.toContain('sudo pecl install DoesNotExist'); expect(darwin).toContain('sudo pecl install pcov');
darwin = await features.addExtension('pcov', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
darwin = await features.addExtension('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
darwin = await features.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug');
darwin = await features.addExtension('does_not_exist', '7.2', 'darwin');
expect(darwin).toContain(
'Could not find does_not_exist for PHP7.2 on PECL'
);
darwin = await features.addExtension('xdebug', '7.2', 'fedora');
expect(darwin).toContain('Platform fedora is not supported');
}); });
it('checking addINIValuesOnWindows', async () => { it('checking addINIValuesOnWindows', async () => {
@ -73,6 +94,12 @@ describe('Features tests', () => {
expect(win32).toContain( expect(win32).toContain(
'Add-Content C:\\tools\\php\\php.ini "date.timezone=Asia/Kolkata"' 'Add-Content C:\\tools\\php\\php.ini "date.timezone=Asia/Kolkata"'
); );
win32 = await features.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(win32).toContain('Platform fedora is not supported');
}); });
it('checking addINIValuesOnLinux', async () => { it('checking addINIValuesOnLinux', async () => {
@ -83,6 +110,12 @@ describe('Features tests', () => {
expect(linux).toContain('echo "post_max_size=256M" >> $ini_file'); expect(linux).toContain('echo "post_max_size=256M" >> $ini_file');
expect(linux).toContain('echo "short_open_tag=On" >> $ini_file'); expect(linux).toContain('echo "short_open_tag=On" >> $ini_file');
expect(linux).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file'); expect(linux).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
linux = await features.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(linux).toContain('Platform fedora is not supported');
}); });
it('checking addINIValuesOnDarwin', async () => { it('checking addINIValuesOnDarwin', async () => {
@ -93,5 +126,83 @@ describe('Features tests', () => {
expect(darwin).toContain('echo "post_max_size=256M" >> $ini_file'); expect(darwin).toContain('echo "post_max_size=256M" >> $ini_file');
expect(darwin).toContain('echo "short_open_tag=On" >> $ini_file'); expect(darwin).toContain('echo "short_open_tag=On" >> $ini_file');
expect(darwin).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file'); expect(darwin).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
darwin = await features.addINIValues(
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
'fedora'
);
expect(darwin).toContain('Platform fedora is not supported');
});
it('checking addCoverage on windows', async () => {
let win32: string = await features.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain(
'Install-PhpExtension xdebug -Version 2.8 -MinimumStability beta'
);
win32 = await features.addCoverage('xdebug', '7.3', 'win32');
expect(win32).toContain(
'Install-PhpExtension xdebug -MinimumStability stable'
);
win32 = await features.addCoverage('pcov', '7.4', 'win32');
expect(win32).toContain('Install-PhpExtension pcov -MinimumStability beta');
expect(win32).toContain(
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
);
win32 = await features.addCoverage('pcov', '7.3', 'win32');
expect(win32).toContain(
'Install-PhpExtension pcov -MinimumStability stable'
);
expect(win32).toContain(
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
);
win32 = await features.addCoverage('nocov', '7.3', 'win32');
expect(win32).toContain('');
win32 = await features.addCoverage('pcov', '7.0', 'win32');
expect(win32).toContain('pcov requires php 7.1 or newer');
win32 = await features.addCoverage('pcov', '5.6', 'win32');
expect(win32).toContain('pcov requires php 7.1 or newer');
win32 = await features.addCoverage('', '7.4', 'win32');
expect(win32).toEqual('');
});
it('checking addCoverage on linux', async () => {
let linux: string = await features.addCoverage('xdebug', '7.4', 'linux');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.4-xdebug'
);
linux = await features.addCoverage('pcov', '7.4', 'linux');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.4-pcov'
);
expect(linux).toContain(
"sudo phpdismod xdebug || echo 'xdebug not installed'"
);
expect(linux).toContain("sudo phpenmod pcov || echo 'pcov not installed'");
linux = await features.addCoverage('', '7.4', 'linux');
expect(linux).toEqual('');
});
it('checking addCoverage on darwin', async () => {
let darwin: string = await features.addCoverage('xdebug', '7.4', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug');
darwin = await features.addCoverage('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
darwin = await features.addCoverage('pcov', '7.4', 'darwin');
expect(darwin).toContain('sudo pecl install pcov');
expect(darwin).toContain('sudo sed -i \'\' "/xdebug/d" $ini_file\n');
darwin = await features.addCoverage('', '7.4', 'win32');
expect(darwin).toEqual('');
}); });
}); });

View File

@ -10,6 +10,12 @@ jest.mock('../src/pecl', () => ({
}) })
})); }));
jest.mock('@actions/core', () => ({
getInput: jest.fn().mockImplementation(key => {
return ['setup-php'].indexOf(key) !== -1 ? key : '';
})
}));
async function cleanup(path: string): Promise<void> { async function cleanup(path: string): Promise<void> {
fs.unlink(path, error => { fs.unlink(path, error => {
if (error) { if (error) {
@ -21,7 +27,10 @@ async function cleanup(path: string): Promise<void> {
describe('Utils tests', () => { describe('Utils tests', () => {
it('checking getInput', async () => { it('checking getInput', async () => {
process.env['test'] = 'setup-php'; process.env['test'] = 'setup-php';
process.env['undefined'] = '';
expect(await utils.getInput('test', false)).toBe('setup-php'); expect(await utils.getInput('test', false)).toBe('setup-php');
expect(await utils.getInput('undefined', false)).toBe('');
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
expect(await utils.getInput('DoesNotExist', false)).toBe(''); expect(await utils.getInput('DoesNotExist', false)).toBe('');
}); });
@ -51,10 +60,13 @@ describe('Utils tests', () => {
path.join(__dirname, '../src/win32.ps1'), path.join(__dirname, '../src/win32.ps1'),
'utf8' 'utf8'
); );
expect(rc).toBe(await utils.readScript('darwin.sh', '7.4', 'darwin')); expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(rc);
expect(darwin).toBe(await utils.readScript('darwin.sh', '7.3', 'darwin')); expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
expect(linux).toBe(await utils.readScript('linux.sh', '7.3', 'linux')); expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
expect(win32).toBe(await utils.readScript('win32.ps1', '7.3', 'win32')); expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain(
'Platform fedora is not supported'
);
}); });
it('checking writeScripts', async () => { it('checking writeScripts', async () => {
@ -86,6 +98,47 @@ describe('Utils tests', () => {
]); ]);
}); });
it('checking log', async () => {
let message: string = 'Test message';
let warning_log: string = await utils.log(message, 'win32', 'warning');
// expect(warning_log).toEqual(
// "Write-Host '" + message + "' -ForegroundColor yellow"
// );
warning_log = await utils.log(message, 'linux', 'warning');
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
warning_log = await utils.log(message, 'darwin', 'warning');
expect(warning_log).toEqual('echo -e "\\033[33;1m' + message + '\\033[0m"');
let error_log: string = await utils.log(message, 'win32', 'error');
// expect(error_log).toEqual(
// "Write-Host '" + message + "' -ForegroundColor red"
// );
error_log = await utils.log(message, 'linux', 'error');
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
error_log = await utils.log(message, 'darwin', 'error');
expect(error_log).toEqual('echo -e "\\033[31;1m' + message + '\\033[0m"');
let success_log: string = await utils.log(message, 'win32', 'success');
// expect(success_log).toEqual(
// "Write-Host '" + message + "' -ForegroundColor green"
// );
success_log = await utils.log(message, 'linux', 'success');
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
success_log = await utils.log(message, 'darwin', 'success');
expect(success_log).toEqual('echo -e "\\033[32;1m' + message + '\\033[0m"');
});
it('checking getExtensionPrefix', async () => {
expect(await utils.getExtensionPrefix('extensionDoesNotExist')).toEqual(
'extension'
);
expect(await utils.getExtensionPrefix('xsl')).toEqual('extension');
expect(await utils.getExtensionPrefix('xdebug')).toEqual('zend_extension');
expect(await utils.getExtensionPrefix('opcache')).toEqual('zend_extension');
});
});
describe('pecl tests', () => {
it('checking checkPECLExtension', async () => { it('checking checkPECLExtension', async () => {
expect(await pecl.checkPECLExtension('extensionDoesNotExist')).toBe(false); expect(await pecl.checkPECLExtension('extensionDoesNotExist')).toBe(false);
expect(await pecl.checkPECLExtension('xdebug')).toBe(true); expect(await pecl.checkPECLExtension('xdebug')).toBe(true);

View File

@ -14,6 +14,9 @@ inputs:
ini-values-csv: ini-values-csv:
description: '(Optional) Custom values you want to set in php.ini' description: '(Optional) Custom values you want to set in php.ini'
required: false required: false
coverage:
description: '(Optional) Driver to calculate code coverage (Accepts: xdebug and pcov)'
required: false
runs: runs:
using: 'node12' using: 'node12'
main: 'lib/install.js' main: 'lib/install.js'

60
config.yaml Normal file
View File

@ -0,0 +1,60 @@
variants:
dev:
bcmath:
calendar:
cli:
ctype:
dom:
fileinfo:
filter:
ipc:
iconv:
json:
mbregex:
mbstring:
mhash:
mcrypt:
pcntl:
pcre:
pdo:
phar:
posix:
sockets:
tokenizer:
xml:
curl:
openssl:
zip:
gd:
- --with-freetype
- --with-pdo-mysql=mysqlnd
- --with-mysqli=mysqlnd
- --with-pgsql
- --with-pdo-pgsql
- --with-gmp=/usr/local/opt/gmp
- --with-openssl
- --with-pear
- --with-zip
- --with-zlib-dir=/usr/local/opt/zlib
- --with-libxml
- --with-kerberos
- --with-gd
- --with-ffi
- --with-bz2=/usr/local/opt/bzip2
- --with-readline=/usr/local/opt/readline
- --with-iconv=/usr/local/opt/libiconv
- --with-icu-dir=/usr/local/opt/icu4c
- --enable-intl
- --enable-xml
- --enable-sysvsem
- --enable-sysvshm
- --enable-sysvmsg
- --enable-phpdbg
- --enable-exif
- --enable-gd
- --enable-soap
- --enable-xmlreader
- --enable-zend-test=shared
extensions:
dev:
xdebug: stable

View File

@ -18,24 +18,32 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const utils = __importStar(require("./utils")); const utils = __importStar(require("./utils"));
const pecl = __importStar(require("./pecl")); const pecl = __importStar(require("./pecl"));
function addExtension(extensions, version, os_version) { function addExtension(extension_csv, version, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (os_version === 'win32') { switch (os_version) {
return yield addExtensionWindows(extensions, version); case 'win32':
return yield addExtensionWindows(extension_csv, version);
case 'darwin':
return yield addExtensionDarwin(extension_csv, version);
case 'linux':
return yield addExtensionLinux(extension_csv, version);
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
} }
else if (os_version === 'linux') {
return yield addExtensionLinux(extensions, version);
}
return yield addExtensionDarwin(extensions);
}); });
} }
exports.addExtension = addExtension; exports.addExtension = addExtension;
function addINIValues(ini_values_csv, os_version) { function addINIValues(ini_values_csv, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (os_version === 'win32') { switch (os_version) {
return yield addINIValuesWindows(ini_values_csv); case 'win32':
return yield addINIValuesWindows(ini_values_csv);
case 'darwin':
case 'linux':
return yield addINIValuesUnix(ini_values_csv);
default:
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
} }
return yield addINIValuesUnix(ini_values_csv);
}); });
} }
exports.addINIValues = addINIValues; exports.addINIValues = addINIValues;
@ -46,14 +54,17 @@ exports.addINIValues = addINIValues;
*/ */
function enableExtensionWindows(extension) { function enableExtensionWindows(extension) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return `try { return (`try {
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll $exist = Test-Path -Path $ext_dir\\php_${extension}.dll
if(!(php -m | findstr -i ${extension}) -and $exist) { if(!(php -m | findstr -i ${extension}) -and $exist) {
Enable-PhpExtension ${extension} C:\\tools\\php Add-Content C:\\tools\\php\\php.ini "${yield utils.getExtensionPrefix(extension)}=php_${extension}.dll"\n` +
} (yield utils.log('Enabled ' + extension, 'win32', 'success')) +
} catch [Exception] { ` } elseif(php -m | findstr -i ${extension}) {\n` +
echo $_ (yield utils.log('Extension ' + extension + ' was already enabled', 'win32', 'success')) +
}\n`; ` }
} catch [Exception] {\n` +
(yield utils.log(extension + ' could not be enabled', 'win32', 'error')) +
` }\n`);
}); });
} }
exports.enableExtensionWindows = enableExtensionWindows; exports.enableExtensionWindows = enableExtensionWindows;
@ -61,13 +72,16 @@ exports.enableExtensionWindows = enableExtensionWindows;
* Enable extensions which are installed but not enabled on unix * Enable extensions which are installed but not enabled on unix
* *
* @param extension * @param extension
* @param os_version
*/ */
function enableExtensionUnix(extension) { function enableExtensionUnix(extension, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return `if [ ! "$(php -m | grep ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then return (`if [ ! "$(php -m | grep -i ${extension})" ] && [ -e "$ext_dir/php_${extension}.so" ]; then
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"' echo "${yield utils.getExtensionPrefix(extension)}=php_${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'\n` +
echo "${extension} enabled" (yield utils.log('Enabled ' + extension, os_version, 'success')) +
fi\n`; `;\n elif [ "$(php -m | grep -i ${extension})" ]; then \n` +
(yield utils.log('Extension ' + extension + ' was already enabled', os_version, 'success')) +
`; fi\n`);
}); });
} }
exports.enableExtensionUnix = enableExtensionUnix; exports.enableExtensionUnix = enableExtensionUnix;
@ -75,24 +89,52 @@ exports.enableExtensionUnix = enableExtensionUnix;
* Install and enable extensions for darwin * Install and enable extensions for darwin
* *
* @param extension_csv * @param extension_csv
* @param version
*/ */
function addExtensionDarwin(extension_csv) { function addExtensionDarwin(extension_csv, version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let extensions = yield utils.extensionArray(extension_csv); let extensions = yield utils.extensionArray(extension_csv);
let script = '\n'; let script = '\n';
yield utils.asyncForEach(extensions, function (extension) { yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += yield enableExtensionUnix(extension); script += yield enableExtensionUnix(extension, 'darwin');
if (yield pecl.checkPECLExtension(extension)) { switch (yield pecl.checkPECLExtension(extension)) {
script += case true:
'if [ ! "$(php -m | grep ' + let extension_version = extension;
extension + switch (version + extension) {
')" ]; then sudo pecl install ' + case '5.6xdebug':
extension + extension_version = 'xdebug-2.5.5';
' || echo "Couldn\'t find extension: ' + break;
extension + case '7.4xdebug':
'"; fi\n'; extension_version = 'xdebug-2.8.0beta2';
break;
case '7.2xdebug':
default:
extension_version = extension;
break;
}
script +=
'if [ ! "$(php -m | grep -i ' +
extension +
')" ]; then sudo pecl install ' +
extension_version +
' >/dev/null 2>&1 && ' +
(yield utils.log('Installed and enabled ' + extension, 'darwin', 'success')) +
' || ' +
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'darwin', 'error')) +
'; fi\n';
break;
case false:
default:
script +=
'if [ ! "$(php -m | grep -i ' +
extension +
')" ]; then \n' +
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'darwin', 'error')) +
'; fi\n';
break;
} }
}); });
}); });
@ -112,24 +154,54 @@ function addExtensionWindows(extension_csv, version) {
let script = '\n'; let script = '\n';
yield utils.asyncForEach(extensions, function (extension) { yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += yield enableExtensionWindows(extension); script += yield enableExtensionWindows(extension);
let extension_version = 'stable'; let extension_stability = '';
if (version == '7.4') { switch (version) {
extension_version = 'alpha'; case '7.4':
extension_stability = 'beta';
break;
case '7.2':
default:
extension_stability = 'stable';
break;
} }
if (yield pecl.checkPECLExtension(extension)) { switch (yield pecl.checkPECLExtension(extension)) {
script += case true:
'if(!(php -m | findstr -i ' + let extension_version = extension;
extension + switch (version + extension) {
')) { ' + case '7.4xdebug':
'try { Install-PhpExtension ' + extension_version = 'xdebug -Version 2.8';
extension + break;
' -MinimumStability ' + case '7.2xdebug':
extension_version + default:
' } catch [Exception] { echo $_; echo "Could not install extension: "' + extension_version = extension;
extension + break;
' } }\n'; }
script +=
'if(!(php -m | findstr -i ' +
extension +
')) { ' +
'try { Install-PhpExtension ' +
extension_version +
' -MinimumStability ' +
extension_stability +
'\n' +
(yield utils.log('Installed and enabled ' + extension, 'win32', 'success')) +
' } catch [Exception] { ' +
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'win32', 'error')) +
' } }\n';
break;
case false:
default:
script +=
'if(!(php -m | findstr -i ' +
extension +
')) { ' +
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'win32', 'error')) +
' } \n';
break;
} }
}); });
}); });
@ -149,20 +221,29 @@ function addExtensionLinux(extension_csv, version) {
let script = '\n'; let script = '\n';
yield utils.asyncForEach(extensions, function (extension) { yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += yield enableExtensionUnix(extension); script += yield enableExtensionUnix(extension, 'linux');
script += script +=
'if [ ! "$(php -m | grep ' + 'if [ ! "$(php -m | grep -i ' +
extension + extension +
')" ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' + ')" ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version + version +
'-' + '-' +
extension + extension +
' || echo "Couldn\'t find extension php' + ' >/dev/null 2>&1 || sudo DEBIAN_FRONTEND=noninteractive apt install -y php-' +
version +
'-' +
extension + extension +
'"; fi\n'; ' >/dev/null 2>&1 && ' +
(yield utils.log('Installed and enabled ' + extension, 'linux', 'success')) +
' || ' +
(yield utils.log('Could not find php-' +
extension +
' or php' +
version +
'-' +
extension +
' on APT repository', 'linux', 'error')) +
'; fi\n';
}); });
}); });
return script; return script;
@ -207,3 +288,54 @@ function addINIValuesWindows(ini_values_csv) {
}); });
} }
exports.addINIValuesWindows = addINIValuesWindows; exports.addINIValuesWindows = addINIValuesWindows;
function addCoverage(coverage, version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
let script = '';
script += '\n';
coverage = coverage.toLowerCase();
// pcov
switch (coverage) {
case 'pcov':
// if version is 7.1 or newer
switch (version) {
default:
script += yield addExtension(coverage, version, os_version);
script += yield addINIValues('pcov.enabled=1', os_version);
// add command to disable xdebug and enable pcov
switch (os_version) {
case 'linux':
script +=
"sudo phpdismod xdebug || echo 'xdebug not installed'\n";
script += "sudo phpenmod pcov || echo 'pcov not installed'\n";
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
break;
}
// success
script += yield utils.log('pcov enabled as coverage driver', os_version, 'success');
// version is not supported
break;
case '5.6':
case '7.0':
script += yield utils.log('pcov requires php 7.1 or newer', os_version, 'warning');
break;
}
break;
//xdebug
case 'xdebug':
script += yield addExtension(coverage, version, os_version);
script += yield utils.log('Xdebug enabled as coverage driver', os_version, 'success');
break;
// unknown coverage driver
default:
script = '';
}
return script;
});
}
exports.addCoverage = addCoverage;

View File

@ -30,12 +30,14 @@ function run() {
let version = yield utils.getInput('php-version', true); let version = yield utils.getInput('php-version', true);
let extension_csv = yield utils.getInput('extension-csv', false); let extension_csv = yield utils.getInput('extension-csv', false);
let ini_values_csv = yield utils.getInput('ini-values-csv', false); let ini_values_csv = yield utils.getInput('ini-values-csv', false);
let coverage = yield utils.getInput('coverage', false);
let os_version = process.platform; let os_version = process.platform;
// check the os version and run the respective script // check the os version and run the respective script
if (os_version == 'darwin') { if (os_version == 'darwin') {
let darwin = yield utils.readScript('darwin.sh', version, os_version); let darwin = yield utils.readScript('darwin.sh', version, os_version);
darwin += yield features.addExtension(extension_csv, version, os_version); darwin += yield features.addExtension(extension_csv, version, os_version);
darwin += yield features.addINIValues(ini_values_csv, os_version); darwin += yield features.addINIValues(ini_values_csv, os_version);
darwin += yield features.addCoverage(coverage, version, os_version);
yield utils.writeScript('darwin.sh', version, darwin); yield utils.writeScript('darwin.sh', version, darwin);
yield exec_1.exec('sh -x ./' + version + 'darwin.sh ' + version); yield exec_1.exec('sh -x ./' + version + 'darwin.sh ' + version);
} }
@ -43,6 +45,7 @@ function run() {
let windows = yield utils.readScript('win32.ps1', version, os_version); let windows = yield utils.readScript('win32.ps1', version, os_version);
windows += yield features.addExtension(extension_csv, version, os_version); windows += yield features.addExtension(extension_csv, version, os_version);
windows += yield features.addINIValues(ini_values_csv, os_version); windows += yield features.addINIValues(ini_values_csv, os_version);
windows += yield features.addCoverage(coverage, version, os_version);
yield utils.writeScript('win32.ps1', version, windows); yield utils.writeScript('win32.ps1', version, windows);
yield exec_1.exec('powershell .\\' + version + 'win32.ps1 -version ' + version); yield exec_1.exec('powershell .\\' + version + 'win32.ps1 -version ' + version);
} }
@ -50,6 +53,7 @@ function run() {
let linux = yield utils.readScript('linux.sh', version, os_version); let linux = yield utils.readScript('linux.sh', version, os_version);
linux += yield features.addExtension(extension_csv, version, os_version); linux += yield features.addExtension(extension_csv, version, os_version);
linux += yield features.addINIValues(ini_values_csv, os_version); linux += yield features.addINIValues(ini_values_csv, os_version);
linux += yield features.addCoverage(coverage, version, os_version);
yield utils.writeScript('linux.sh', version, linux); yield utils.writeScript('linux.sh', version, linux);
yield exec_1.exec('./' + version + 'linux.sh ' + version); yield exec_1.exec('./' + version + 'linux.sh ' + version);
} }

View File

@ -22,10 +22,13 @@ const core = __importStar(require("@actions/core"));
function getInput(name, mandatory) { function getInput(name, mandatory) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let input = process.env[name]; let input = process.env[name];
if (!input) { switch (input) {
input = core.getInput(name, { required: mandatory }); case '':
case undefined:
return core.getInput(name, { required: mandatory });
default:
return input;
} }
return input;
}); });
} }
exports.getInput = getInput; exports.getInput = getInput;
@ -53,10 +56,22 @@ exports.asyncForEach = asyncForEach;
*/ */
function readScript(filename, version, os_version) { function readScript(filename, version, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (version === '7.4' && os_version === 'darwin') { switch (os_version) {
return fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8'); case 'darwin':
switch (version) {
case '7.4':
fs.createReadStream(path.join(__dirname, '../src/config.yaml')).pipe(fs.createWriteStream('config.yaml'));
return fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8');
case '7.3':
default:
return fs.readFileSync(path.join(__dirname, '../src/' + filename), 'utf8');
}
case 'win32':
case 'linux':
return fs.readFileSync(path.join(__dirname, '../src/' + filename), 'utf8');
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
} }
return fs.readFileSync(path.join(__dirname, '../src/' + filename), 'utf8');
}); });
} }
exports.readScript = readScript; exports.readScript = readScript;
@ -102,3 +117,41 @@ function INIArray(ini_values_csv) {
}); });
} }
exports.INIArray = INIArray; exports.INIArray = INIArray;
function log(message, os_version, log_type) {
return __awaiter(this, void 0, void 0, function* () {
const unix_color = {
error: '31',
success: '32',
warning: '33'
};
switch (os_version) {
case 'win32':
const color = {
error: 'red',
success: 'green',
warning: 'yellow'
};
return "Write-Host '" + message + "' -ForegroundColor " + color[log_type];
case 'linux':
return ('echo "\\033[' + unix_color[log_type] + ';1m' + message + '\\033[0m"');
case 'darwin':
default:
return ('echo -e "\\033[' + unix_color[log_type] + ';1m' + message + '\\033[0m"');
}
});
}
exports.log = log;
function getExtensionPrefix(extension) {
return __awaiter(this, void 0, void 0, function* () {
let zend = ['xdebug', 'opcache'];
switch (zend.indexOf(extension)) {
case 0:
case 1:
return 'zend_extension';
case -1:
default:
return 'extension';
}
});
}
exports.getExtensionPrefix = getExtensionPrefix;

View File

@ -1,7 +0,0 @@
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -20,7 +20,7 @@ function issue(name, message = '') {
issueCommand(name, {}, message); issueCommand(name, {}, message);
} }
exports.issue = issue; exports.issue = issue;
const CMD_PREFIX = '##['; const CMD_STRING = '::';
class Command { class Command {
constructor(command, properties, message) { constructor(command, properties, message) {
if (!command) { if (!command) {
@ -31,7 +31,7 @@ class Command {
this.message = message; this.message = message;
} }
toString() { toString() {
let cmdStr = CMD_PREFIX + this.command; let cmdStr = CMD_STRING + this.command;
if (this.properties && Object.keys(this.properties).length > 0) { if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' '; cmdStr += ' ';
for (const key in this.properties) { for (const key in this.properties) {
@ -40,12 +40,12 @@ class Command {
if (val) { if (val) {
// safely append the val - avoid blowing up when attempting to // safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason // call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)};`; cmdStr += `${key}=${escape(`${val || ''}`)},`;
} }
} }
} }
} }
cmdStr += ']'; cmdStr += CMD_STRING;
// safely append the message - avoid blowing up when attempting to // safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason // call .replace() if message is not a string for some reason
const message = `${this.message || ''}`; const message = `${this.message || ''}`;

View File

@ -1 +1 @@
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe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AK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}

View File

@ -71,6 +71,11 @@ export declare function error(message: string): void;
* @param message warning issue message * @param message warning issue message
*/ */
export declare function warning(message: string): void; export declare function warning(message: string): void;
/**
* Writes info to log with console.log.
* @param message info message
*/
export declare function info(message: string): void;
/** /**
* Begin an output group. * Begin an output group.
* *

View File

@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command"); const command_1 = require("./command");
const os = require("os");
const path = require("path"); const path = require("path");
/** /**
* The code to exit an action * The code to exit an action
@ -68,7 +69,7 @@ exports.addPath = addPath;
* @returns string * @returns string
*/ */
function getInput(name, options) { function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || ''; const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
@ -125,6 +126,14 @@ function warning(message) {
command_1.issue('warning', message); command_1.issue('warning', message);
} }
exports.warning = warning; exports.warning = warning;
/**
* Writes info to log with console.log.
* @param message info message
*/
function info(message) {
process.stdout.write(message + os.EOL);
}
exports.info = info;
/** /**
* Begin an output group. * Begin an output group.
* *

View File

@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;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AA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC"}

View File

@ -1,33 +1,33 @@
{ {
"_args": [ "_args": [
[ [
"@actions/core@1.1.0", "@actions/core@1.1.1",
"E:\\python\\setup-php" "E:\\python\\setup-php"
] ]
], ],
"_from": "@actions/core@1.1.0", "_from": "@actions/core@1.1.1",
"_id": "@actions/core@1.1.0", "_id": "@actions/core@1.1.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA==", "_integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==",
"_location": "/@actions/core", "_location": "/@actions/core",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/core@1.1.0", "raw": "@actions/core@1.1.1",
"name": "@actions/core", "name": "@actions/core",
"escapedName": "@actions%2fcore", "escapedName": "@actions%2fcore",
"scope": "@actions", "scope": "@actions",
"rawSpec": "1.1.0", "rawSpec": "1.1.1",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.1.0" "fetchSpec": "1.1.1"
}, },
"_requiredBy": [ "_requiredBy": [
"/", "/",
"/@actions/tool-cache" "/@actions/tool-cache"
], ],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz", "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
"_spec": "1.1.0", "_spec": "1.1.1",
"_where": "E:\\python\\setup-php", "_where": "E:\\python\\setup-php",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
@ -43,7 +43,6 @@
"files": [ "files": [
"lib" "lib"
], ],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core", "homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
"keywords": [ "keywords": [
"github", "github",
@ -64,5 +63,5 @@
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc"
}, },
"version": "1.1.0" "version": "1.1.1"
} }

View File

@ -1,7 +0,0 @@
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -11,7 +11,7 @@ You can use this to download tools (or other files) from a download URL:
```js ```js
const tc = require('@actions/tool-cache'); const tc = require('@actions/tool-cache');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz'); const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
``` ```
#### Extract #### Extract
@ -22,15 +22,15 @@ These can then be extracted in platform specific ways:
const tc = require('@actions/tool-cache'); const tc = require('@actions/tool-cache');
if (process.platform === 'win32') { if (process.platform === 'win32') {
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip'); const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to'); const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
// Or alternately // Or alternately
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z'); const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to'); const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
} }
else { else {
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz'); const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to'); const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
} }
``` ```
@ -45,7 +45,7 @@ You'll often want to add it to the path as part of this step:
const tc = require('@actions/tool-cache'); const tc = require('@actions/tool-cache');
const core = require('@actions/core'); const core = require('@actions/core');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz'); const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to'); const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0'); const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');

View File

@ -218,12 +218,7 @@ function extractZip(file, dest) {
yield extractZipWin(file, dest); yield extractZipWin(file, dest);
} }
else { else {
if (process.platform === 'darwin') { yield extractZipNix(file, dest);
yield extractZipDarwin(file, dest);
}
else {
yield extractZipNix(file, dest);
}
} }
return dest; return dest;
}); });
@ -252,13 +247,7 @@ function extractZipWin(file, dest) {
} }
function extractZipNix(file, dest) { function extractZipNix(file, dest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip'); const unzipPath = yield io.which('unzip');
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
});
}
function extractZipDarwin(file, dest) {
return __awaiter(this, void 0, void 0, function* () {
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest }); yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
}); });
} }

File diff suppressed because one or more lines are too long

View File

@ -1,32 +1,32 @@
{ {
"_args": [ "_args": [
[ [
"@actions/tool-cache@1.1.1", "@actions/tool-cache@1.1.2",
"E:\\python\\setup-php" "E:\\python\\setup-php"
] ]
], ],
"_from": "@actions/tool-cache@1.1.1", "_from": "@actions/tool-cache@1.1.2",
"_id": "@actions/tool-cache@1.1.1", "_id": "@actions/tool-cache@1.1.2",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA==", "_integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
"_location": "/@actions/tool-cache", "_location": "/@actions/tool-cache",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/tool-cache@1.1.1", "raw": "@actions/tool-cache@1.1.2",
"name": "@actions/tool-cache", "name": "@actions/tool-cache",
"escapedName": "@actions%2ftool-cache", "escapedName": "@actions%2ftool-cache",
"scope": "@actions", "scope": "@actions",
"rawSpec": "1.1.1", "rawSpec": "1.1.2",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.1.1" "fetchSpec": "1.1.2"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz", "_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
"_spec": "1.1.1", "_spec": "1.1.2",
"_where": "E:\\python\\setup-php", "_where": "E:\\python\\setup-php",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
@ -54,7 +54,6 @@
"lib", "lib",
"scripts" "scripts"
], ],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec", "homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
"keywords": [ "keywords": [
"github", "github",
@ -75,5 +74,5 @@
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc"
}, },
"version": "1.1.1" "version": "1.1.2"
} }

Binary file not shown.

Binary file not shown.

188
package-lock.json generated
View File

@ -1,13 +1,13 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "1.3.4", "version": "1.3.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
"integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA==" "integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg=="
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.1", "version": "1.0.1",
@ -20,9 +20,9 @@
"integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA==" "integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA=="
}, },
"@actions/tool-cache": { "@actions/tool-cache": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
"integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA==", "integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
"requires": { "requires": {
"@actions/core": "^1.1.0", "@actions/core": "^1.1.0",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
@ -42,18 +42,18 @@
} }
}, },
"@babel/core": { "@babel/core": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.2.tgz",
"integrity": "sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg==", "integrity": "sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.5.5", "@babel/code-frame": "^7.5.5",
"@babel/generator": "^7.5.5", "@babel/generator": "^7.6.2",
"@babel/helpers": "^7.5.5", "@babel/helpers": "^7.6.2",
"@babel/parser": "^7.5.5", "@babel/parser": "^7.6.2",
"@babel/template": "^7.4.4", "@babel/template": "^7.6.0",
"@babel/traverse": "^7.5.5", "@babel/traverse": "^7.6.2",
"@babel/types": "^7.5.5", "@babel/types": "^7.6.0",
"convert-source-map": "^1.1.0", "convert-source-map": "^1.1.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"json5": "^2.1.0", "json5": "^2.1.0",
@ -93,16 +93,15 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.2.tgz",
"integrity": "sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ==", "integrity": "sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.5.5", "@babel/types": "^7.6.0",
"jsesc": "^2.5.1", "jsesc": "^2.5.1",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"source-map": "^0.5.0", "source-map": "^0.5.0"
"trim-right": "^1.0.1"
}, },
"dependencies": { "dependencies": {
"source-map": { "source-map": {
@ -149,14 +148,14 @@
} }
}, },
"@babel/helpers": { "@babel/helpers": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.6.2.tgz",
"integrity": "sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g==", "integrity": "sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/template": "^7.4.4", "@babel/template": "^7.6.0",
"@babel/traverse": "^7.5.5", "@babel/traverse": "^7.6.2",
"@babel/types": "^7.5.5" "@babel/types": "^7.6.0"
} }
}, },
"@babel/highlight": { "@babel/highlight": {
@ -171,9 +170,9 @@
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.2.tgz",
"integrity": "sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g==", "integrity": "sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==",
"dev": true "dev": true
}, },
"@babel/plugin-syntax-object-rest-spread": { "@babel/plugin-syntax-object-rest-spread": {
@ -186,28 +185,28 @@
} }
}, },
"@babel/template": { "@babel/template": {
"version": "7.4.4", "version": "7.6.0",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.6.0.tgz",
"integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", "integrity": "sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
"@babel/parser": "^7.4.4", "@babel/parser": "^7.6.0",
"@babel/types": "^7.4.4" "@babel/types": "^7.6.0"
} }
}, },
"@babel/traverse": { "@babel/traverse": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.2.tgz",
"integrity": "sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ==", "integrity": "sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.5.5", "@babel/code-frame": "^7.5.5",
"@babel/generator": "^7.5.5", "@babel/generator": "^7.6.2",
"@babel/helper-function-name": "^7.1.0", "@babel/helper-function-name": "^7.1.0",
"@babel/helper-split-export-declaration": "^7.4.4", "@babel/helper-split-export-declaration": "^7.4.4",
"@babel/parser": "^7.5.5", "@babel/parser": "^7.6.2",
"@babel/types": "^7.5.5", "@babel/types": "^7.6.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"globals": "^11.1.0", "globals": "^11.1.0",
"lodash": "^4.17.13" "lodash": "^4.17.13"
@ -231,9 +230,9 @@
} }
}, },
"@babel/types": { "@babel/types": {
"version": "7.5.5", "version": "7.6.1",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz",
"integrity": "sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw==", "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==",
"dev": true, "dev": true,
"requires": { "requires": {
"esutils": "^2.0.2", "esutils": "^2.0.2",
@ -473,9 +472,9 @@
} }
}, },
"@types/babel__generator": { "@types/babel__generator": {
"version": "7.0.2", "version": "7.6.0",
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.0.2.tgz", "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.0.tgz",
"integrity": "sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ==", "integrity": "sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.0.0" "@babel/types": "^7.0.0"
@ -541,9 +540,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "12.7.4", "version": "12.7.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.7.tgz",
"integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ==", "integrity": "sha512-4jUncNe2tj1nmrO/34PsRpZqYVnRV1svbU78cKhuQKkMntKB/AmdLyGgswcZKjFHEHGpiY8pVD8CuVI55nP54w==",
"dev": true "dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
@ -568,15 +567,15 @@
} }
}, },
"@types/yargs-parser": { "@types/yargs-parser": {
"version": "13.0.0", "version": "13.1.0",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.1.0.tgz",
"integrity": "sha512-wBlsw+8n21e6eTd4yVv8YD/E3xq0O6nNnJIquutAsFGE7EyMKz7W6RNT6BRu1SmdgmlCZ9tb0X+j+D6HGr8pZw==", "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==",
"dev": true "dev": true
}, },
"abab": { "abab": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.1.tgz", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz",
"integrity": "sha512-1zSbbCuoIjafKZ3mblY5ikvAb0ODUbqBnFuUb7f6uLeQhhGJ0vEV4ntmtxKLT2WgXCO94E07BjunsIw1jOMPZw==", "integrity": "sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg==",
"dev": true "dev": true
}, },
"acorn": { "acorn": {
@ -586,9 +585,9 @@
"dev": true "dev": true
}, },
"acorn-globals": { "acorn-globals": {
"version": "4.3.3", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.3.tgz", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz",
"integrity": "sha512-vkR40VwS2SYO98AIeFvzWWh+xyc2qi9s7OoXSFEGIP/rOJKzjnhykaZJNnHdoq4BL2gGxI5EZOU16z896EYnOQ==", "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^6.0.1", "acorn": "^6.0.1",
@ -1353,9 +1352,9 @@
"dev": true "dev": true
}, },
"end-of-stream": { "end-of-stream": {
"version": "1.4.1", "version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"once": "^1.4.0" "once": "^1.4.0"
@ -1371,9 +1370,9 @@
} }
}, },
"es-abstract": { "es-abstract": {
"version": "1.14.1", "version": "1.14.2",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.1.tgz", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz",
"integrity": "sha512-cp/Tb1oA/rh2X7vqeSOvM+TSo3UkJLX70eNihgVEvnzwAgikjkTFr/QVgRCaxjm0knCNQzNoxxxcw2zO2LJdZA==", "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==",
"dev": true, "dev": true,
"requires": { "requires": {
"es-to-primitive": "^1.2.0", "es-to-primitive": "^1.2.0",
@ -2343,9 +2342,9 @@
"dev": true "dev": true
}, },
"handlebars": { "handlebars": {
"version": "4.2.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.0.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.1.tgz",
"integrity": "sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==", "integrity": "sha512-c0HoNHzDiHpBt4Kqe99N8tdLPKAnGCQ73gYMPWtAYM4PwGnf7xl8PBUHJqh9ijlzt2uQKaSRxbXRt+rZ7M2/kA==",
"dev": true, "dev": true,
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
@ -3478,6 +3477,12 @@
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true "dev": true
}, },
"lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true
},
"lodash.sortby": { "lodash.sortby": {
"version": "4.7.0", "version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
@ -4117,9 +4122,9 @@
} }
}, },
"psl": { "psl": {
"version": "1.3.1", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.3.1.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
"integrity": "sha512-2KLd5fKOdAfShtY2d/8XDWVRnmp3zp40Qt6ge2zBPFARLXOGUf2fHD5eg+TV/5oxBtQKVhjUaKFsAaE4HnwfSA==", "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==",
"dev": true "dev": true
}, },
"pump": { "pump": {
@ -4778,23 +4783,23 @@
} }
}, },
"string.prototype.trimleft": { "string.prototype.trimleft": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.0.0.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
"integrity": "sha1-aLaqjhYsaoDnbjqKDC50cYbicf8=", "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
"dev": true, "dev": true,
"requires": { "requires": {
"define-properties": "^1.1.2", "define-properties": "^1.1.3",
"function-bind": "^1.0.2" "function-bind": "^1.1.1"
} }
}, },
"string.prototype.trimright": { "string.prototype.trimright": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.0.0.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
"integrity": "sha1-q0pW2AKgH75yk+EehPJNyBZGYd0=", "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
"dev": true, "dev": true,
"requires": { "requires": {
"define-properties": "^1.1.2", "define-properties": "^1.1.3",
"function-bind": "^1.0.2" "function-bind": "^1.1.1"
} }
}, },
"strip-ansi": { "strip-ansi": {
@ -4924,22 +4929,17 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"trim-right": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
"dev": true
},
"ts-jest": { "ts-jest": {
"version": "24.0.2", "version": "24.1.0",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.0.2.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.1.0.tgz",
"integrity": "sha512-h6ZCZiA1EQgjczxq+uGLXQlNgeg02WWJBbeT8j6nyIBRQdglqbvzDoHahTEIiS6Eor6x8mK6PfZ7brQ9Q6tzHw==", "integrity": "sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"bs-logger": "0.x", "bs-logger": "0.x",
"buffer-from": "1.x", "buffer-from": "1.x",
"fast-json-stable-stringify": "2.x", "fast-json-stable-stringify": "2.x",
"json5": "2.x", "json5": "2.x",
"lodash.memoize": "4.x",
"make-error": "1.x", "make-error": "1.x",
"mkdirp": "0.x", "mkdirp": "0.x",
"resolve": "1.x", "resolve": "1.x",
@ -5015,9 +5015,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.6.2", "version": "3.6.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz",
"integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==", "integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==",
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "1.3.4", "version": "1.3.6",
"private": false, "private": false,
"description": "Setup php action", "description": "Setup php action",
"main": "lib/setup-php.js", "main": "lib/setup-php.js",
@ -28,13 +28,13 @@
"typed-rest-client": "^1.5.0" "typed-rest-client": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^24.0.13", "@types/jest": "^24.0.18",
"@types/node": "^12.0.4", "@types/node": "^12.0.4",
"husky": "^2.3.0", "husky": "^2.3.0",
"jest": "^24.8.0", "jest": "^24.9.0",
"jest-circus": "^24.7.1", "jest-circus": "^24.9.0",
"prettier": "^1.17.1", "prettier": "^1.17.1",
"ts-jest": "^24.0.2", "ts-jest": "^24.1.0",
"typescript": "^3.5.1" "typescript": "^3.5.1"
}, },
"husky": { "husky": {

View File

@ -1,50 +1,60 @@
brew fetch autoconf& brew fetch automake& brew fetch pcre& brew fetch libtool& brew fetch libpng& brew fetch webp& brew fetch jpeg& brew fetch freetype& brew fetch libxml2& brew fetch pkg-config& brew fetch krb5& brew fetch icu4c& brew fetch re2c& brew fetch bison& brew fetch libzip& brew fetch mcrypt& brew fetch zlib& brew fetch bzip2& brew fetch enchant brew install pkg-config autoconf bison re2c openssl krb5 bzip2 enchant libffi libpng webp freetype intltool icu4c libiconv zlib t1lib gd libzip gmp tidyp libxml2 libxslt postgresql >/dev/null 2>&1
brew install autoconf automake pcre libtool libpng webp jpeg freetype libxml2 pkg-config krb5 icu4c re2c bison libzip mcrypt zlib bzip2 enchant > /dev/null 2>&1 brew link icu4c gettext --force >/dev/null 2>&1
brew link --force gettext
brew link --force bison for package in gettext gmp bzip2 krb5 icu4c bison openssl libxml2 libffi libxslt libiconv pkgconfig enchant krb5 readline libedit freetype;
brew link --force openssl do
brew link --force libxml2 caps_package=$(echo "$package" | tr '[:lower:]' '[:upper:]')
brew link --force bzip2 {
echo 'export PATH="/usr/local/opt/bzip2/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/'"$package"'/bin:$PATH"'
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile echo 'export PKG_CONFIG_PATH="/usr/local/opt/'$package'/lib/pkgconfig:$PKG_CONFIG_PATH"'
echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.bash_profile echo 'export '"$caps_package"'_LIBS="-L/usr/local/opt/'$package'/lib"'
echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.bash_profile echo 'export '"$caps_package"'_CFLAGS="-I/usr/local/opt/'$package'/include"'
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile } >> ~/.bash_profile;
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile done
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile {
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profile echo 'export ICONV_LIBS="-L/usr/local/opt/libiconv/lib"'
echo 'export PATH="/Users/runner/.phpbrew/php/php-7.4.0RC1/bin:$PATH"' >> ~/.bash_profile echo 'export ICONV_CFLAGS="-I/usr/local/opt/libiconv/include"'
source ~/.bash_profile > /dev/null 2>&1 echo 'export LIBXML_LIBS="-L/usr/local/opt/libxml2/lib"'
export LIBXML_LIBS="-L/usr/local/opt/libxml2/lib" echo 'export LIBXML_CFLAGS="-I/usr/local/opt/libxml2/include"'
export LIBXML_CFLAGS="-I/usr/local/opt/libxml2/include" echo 'export ICU_LIBS="-L/usr/local/opt/icu4c/lib"'
export ENCHANT_LIBS="-L/usr/local/opt/enchant/lib" echo 'export ICU_CFLAGS="-I/usr/local/opt/icu4c/include"'
export ENCHANT_CFLAGS="-I/usr/local/opt/enchant/include" echo 'export OPENSSL_LIBS="-L/usr/local/Cellar/openssl/1.0.2s/lib -lcrypto"'
export FFI_LIBS="-L/usr/local/opt/libffi/lib" echo 'export OPENSSL_CFLAGS="-I/usr/local/Cellar/openssl/1.0.2s/include"'
export FFI_CFLAGS="-I/usr/local/opt/libffi/include" echo 'export OPENSSL_ROOT_DIR="/usr/local/opt/openssl"'
export ICU_LIBS="-L/usr/local/opt/icu4c/lib" echo 'export OPENSSL_LIB_DIR="/usr/local/opt/openssl/lib"'
export ICU_CFLAGS="-I/usr/local/opt/icu4c/include" echo 'export OPENSSL_INCLUDE_DIR="/usr/local/opt/openssl/include"'
export KERBEROS_LIBS="-L/usr/local/opt/krb5/lib" echo 'export PKG_CONFIG_PATH="/usr/local/Cellar/openssl/1.0.2s/lib/pkgconfig:$PKG_CONFIG_PATH"'
export KERBEROS_CFLAGS="-I/usr/local/opt/krb5/include" echo 'export PKG_CONFIG="/usr/local/opt/pkgconfig/bin/pkg-config"'
export OPENSSL_LIBS="-L/usr/local/opt/openssl/lib" echo 'export EXTRA_LIBS="/usr/local/opt/readline/lib/libhistory.dylib
export OPENSSL_CFLAGS="-I/usr/local/opt/openssl/include" /usr/local/opt/readline/lib/libreadline.dylib
export READLINE_LIBS="-L/usr/local/opt/readline/lib" /usr/local/opt/openssl/lib/libssl.dylib
export READLINE_CFLAGS="-I/usr/local/opt/readline/include" /usr/local/opt/openssl/lib/libcrypto.dylib
export BZIP2_LIBS="-L/usr/local/opt/bzip2/lib" /usr/local/opt/icu4c/lib/libicudata.dylib
export BZIP2_CFLAGS="-I/usr/local/opt/bzip2/include" /usr/local/opt/icu4c/lib/libicui18n.dylib
export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/obzip2pt/libffi/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/krb5/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig" /usr/local/opt/icu4c/lib/libicuio.dylib
/usr/local/opt/icu4c/lib/libicutu.dylib
/usr/local/opt/icu4c/lib/libicuuc.dylib"'
} >> ~/.bash_profile
config_file=$(pwd)/config.yaml
cd ~ || echo "could not move to ~" cd ~ || echo "could not move to ~"
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew >/dev/null 2>&1
chmod +x ./phpbrew chmod +x ./phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew sudo mv phpbrew /usr/local/bin/phpbrew
sudo mkdir -p /opt/phpbrew sudo mkdir -p /opt/phpbrew
phpbrew init --root=/opt/phpbrew sudo phpbrew init --root=/opt/phpbrew --config="$config_file" >/dev/null 2>&1
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc sudo chmod -R 777 /opt/phpbrew
source ~/.bashrc export PHPBREW_ROOT=/opt/phpbrew
phpbrew install -j 10 7.4.0RC2 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -openssl -- --with-libxml export PHPBREW_HOME=/opt/phpbrew
phpbrew switch php-7.4.0RC2 > /dev/null 2>&1 echo "[[ -e ~/.phpbrew/bash_profile ]] && source ~/.phpbrew/bash_profile" >> ~/.bash_profile
source ~/.bash_profile >/dev/null 2>&1
sudo mkdir -p /usr/local/lib
phpbrew install -j 4 7.4.0RC2 +dev
phpbrew switch php-7.4.0RC2
phpbrew ext install +dev >/dev/null 2>&1
sudo mkdir -p /usr/local/bin sudo mkdir -p /usr/local/bin
sudo ln -sf /Users/runner/.phpbrew/php/php-7.4.0RC2/bin/php /usr/local/bin/php sudo ln -sf /opt/phpbrew/php/php-7.4.0RC2/bin/* /usr/local/bin/
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||") pecl config-set php_ini $ini_file
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file"
brew install composer brew install composer

60
src/config.yaml Normal file
View File

@ -0,0 +1,60 @@
variants:
dev:
bcmath:
calendar:
cli:
ctype:
dom:
fileinfo:
filter:
ipc:
iconv:
json:
mbregex:
mbstring:
mhash:
mcrypt:
pcntl:
pcre:
pdo:
phar:
posix:
sockets:
tokenizer:
xml:
curl:
openssl:
zip:
gd:
- --with-freetype
- --with-pdo-mysql=mysqlnd
- --with-mysqli=mysqlnd
- --with-pgsql
- --with-pdo-pgsql
- --with-gmp=/usr/local/opt/gmp
- --with-openssl
- --with-pear
- --with-zip
- --with-zlib-dir=/usr/local/opt/zlib
- --with-libxml
- --with-kerberos
- --with-gd
- --with-ffi
- --with-bz2=/usr/local/opt/bzip2
- --with-readline=/usr/local/opt/readline
- --with-iconv=/usr/local/opt/libiconv
- --with-icu-dir=/usr/local/opt/icu4c
- --enable-intl
- --enable-xml
- --enable-sysvsem
- --enable-sysvshm
- --enable-sysvmsg
- --enable-phpdbg
- --enable-exif
- --enable-gd
- --enable-soap
- --enable-xmlreader
- --enable-zend-test=shared
extensions:
dev:
xdebug: stable

View File

@ -1,14 +1,11 @@
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
brew tap exolnet/homebrew-deprecated > /dev/null 2>&1; brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
brew install php@"$1"; brew install php@"$1" composer >/dev/null 2>&1
brew link --force --overwrite php@"$1"; brew link --force --overwrite php@"$1" >/dev/null 2>&1
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||") ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file"
mkdir -p "$(pecl config-get ext_dir)" mkdir -p "$(pecl config-get ext_dir)"
curl -sS https://getcomposer.org/installer | php composer global require hirak/prestissimo >/dev/null 2>&1
chmod +x composer.phar
mv composer.phar /usr/local/bin/composer
composer global require hirak/prestissimo
php -v php -v
composer -V composer -V

View File

@ -2,24 +2,40 @@ import * as utils from './utils';
import * as pecl from './pecl'; import * as pecl from './pecl';
export async function addExtension( export async function addExtension(
extensions: string, extension_csv: string,
version: string, version: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
if (os_version === 'win32') { switch (os_version) {
return await addExtensionWindows(extensions, version); case 'win32':
} else if (os_version === 'linux') { return await addExtensionWindows(extension_csv, version);
return await addExtensionLinux(extensions, version); case 'darwin':
return await addExtensionDarwin(extension_csv, version);
case 'linux':
return await addExtensionLinux(extension_csv, version);
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
} }
return await addExtensionDarwin(extensions);
} }
export async function addINIValues(ini_values_csv: string, os_version: string) { export async function addINIValues(ini_values_csv: string, os_version: string) {
if (os_version === 'win32') { switch (os_version) {
return await addINIValuesWindows(ini_values_csv); case 'win32':
return await addINIValuesWindows(ini_values_csv);
case 'darwin':
case 'linux':
return await addINIValuesUnix(ini_values_csv);
default:
return await utils.log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
} }
return await addINIValuesUnix(ini_values_csv);
} }
/** /**
@ -28,50 +44,116 @@ export async function addINIValues(ini_values_csv: string, os_version: string) {
* @param extension * @param extension
*/ */
export async function enableExtensionWindows(extension: string) { export async function enableExtensionWindows(extension: string) {
return `try { return (
`try {
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll $exist = Test-Path -Path $ext_dir\\php_${extension}.dll
if(!(php -m | findstr -i ${extension}) -and $exist) { if(!(php -m | findstr -i ${extension}) -and $exist) {
Enable-PhpExtension ${extension} C:\\tools\\php Add-Content C:\\tools\\php\\php.ini "${await utils.getExtensionPrefix(
} extension
} catch [Exception] { )}=php_${extension}.dll"\n` +
echo $_ (await utils.log('Enabled ' + extension, 'win32', 'success')) +
}\n`; ` } elseif(php -m | findstr -i ${extension}) {\n` +
(await utils.log(
'Extension ' + extension + ' was already enabled',
'win32',
'success'
)) +
` }
} catch [Exception] {\n` +
(await utils.log(extension + ' could not be enabled', 'win32', 'error')) +
` }\n`
);
} }
/** /**
* Enable extensions which are installed but not enabled on unix * Enable extensions which are installed but not enabled on unix
* *
* @param extension * @param extension
* @param os_version
*/ */
export async function enableExtensionUnix(extension: string) { export async function enableExtensionUnix(
return `if [ ! "$(php -m | grep ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then extension: string,
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"' os_version: string
echo "${extension} enabled" ) {
fi\n`; return (
`if [ ! "$(php -m | grep -i ${extension})" ] && [ -e "$ext_dir/php_${extension}.so" ]; then
echo "${await utils.getExtensionPrefix(
extension
)}=php_${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'\n` +
(await utils.log('Enabled ' + extension, os_version, 'success')) +
`;\n elif [ "$(php -m | grep -i ${extension})" ]; then \n` +
(await utils.log(
'Extension ' + extension + ' was already enabled',
os_version,
'success'
)) +
`; fi\n`
);
} }
/** /**
* Install and enable extensions for darwin * Install and enable extensions for darwin
* *
* @param extension_csv * @param extension_csv
* @param version
*/ */
export async function addExtensionDarwin( export async function addExtensionDarwin(
extension_csv: string extension_csv: string,
version: string
): Promise<string> { ): Promise<string> {
let extensions: Array<string> = await utils.extensionArray(extension_csv); let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n'; let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) { await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += await enableExtensionUnix(extension); script += await enableExtensionUnix(extension, 'darwin');
if (await pecl.checkPECLExtension(extension)) { switch (await pecl.checkPECLExtension(extension)) {
script += case true:
'if [ ! "$(php -m | grep ' + let extension_version: string = extension;
extension + switch (version + extension) {
')" ]; then sudo pecl install ' + case '5.6xdebug':
extension + extension_version = 'xdebug-2.5.5';
' || echo "Couldn\'t find extension: ' + break;
extension + case '7.4xdebug':
'"; fi\n'; extension_version = 'xdebug-2.8.0beta2';
break;
case '7.2xdebug':
default:
extension_version = extension;
break;
}
script +=
'if [ ! "$(php -m | grep -i ' +
extension +
')" ]; then sudo pecl install ' +
extension_version +
' >/dev/null 2>&1 && ' +
(await utils.log(
'Installed and enabled ' + extension,
'darwin',
'success'
)) +
' || ' +
(await utils.log(
'Could not install ' + extension + ' on PHP' + version,
'darwin',
'error'
)) +
'; fi\n';
break;
case false:
default:
script +=
'if [ ! "$(php -m | grep -i ' +
extension +
')" ]; then \n' +
(await utils.log(
'Could not find ' + extension + ' for PHP' + version + ' on PECL',
'darwin',
'error'
)) +
'; fi\n';
break;
} }
}); });
return script; return script;
@ -90,24 +172,67 @@ export async function addExtensionWindows(
let extensions: Array<string> = await utils.extensionArray(extension_csv); let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n'; let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) { await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += await enableExtensionWindows(extension); script += await enableExtensionWindows(extension);
let extension_version = 'stable'; let extension_stability: string = '';
if (version == '7.4') { switch (version) {
extension_version = 'alpha'; case '7.4':
extension_stability = 'beta';
break;
case '7.2':
default:
extension_stability = 'stable';
break;
} }
if (await pecl.checkPECLExtension(extension)) {
script += switch (await pecl.checkPECLExtension(extension)) {
'if(!(php -m | findstr -i ' + case true:
extension + let extension_version: string = extension;
')) { ' + switch (version + extension) {
'try { Install-PhpExtension ' + case '7.4xdebug':
extension + extension_version = 'xdebug -Version 2.8';
' -MinimumStability ' + break;
extension_version + case '7.2xdebug':
' } catch [Exception] { echo $_; echo "Could not install extension: "' + default:
extension + extension_version = extension;
' } }\n'; break;
}
script +=
'if(!(php -m | findstr -i ' +
extension +
')) { ' +
'try { Install-PhpExtension ' +
extension_version +
' -MinimumStability ' +
extension_stability +
'\n' +
(await utils.log(
'Installed and enabled ' + extension,
'win32',
'success'
)) +
' } catch [Exception] { ' +
(await utils.log(
'Could not install ' + extension + ' on PHP' + version,
'win32',
'error'
)) +
' } }\n';
break;
case false:
default:
script +=
'if(!(php -m | findstr -i ' +
extension +
')) { ' +
(await utils.log(
'Could not find ' + extension + ' for PHP' + version + ' on PECL',
'win32',
'error'
)) +
' } \n';
break;
} }
}); });
return script; return script;
@ -126,20 +251,37 @@ export async function addExtensionLinux(
let extensions: Array<string> = await utils.extensionArray(extension_csv); let extensions: Array<string> = await utils.extensionArray(extension_csv);
let script: string = '\n'; let script: string = '\n';
await utils.asyncForEach(extensions, async function(extension: string) { await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
script += await enableExtensionUnix(extension); script += await enableExtensionUnix(extension, 'linux');
script += script +=
'if [ ! "$(php -m | grep ' + 'if [ ! "$(php -m | grep -i ' +
extension + extension +
')" ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' + ')" ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
version + version +
'-' + '-' +
extension + extension +
' || echo "Couldn\'t find extension php' + ' >/dev/null 2>&1 || sudo DEBIAN_FRONTEND=noninteractive apt install -y php-' +
version +
'-' +
extension + extension +
'"; fi\n'; ' >/dev/null 2>&1 && ' +
(await utils.log(
'Installed and enabled ' + extension,
'linux',
'success'
)) +
' || ' +
(await utils.log(
'Could not find php-' +
extension +
' or php' +
version +
'-' +
extension +
' on APT repository',
'linux',
'error'
)) +
'; fi\n';
}); });
return script; return script;
} }
@ -177,3 +319,70 @@ export async function addINIValuesWindows(
}); });
return script; return script;
} }
export async function addCoverage(
coverage: string,
version: string,
os_version: string
): Promise<string> {
let script: string = '';
script += '\n';
coverage = coverage.toLowerCase();
// pcov
switch (coverage) {
case 'pcov':
// if version is 7.1 or newer
switch (version) {
default:
script += await addExtension(coverage, version, os_version);
script += await addINIValues('pcov.enabled=1', os_version);
// add command to disable xdebug and enable pcov
switch (os_version) {
case 'linux':
script +=
"sudo phpdismod xdebug || echo 'xdebug not installed'\n";
script += "sudo phpenmod pcov || echo 'pcov not installed'\n";
break;
case 'darwin':
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
break;
case 'win32':
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
break;
}
// success
script += await utils.log(
'pcov enabled as coverage driver',
os_version,
'success'
);
// version is not supported
break;
case '5.6':
case '7.0':
script += await utils.log(
'pcov requires php 7.1 or newer',
os_version,
'warning'
);
break;
}
break;
//xdebug
case 'xdebug':
script += await addExtension(coverage, version, os_version);
script += await utils.log(
'Xdebug enabled as coverage driver',
os_version,
'success'
);
break;
// unknown coverage driver
default:
script = '';
}
return script;
}

View File

@ -12,6 +12,7 @@ async function run() {
let version: string = await utils.getInput('php-version', true); let version: string = await utils.getInput('php-version', true);
let extension_csv: string = await utils.getInput('extension-csv', false); let extension_csv: string = await utils.getInput('extension-csv', false);
let ini_values_csv: string = await utils.getInput('ini-values-csv', false); let ini_values_csv: string = await utils.getInput('ini-values-csv', false);
let coverage: string = await utils.getInput('coverage', false);
let os_version: string = process.platform; let os_version: string = process.platform;
// check the os version and run the respective script // check the os version and run the respective script
@ -21,8 +22,10 @@ async function run() {
version, version,
os_version os_version
); );
darwin += await features.addExtension(extension_csv, version, os_version); darwin += await features.addExtension(extension_csv, version, os_version);
darwin += await features.addINIValues(ini_values_csv, os_version); darwin += await features.addINIValues(ini_values_csv, os_version);
darwin += await features.addCoverage(coverage, version, os_version);
await utils.writeScript('darwin.sh', version, darwin); await utils.writeScript('darwin.sh', version, darwin);
await exec('sh -x ./' + version + 'darwin.sh ' + version); await exec('sh -x ./' + version + 'darwin.sh ' + version);
} else if (os_version == 'win32') { } else if (os_version == 'win32') {
@ -37,6 +40,7 @@ async function run() {
os_version os_version
); );
windows += await features.addINIValues(ini_values_csv, os_version); windows += await features.addINIValues(ini_values_csv, os_version);
windows += await features.addCoverage(coverage, version, os_version);
await utils.writeScript('win32.ps1', version, windows); await utils.writeScript('win32.ps1', version, windows);
await exec('powershell .\\' + version + 'win32.ps1 -version ' + version); await exec('powershell .\\' + version + 'win32.ps1 -version ' + version);
} else if (os_version == 'linux') { } else if (os_version == 'linux') {
@ -47,6 +51,7 @@ async function run() {
); );
linux += await features.addExtension(extension_csv, version, os_version); linux += await features.addExtension(extension_csv, version, os_version);
linux += await features.addINIValues(ini_values_csv, os_version); linux += await features.addINIValues(ini_values_csv, os_version);
linux += await features.addCoverage(coverage, version, os_version);
await utils.writeScript('linux.sh', version, linux); await utils.writeScript('linux.sh', version, linux);
await exec('./' + version + 'linux.sh ' + version); await exec('./' + version + 'linux.sh ' + version);
} }

View File

@ -1,25 +1,35 @@
version=$(php-config --version | cut -c 1-3) version=$(php-config --version | cut -c 1-3)
if [ "$version" != "$1" ]; then if [ "$version" != "$1" ]; then
if [ ! -e "/usr/bin/php$1" ]; then if [ ! -e "/usr/bin/php$1" ]; then
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y > /dev/null 2>&1 sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y >/dev/null 2>&1
sudo DEBIAN_FRONTEND=noninteractive apt update -y > /dev/null 2>&1 sudo DEBIAN_FRONTEND=noninteractive apt update -y >/dev/null 2>&1
sudo DEBIAN_FRONTEND=noninteractive apt install -y php"$1" curl php"$1"-curl; sudo DEBIAN_FRONTEND=noninteractive apt install -y php"$1" curl php"$1"-curl >/dev/null 2>&1
fi fi
for tool in php phar phar.phar php-cgi php-config phpize; do for tool in php phar phar.phar php-cgi php-config phpize; do
if [ -e "/usr/bin/$tool$1" ]; then if [ -e "/usr/bin/$tool$1" ]; then
sudo update-alternatives --set $tool /usr/bin/"$tool$1"; sudo update-alternatives --set $tool /usr/bin/"$tool$1"
fi fi
done done
fi fi
if [ ! -e "/usr/bin/composer" ]; then if [ ! -e "/usr/bin/composer" ]; then
sudo curl -s https://getcomposer.org/installer | php; EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
sudo mv composer.phar /usr/local/bin/composer; curl -s -L https://getcomposer.org/installer > composer-setup.php
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
>&2 echo 'ERROR: Invalid installer signature'
else
COMPOSER_ALLOW_SUPERUSER=1
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
fi
rm composer-setup.php
fi fi
composer global require hirak/prestissimo > /dev/null 2>&1
composer global require hirak/prestissimo >/dev/null 2>&1
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||") ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file"
sudo mkdir -p /run/php sudo mkdir -p /run/php
php -v php -v
composer -V composer -V

View File

@ -7,11 +7,13 @@ export async function getInput(
mandatory: boolean mandatory: boolean
): Promise<string> { ): Promise<string> {
let input = process.env[name]; let input = process.env[name];
if (!input) { switch (input) {
input = core.getInput(name, {required: mandatory}); case '':
case undefined:
return core.getInput(name, {required: mandatory});
default:
return input;
} }
return input;
} }
/** /**
@ -42,10 +44,34 @@ export async function readScript(
version: string, version: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
if (version === '7.4' && os_version === 'darwin') { switch (os_version) {
return fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8'); case 'darwin':
switch (version) {
case '7.4':
fs.createReadStream(path.join(__dirname, '../src/config.yaml')).pipe(
fs.createWriteStream('config.yaml')
);
return fs.readFileSync(path.join(__dirname, '../src/7.4.sh'), 'utf8');
case '7.3':
default:
return fs.readFileSync(
path.join(__dirname, '../src/' + filename),
'utf8'
);
}
case 'win32':
case 'linux':
return fs.readFileSync(
path.join(__dirname, '../src/' + filename),
'utf8'
);
default:
return await log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
} }
return fs.readFileSync(path.join(__dirname, '../src/' + filename), 'utf8');
} }
/** /**
@ -89,3 +115,46 @@ export async function INIArray(ini_values_csv: string): Promise<Array<string>> {
return ini_value.trim(); return ini_value.trim();
}); });
} }
export async function log(
message: string,
os_version: string,
log_type: string
): Promise<string> {
const unix_color: any = {
error: '31',
success: '32',
warning: '33'
};
switch (os_version) {
case 'win32':
const color: any = {
error: 'red',
success: 'green',
warning: 'yellow'
};
return "Write-Host '" + message + "' -ForegroundColor " + color[log_type];
case 'linux':
return (
'echo "\\033[' + unix_color[log_type] + ';1m' + message + '\\033[0m"'
);
case 'darwin':
default:
return (
'echo -e "\\033[' + unix_color[log_type] + ';1m' + message + '\\033[0m"'
);
}
}
export async function getExtensionPrefix(extension: string): Promise<string> {
let zend: Array<string> = ['xdebug', 'opcache'];
switch (zend.indexOf(extension)) {
case 0:
case 1:
return 'zend_extension';
case -1:
default:
return 'extension';
}
}