mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Refactor installation scripts
This commit is contained in:
parent
3087ceb811
commit
e755fb7a69
@ -7,13 +7,7 @@ describe('Config tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(win32).toContain(
|
expect(win32).toContain(
|
||||||
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M"'
|
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Content C:\\tools\\php\\php.ini "short_open_tag=On"'
|
|
||||||
);
|
|
||||||
expect(win32).toContain(
|
|
||||||
'Add-Content C:\\tools\\php\\php.ini "date.timezone=Asia/Kolkata"'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
win32 = await config.addINIValues(
|
win32 = await config.addINIValues(
|
||||||
@ -28,9 +22,9 @@ describe('Config tests', () => {
|
|||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('echo "post_max_size=256M" >> $ini_file');
|
expect(linux).toContain(
|
||||||
expect(linux).toContain('echo "short_open_tag=On" >> $ini_file');
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" >> $ini_file'
|
||||||
expect(linux).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
);
|
||||||
|
|
||||||
linux = await config.addINIValues(
|
linux = await config.addINIValues(
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
@ -44,9 +38,9 @@ describe('Config tests', () => {
|
|||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('echo "post_max_size=256M" >> $ini_file');
|
expect(darwin).toContain(
|
||||||
expect(darwin).toContain('echo "short_open_tag=On" >> $ini_file');
|
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" >> $ini_file'
|
||||||
expect(darwin).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
);
|
||||||
|
|
||||||
darwin = await config.addINIValues(
|
darwin = await config.addINIValues(
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
import * as extensions from '../src/extensions';
|
import * as extensions from '../src/extensions';
|
||||||
|
|
||||||
let valid_extensions = ['xdebug', 'pcov'];
|
|
||||||
jest.mock('../src/pecl', () => ({
|
|
||||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
|
||||||
return valid_extensions.indexOf(extension) !== -1;
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
@ -27,7 +20,9 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Install-PhpExtension pcov');
|
expect(win32).toContain('Install-PhpExtension pcov');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('does_not_exist', '7.2', 'win32');
|
win32 = await extensions.addExtension('does_not_exist', '7.2', 'win32');
|
||||||
expect(win32).toContain('Could not find does_not_exist for PHP7.2 on PECL');
|
expect(win32).toContain(
|
||||||
|
'Add-Extension does_not_exist "Install-PhpExtension does_not_exist" extension "Add Extension"'
|
||||||
|
);
|
||||||
|
|
||||||
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
win32 = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
@ -82,9 +77,7 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('does_not_exist', '7.2', 'darwin');
|
darwin = await extensions.addExtension('does_not_exist', '7.2', 'darwin');
|
||||||
expect(darwin).toContain(
|
expect(darwin).toContain('add_extension does_not_exist');
|
||||||
'Could not find does_not_exist for PHP7.2 on PECL'
|
|
||||||
);
|
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(darwin).toContain('Platform fedora is not supported');
|
expect(darwin).toContain('Platform fedora is not supported');
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import * as pecl from '../src/pecl';
|
|
||||||
|
|
||||||
let valid_extensions = ['xdebug', 'pcov'];
|
|
||||||
jest.mock('../src/pecl', () => ({
|
|
||||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
|
||||||
return valid_extensions.indexOf(extension) !== -1;
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('pecl tests', () => {
|
|
||||||
it('checking checkPECLExtension', async () => {
|
|
||||||
expect(await pecl.checkPECLExtension('extensionDoesNotExist')).toBe(false);
|
|
||||||
expect(await pecl.checkPECLExtension('xdebug')).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
@ -44,15 +44,8 @@ exports.addINIValues = addINIValues;
|
|||||||
*/
|
*/
|
||||||
function addINIValuesUnix(ini_values_csv) {
|
function addINIValuesUnix(ini_values_csv) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let script = '\n';
|
|
||||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
let ini_values = yield utils.INIArray(ini_values_csv);
|
||||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
return '\necho "' + ini_values.join('\n') + '" >> $ini_file\n';
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to set ini value
|
|
||||||
script += 'echo "' + ini_value + '" >> $ini_file\n';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addINIValuesUnix = addINIValuesUnix;
|
exports.addINIValuesUnix = addINIValuesUnix;
|
||||||
@ -63,15 +56,8 @@ exports.addINIValuesUnix = addINIValuesUnix;
|
|||||||
*/
|
*/
|
||||||
function addINIValuesWindows(ini_values_csv) {
|
function addINIValuesWindows(ini_values_csv) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let script = '\n';
|
|
||||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
let ini_values = yield utils.INIArray(ini_values_csv);
|
||||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
return ('Add-Content C:\\tools\\php\\php.ini "' + ini_values.join('\n') + '"\n');
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// add script to set ini value
|
|
||||||
script += 'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addINIValuesWindows = addINIValuesWindows;
|
exports.addINIValuesWindows = addINIValuesWindows;
|
||||||
|
@ -17,7 +17,6 @@ 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"));
|
|
||||||
function addExtension(extension_csv, version, os_version, log_prefix = 'Add Extension') {
|
function addExtension(extension_csv, version, os_version, log_prefix = 'Add Extension') {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
@ -33,44 +32,6 @@ function addExtension(extension_csv, version, os_version, log_prefix = 'Add Exte
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addExtension = addExtension;
|
exports.addExtension = addExtension;
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on windows
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
function enableExtensionWindows(extension, log_prefix) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return (`try {
|
|
||||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
|
||||||
if(!(php -m | findstr -i ${extension}) -and $exist) {
|
|
||||||
Add-Content C:\\tools\\php\\php.ini "${yield utils.getExtensionPrefix(extension)}=php_${extension}.dll"\n` +
|
|
||||||
(yield utils.log('Enabled ' + extension, 'win32', 'success', log_prefix)) +
|
|
||||||
` } elseif(php -m | findstr -i ${extension}) {\n` +
|
|
||||||
(yield utils.log(extension + ' was already enabled', 'win32', 'success', log_prefix)) +
|
|
||||||
` }
|
|
||||||
} catch [Exception] {\n` +
|
|
||||||
(yield utils.log(extension + ' could not be enabled', 'win32', 'error', log_prefix)) +
|
|
||||||
` }\n`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.enableExtensionWindows = enableExtensionWindows;
|
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on unix
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param os_version
|
|
||||||
*/
|
|
||||||
function enableExtensionUnix(extension, os_version, log_prefix) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return (`if [ ! "$(php -m | grep -i ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
|
||||||
echo "${yield utils.getExtensionPrefix(extension)}=${extension}" >> $ini_file\n` +
|
|
||||||
(yield utils.log('Enabled ' + extension, os_version, 'success', log_prefix)) +
|
|
||||||
`;\n elif [ "$(php -m | grep -i ${extension})" ]; then \n` +
|
|
||||||
(yield utils.log(extension + ' was already enabled', os_version, 'success', log_prefix)) +
|
|
||||||
`; fi\n`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.enableExtensionUnix = enableExtensionUnix;
|
|
||||||
/**
|
/**
|
||||||
* Install and enable extensions for darwin
|
* Install and enable extensions for darwin
|
||||||
*
|
*
|
||||||
@ -85,48 +46,33 @@ function addExtensionDarwin(extension_csv, version, log_prefix) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
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, 'darwin', log_prefix);
|
let install_command = '';
|
||||||
switch (yield pecl.checkPECLExtension(extension)) {
|
switch (version + extension) {
|
||||||
case true:
|
case '7.4xdebug':
|
||||||
let install_command = '';
|
install_command =
|
||||||
switch (version + extension) {
|
'sh ./xdebug_darwin.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
||||||
case '7.4xdebug':
|
break;
|
||||||
install_command =
|
case '7.4pcov':
|
||||||
'sh ./xdebug_darwin.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
install_command =
|
||||||
break;
|
'sh ./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||||
case '7.4pcov':
|
break;
|
||||||
install_command =
|
case '5.6xdebug':
|
||||||
'sh ./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
||||||
break;
|
|
||||||
case '5.6xdebug':
|
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
install_command =
|
|
||||||
'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
script +=
|
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
|
||||||
extension +
|
|
||||||
')" ]; then ' +
|
|
||||||
install_command +
|
|
||||||
' && ' +
|
|
||||||
(yield utils.log('Installed and enabled ' + extension, 'darwin', 'success', log_prefix)) +
|
|
||||||
' || ' +
|
|
||||||
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'darwin', 'error', log_prefix)) +
|
|
||||||
'; fi\n';
|
|
||||||
break;
|
break;
|
||||||
case false:
|
|
||||||
default:
|
default:
|
||||||
script +=
|
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
|
||||||
extension +
|
|
||||||
')" ]; then \n' +
|
|
||||||
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'darwin', 'error', log_prefix)) +
|
|
||||||
'; fi\n';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
script +=
|
||||||
|
'add_extension ' +
|
||||||
|
extension +
|
||||||
|
' "' +
|
||||||
|
install_command +
|
||||||
|
'" ' +
|
||||||
|
(yield utils.getExtensionPrefix(extension)) +
|
||||||
|
' "' +
|
||||||
|
log_prefix +
|
||||||
|
'"\n';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
@ -147,46 +93,31 @@ function addExtensionWindows(extension_csv, version, log_prefix) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
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, log_prefix);
|
let install_command = '';
|
||||||
switch (yield pecl.checkPECLExtension(extension)) {
|
switch (version + extension) {
|
||||||
case true:
|
case '7.4xdebug':
|
||||||
let install_command = '';
|
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
|
||||||
switch (version + extension) {
|
install_command =
|
||||||
case '7.4xdebug':
|
'Invoke-WebRequest -Uri ' +
|
||||||
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
|
extension_url +
|
||||||
install_command =
|
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
|
||||||
'Invoke-WebRequest -Uri ' +
|
install_command += 'Enable-PhpExtension xdebug';
|
||||||
extension_url +
|
|
||||||
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
|
|
||||||
install_command += 'Enable-PhpExtension xdebug';
|
|
||||||
break;
|
|
||||||
case '7.2xdebug':
|
|
||||||
default:
|
|
||||||
install_command = 'Install-PhpExtension ' + extension;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
script +=
|
|
||||||
'if(!(php -m | findstr -i ' +
|
|
||||||
extension +
|
|
||||||
')) { ' +
|
|
||||||
'try { ' +
|
|
||||||
install_command +
|
|
||||||
'\n' +
|
|
||||||
(yield utils.log('Installed and enabled ' + extension, 'win32', 'success', log_prefix)) +
|
|
||||||
' } catch [Exception] { ' +
|
|
||||||
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'win32', 'error', log_prefix)) +
|
|
||||||
' } }\n';
|
|
||||||
break;
|
break;
|
||||||
case false:
|
case '7.2xdebug':
|
||||||
default:
|
default:
|
||||||
script +=
|
install_command = 'Install-PhpExtension ' + extension;
|
||||||
'if(!(php -m | findstr -i ' +
|
|
||||||
extension +
|
|
||||||
')) { ' +
|
|
||||||
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'win32', 'error', log_prefix)) +
|
|
||||||
' } \n';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
script +=
|
||||||
|
'Add-Extension ' +
|
||||||
|
extension +
|
||||||
|
' "' +
|
||||||
|
install_command +
|
||||||
|
'" ' +
|
||||||
|
(yield utils.getExtensionPrefix(extension)) +
|
||||||
|
' "' +
|
||||||
|
log_prefix +
|
||||||
|
'"\n';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
@ -207,7 +138,6 @@ function addExtensionLinux(extension_csv, version, log_prefix) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
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, 'linux', log_prefix);
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (version + extension) {
|
switch (version + extension) {
|
||||||
case '7.4xdebug':
|
case '7.4xdebug':
|
||||||
@ -228,15 +158,15 @@ function addExtensionLinux(extension_csv, version, log_prefix) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
'add_extension ' +
|
||||||
extension +
|
extension +
|
||||||
')" ]; then ' +
|
' "' +
|
||||||
install_command +
|
install_command +
|
||||||
' && ' +
|
'" ' +
|
||||||
(yield utils.log('Installed and enabled ' + extension, 'linux', 'success', log_prefix)) +
|
(yield utils.getExtensionPrefix(extension)) +
|
||||||
' || ' +
|
' "' +
|
||||||
(yield utils.log('Could not find php' + version + '-' + extension + ' on APT repository', 'linux', 'error', log_prefix)) +
|
log_prefix +
|
||||||
'; fi\n';
|
'"\n';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
|
@ -66,6 +66,4 @@ function run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// call the run function
|
// call the run function
|
||||||
run().then(function () {
|
run();
|
||||||
console.log('done');
|
|
||||||
});
|
|
||||||
|
@ -165,7 +165,7 @@ function log(message, os_version, log_type, prefix = '') {
|
|||||||
};
|
};
|
||||||
switch (prefix) {
|
switch (prefix) {
|
||||||
case '':
|
case '':
|
||||||
prefix = prefix;
|
prefix = '';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
prefix = prefix + ': ';
|
prefix = prefix + ': ';
|
||||||
|
40
node_modules/@actions/core/README.md
generated
vendored
40
node_modules/@actions/core/README.md
generated
vendored
@ -4,45 +4,53 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
#### Inputs/Outputs
|
### Import the package
|
||||||
|
|
||||||
You can use this library to get inputs or set outputs:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// javascript
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
// typescript
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
```
|
||||||
|
|
||||||
// Do stuff
|
#### Inputs/Outputs
|
||||||
|
|
||||||
|
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
core.setOutput('outputKey', 'outputVal');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Exporting variables
|
#### Exporting variables
|
||||||
|
|
||||||
You can also export variables for future steps. Variables get set in the environment.
|
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
|
|
||||||
core.exportVariable('envVar', 'Val');
|
core.exportVariable('envVar', 'Val');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Setting a secret
|
||||||
|
|
||||||
|
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.setSecret('myPassword');
|
||||||
|
```
|
||||||
|
|
||||||
#### PATH Manipulation
|
#### PATH Manipulation
|
||||||
|
|
||||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
core.addPath('/path/to/mytool');
|
||||||
|
|
||||||
core.addPath('pathToTool');
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Exit codes
|
#### Exit codes
|
||||||
|
|
||||||
You should use this library to set the failing exit code for your action:
|
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
@ -55,6 +63,8 @@ catch (err) {
|
|||||||
core.setFailed(`Action failed with error ${err}`);
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Logging
|
#### Logging
|
||||||
|
9
node_modules/@actions/core/lib/core.d.ts
generated
vendored
9
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -19,17 +19,16 @@ export declare enum ExitCode {
|
|||||||
Failure = 1
|
Failure = 1
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* sets env variable for this action and future actions in the job
|
* Sets env variable for this action and future actions in the job
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
* @param val the value of the variable
|
* @param val the value of the variable
|
||||||
*/
|
*/
|
||||||
export declare function exportVariable(name: string, val: string): void;
|
export declare function exportVariable(name: string, val: string): void;
|
||||||
/**
|
/**
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
* @param name the name of the variable to set
|
* @param secret value of the secret
|
||||||
* @param val value of the secret
|
|
||||||
*/
|
*/
|
||||||
export declare function exportSecret(name: string, val: string): void;
|
export declare function setSecret(secret: string): void;
|
||||||
/**
|
/**
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
* @param inputPath
|
* @param inputPath
|
||||||
|
17
node_modules/@actions/core/lib/core.js
generated
vendored
17
node_modules/@actions/core/lib/core.js
generated
vendored
@ -30,7 +30,7 @@ var ExitCode;
|
|||||||
// Variables
|
// Variables
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* sets env variable for this action and future actions in the job
|
* Sets env variable for this action and future actions in the job
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
* @param val the value of the variable
|
* @param val the value of the variable
|
||||||
*/
|
*/
|
||||||
@ -40,18 +40,13 @@ function exportVariable(name, val) {
|
|||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
* @param name the name of the variable to set
|
* @param secret value of the secret
|
||||||
* @param val value of the secret
|
|
||||||
*/
|
*/
|
||||||
function exportSecret(name, val) {
|
function setSecret(secret) {
|
||||||
exportVariable(name, val);
|
command_1.issueCommand('add-mask', {}, secret);
|
||||||
// the runner will error with not implemented
|
|
||||||
// leaving the function but raising the error earlier
|
|
||||||
command_1.issueCommand('set-secret', {}, val);
|
|
||||||
throw new Error('Not implemented.');
|
|
||||||
}
|
}
|
||||||
exports.exportSecret = exportSecret;
|
exports.setSecret = setSecret;
|
||||||
/**
|
/**
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
* @param inputPath
|
* @param inputPath
|
||||||
|
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"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"}
|
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"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"}
|
23
node_modules/@actions/core/package.json
generated
vendored
23
node_modules/@actions/core/package.json
generated
vendored
@ -1,33 +1,33 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"@actions/core@1.1.1",
|
"@actions/core@1.1.3",
|
||||||
"E:\\python\\setup-php"
|
"E:\\python\\setup-php"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "@actions/core@1.1.1",
|
"_from": "@actions/core@1.1.3",
|
||||||
"_id": "@actions/core@1.1.1",
|
"_id": "@actions/core@1.1.3",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==",
|
"_integrity": "sha512-2BIib53Jh4Cfm+1XNuZYYGTeRo8yiWEAUMoliMh1qQGMaqTF4VUlhhcsBylTu4qWmUx45DrY0y0XskimAHSqhw==",
|
||||||
"_location": "/@actions/core",
|
"_location": "/@actions/core",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@actions/core@1.1.1",
|
"raw": "@actions/core@1.1.3",
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"escapedName": "@actions%2fcore",
|
"escapedName": "@actions%2fcore",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "1.1.1",
|
"rawSpec": "1.1.3",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "1.1.1"
|
"fetchSpec": "1.1.3"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/",
|
"/",
|
||||||
"/@actions/tool-cache"
|
"/@actions/tool-cache"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.3.tgz",
|
||||||
"_spec": "1.1.1",
|
"_spec": "1.1.3",
|
||||||
"_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"
|
||||||
@ -57,11 +57,12 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/actions/toolkit.git"
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/core"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"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.3"
|
||||||
}
|
}
|
||||||
|
1
node_modules/typed-rest-client/package.json
generated
vendored
1
node_modules/typed-rest-client/package.json
generated
vendored
@ -22,7 +22,6 @@
|
|||||||
"fetchSpec": "1.5.0"
|
"fetchSpec": "1.5.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
"/@actions/tool-cache"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
||||||
|
114
package-lock.json
generated
114
package-lock.json
generated
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.3.tgz",
|
||||||
"integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg=="
|
"integrity": "sha512-2BIib53Jh4Cfm+1XNuZYYGTeRo8yiWEAUMoliMh1qQGMaqTF4VUlhhcsBylTu4qWmUx45DrY0y0XskimAHSqhw=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
@ -42,18 +42,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/core": {
|
"@babel/core": {
|
||||||
"version": "7.6.2",
|
"version": "7.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.4.tgz",
|
||||||
"integrity": "sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ==",
|
"integrity": "sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.5.5",
|
"@babel/code-frame": "^7.5.5",
|
||||||
"@babel/generator": "^7.6.2",
|
"@babel/generator": "^7.6.4",
|
||||||
"@babel/helpers": "^7.6.2",
|
"@babel/helpers": "^7.6.2",
|
||||||
"@babel/parser": "^7.6.2",
|
"@babel/parser": "^7.6.4",
|
||||||
"@babel/template": "^7.6.0",
|
"@babel/template": "^7.6.0",
|
||||||
"@babel/traverse": "^7.6.2",
|
"@babel/traverse": "^7.6.3",
|
||||||
"@babel/types": "^7.6.0",
|
"@babel/types": "^7.6.3",
|
||||||
"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,12 +93,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/generator": {
|
"@babel/generator": {
|
||||||
"version": "7.6.2",
|
"version": "7.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.4.tgz",
|
||||||
"integrity": "sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ==",
|
"integrity": "sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/types": "^7.6.0",
|
"@babel/types": "^7.6.3",
|
||||||
"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"
|
||||||
@ -170,9 +170,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/parser": {
|
"@babel/parser": {
|
||||||
"version": "7.6.2",
|
"version": "7.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.4.tgz",
|
||||||
"integrity": "sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==",
|
"integrity": "sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/plugin-syntax-object-rest-spread": {
|
"@babel/plugin-syntax-object-rest-spread": {
|
||||||
@ -196,17 +196,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/traverse": {
|
"@babel/traverse": {
|
||||||
"version": "7.6.2",
|
"version": "7.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.3.tgz",
|
||||||
"integrity": "sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ==",
|
"integrity": "sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.5.5",
|
"@babel/code-frame": "^7.5.5",
|
||||||
"@babel/generator": "^7.6.2",
|
"@babel/generator": "^7.6.3",
|
||||||
"@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.6.2",
|
"@babel/parser": "^7.6.3",
|
||||||
"@babel/types": "^7.6.0",
|
"@babel/types": "^7.6.3",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"globals": "^11.1.0",
|
"globals": "^11.1.0",
|
||||||
"lodash": "^4.17.13"
|
"lodash": "^4.17.13"
|
||||||
@ -230,9 +230,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/types": {
|
"@babel/types": {
|
||||||
"version": "7.6.1",
|
"version": "7.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.3.tgz",
|
||||||
"integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==",
|
"integrity": "sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
@ -540,9 +540,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.7.7",
|
"version": "12.7.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz",
|
||||||
"integrity": "sha512-4jUncNe2tj1nmrO/34PsRpZqYVnRV1svbU78cKhuQKkMntKB/AmdLyGgswcZKjFHEHGpiY8pVD8CuVI55nP54w==",
|
"integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/normalize-package-data": {
|
"@types/normalize-package-data": {
|
||||||
@ -558,9 +558,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/yargs": {
|
"@types/yargs": {
|
||||||
"version": "13.0.2",
|
"version": "13.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.3.tgz",
|
||||||
"integrity": "sha512-lwwgizwk/bIIU+3ELORkyuOgDjCh7zuWDFqRtPPhhVgq9N1F7CvLNKg1TX4f2duwtKQ0p044Au9r1PLIXHrIzQ==",
|
"integrity": "sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/yargs-parser": "*"
|
"@types/yargs-parser": "*"
|
||||||
@ -1370,9 +1370,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"es-abstract": {
|
"es-abstract": {
|
||||||
"version": "1.14.2",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.15.0.tgz",
|
||||||
"integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==",
|
"integrity": "sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"es-to-primitive": "^1.2.0",
|
"es-to-primitive": "^1.2.0",
|
||||||
@ -1383,8 +1383,8 @@
|
|||||||
"is-regex": "^1.0.4",
|
"is-regex": "^1.0.4",
|
||||||
"object-inspect": "^1.6.0",
|
"object-inspect": "^1.6.0",
|
||||||
"object-keys": "^1.1.1",
|
"object-keys": "^1.1.1",
|
||||||
"string.prototype.trimleft": "^2.0.0",
|
"string.prototype.trimleft": "^2.1.0",
|
||||||
"string.prototype.trimright": "^2.0.0"
|
"string.prototype.trimright": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"es-to-primitive": {
|
"es-to-primitive": {
|
||||||
@ -2342,9 +2342,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"handlebars": {
|
"handlebars": {
|
||||||
"version": "4.3.1",
|
"version": "4.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.3.tgz",
|
||||||
"integrity": "sha512-c0HoNHzDiHpBt4Kqe99N8tdLPKAnGCQ73gYMPWtAYM4PwGnf7xl8PBUHJqh9ijlzt2uQKaSRxbXRt+rZ7M2/kA==",
|
"integrity": "sha512-B0W4A2U1ww3q7VVthTKfh+epHx+q4mCt6iK+zEAzbMBpWQAwxCeKxEGpj/1oQTpzPXDNSOG7hmG14TsISH50yw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"neo-async": "^2.6.0",
|
"neo-async": "^2.6.0",
|
||||||
@ -2423,9 +2423,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hosted-git-info": {
|
"hosted-git-info": {
|
||||||
"version": "2.8.4",
|
"version": "2.8.5",
|
||||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz",
|
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
|
||||||
"integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==",
|
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"html-encoding-sniffer": {
|
"html-encoding-sniffer": {
|
||||||
@ -3389,9 +3389,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"json5": {
|
"json5": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz",
|
||||||
"integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==",
|
"integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "^1.2.0"
|
"minimist": "^1.2.0"
|
||||||
@ -4150,9 +4150,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"react-is": {
|
"react-is": {
|
||||||
"version": "16.9.0",
|
"version": "16.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.10.2.tgz",
|
||||||
"integrity": "sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw==",
|
"integrity": "sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"read-pkg": {
|
"read-pkg": {
|
||||||
@ -5015,19 +5015,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.6.3",
|
"version": "3.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz",
|
||||||
"integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==",
|
"integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.1.tgz",
|
||||||
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
|
"integrity": "sha512-+dSJLJpXBb6oMHP+Yvw8hUgElz4gLTh82XuX68QiJVTXaE5ibl6buzhNkQdYhBlIhozWOC9ge16wyRmjG4TwVQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"commander": "~2.20.0",
|
"commander": "2.20.0",
|
||||||
"source-map": "~0.6.1"
|
"source-map": "~0.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup php action",
|
"description": "Setup php action",
|
||||||
"main": "lib/setup-php.js",
|
"main": "lib/setup-php.js",
|
||||||
@ -24,8 +24,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.0.0",
|
"@actions/core": "^1.0.0",
|
||||||
"@actions/tool-cache": "^1.0.0",
|
"@actions/tool-cache": "^1.0.0",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security"
|
||||||
"typed-rest-client": "^1.5.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.18",
|
"@types/jest": "^24.0.18",
|
||||||
|
@ -31,13 +31,8 @@ export async function addINIValues(ini_values_csv: string, os_version: string) {
|
|||||||
export async function addINIValuesUnix(
|
export async function addINIValuesUnix(
|
||||||
ini_values_csv: string
|
ini_values_csv: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script: string = '\n';
|
|
||||||
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
|
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
|
||||||
await utils.asyncForEach(ini_values, async function(ini_value: string) {
|
return '\necho "' + ini_values.join('\n') + '" >> $ini_file\n';
|
||||||
// add script to set ini value
|
|
||||||
script += 'echo "' + ini_value + '" >> $ini_file\n';
|
|
||||||
});
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,11 +43,8 @@ export async function addINIValuesUnix(
|
|||||||
export async function addINIValuesWindows(
|
export async function addINIValuesWindows(
|
||||||
ini_values_csv: string
|
ini_values_csv: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script: string = '\n';
|
|
||||||
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
|
let ini_values: Array<string> = await utils.INIArray(ini_values_csv);
|
||||||
await utils.asyncForEach(ini_values, async function(ini_value: string) {
|
return (
|
||||||
// add script to set ini value
|
'Add-Content C:\\tools\\php\\php.ini "' + ini_values.join('\n') + '"\n'
|
||||||
script += 'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
|
);
|
||||||
});
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as pecl from './pecl';
|
|
||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as config from './config';
|
import * as config from './config';
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as pecl from './pecl';
|
|
||||||
|
|
||||||
export async function addExtension(
|
export async function addExtension(
|
||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
@ -24,75 +23,6 @@ export async function addExtension(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on windows
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
export async function enableExtensionWindows(
|
|
||||||
extension: string,
|
|
||||||
log_prefix: string
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
`try {
|
|
||||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
|
||||||
if(!(php -m | findstr -i ${extension}) -and $exist) {
|
|
||||||
Add-Content C:\\tools\\php\\php.ini "${await utils.getExtensionPrefix(
|
|
||||||
extension
|
|
||||||
)}=php_${extension}.dll"\n` +
|
|
||||||
(await utils.log('Enabled ' + extension, 'win32', 'success', log_prefix)) +
|
|
||||||
` } elseif(php -m | findstr -i ${extension}) {\n` +
|
|
||||||
(await utils.log(
|
|
||||||
extension + ' was already enabled',
|
|
||||||
'win32',
|
|
||||||
'success',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
` }
|
|
||||||
} catch [Exception] {\n` +
|
|
||||||
(await utils.log(
|
|
||||||
extension + ' could not be enabled',
|
|
||||||
'win32',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
` }\n`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable extensions which are installed but not enabled on unix
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param os_version
|
|
||||||
*/
|
|
||||||
export async function enableExtensionUnix(
|
|
||||||
extension: string,
|
|
||||||
os_version: string,
|
|
||||||
log_prefix: string
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
`if [ ! "$(php -m | grep -i ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
|
||||||
echo "${await utils.getExtensionPrefix(
|
|
||||||
extension
|
|
||||||
)}=${extension}" >> $ini_file\n` +
|
|
||||||
(await utils.log(
|
|
||||||
'Enabled ' + extension,
|
|
||||||
os_version,
|
|
||||||
'success',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
`;\n elif [ "$(php -m | grep -i ${extension})" ]; then \n` +
|
|
||||||
(await utils.log(
|
|
||||||
extension + ' was already enabled',
|
|
||||||
os_version,
|
|
||||||
'success',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
`; fi\n`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install and enable extensions for darwin
|
* Install and enable extensions for darwin
|
||||||
*
|
*
|
||||||
@ -109,63 +39,33 @@ export async function addExtensionDarwin(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
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, 'darwin', log_prefix);
|
let install_command: string = '';
|
||||||
switch (await pecl.checkPECLExtension(extension)) {
|
switch (version + extension) {
|
||||||
case true:
|
case '7.4xdebug':
|
||||||
let install_command: string = '';
|
install_command =
|
||||||
switch (version + extension) {
|
'sh ./xdebug_darwin.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
||||||
case '7.4xdebug':
|
break;
|
||||||
install_command =
|
case '7.4pcov':
|
||||||
'sh ./xdebug_darwin.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
install_command =
|
||||||
break;
|
'sh ./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||||
case '7.4pcov':
|
break;
|
||||||
install_command =
|
case '5.6xdebug':
|
||||||
'sh ./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
||||||
break;
|
|
||||||
case '5.6xdebug':
|
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
install_command =
|
|
||||||
'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
script +=
|
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
|
||||||
extension +
|
|
||||||
')" ]; then ' +
|
|
||||||
install_command +
|
|
||||||
' && ' +
|
|
||||||
(await utils.log(
|
|
||||||
'Installed and enabled ' + extension,
|
|
||||||
'darwin',
|
|
||||||
'success',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
' || ' +
|
|
||||||
(await utils.log(
|
|
||||||
'Could not install ' + extension + ' on PHP' + version,
|
|
||||||
'darwin',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
'; fi\n';
|
|
||||||
break;
|
break;
|
||||||
case false:
|
|
||||||
default:
|
default:
|
||||||
script +=
|
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
|
||||||
extension +
|
|
||||||
')" ]; then \n' +
|
|
||||||
(await utils.log(
|
|
||||||
'Could not find ' + extension + ' for PHP' + version + ' on PECL',
|
|
||||||
'darwin',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
'; fi\n';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
script +=
|
||||||
|
'add_extension ' +
|
||||||
|
extension +
|
||||||
|
' "' +
|
||||||
|
install_command +
|
||||||
|
'" ' +
|
||||||
|
(await utils.getExtensionPrefix(extension)) +
|
||||||
|
' "' +
|
||||||
|
log_prefix +
|
||||||
|
'"\n';
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
@ -186,63 +86,33 @@ export async function addExtensionWindows(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
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, log_prefix);
|
|
||||||
|
|
||||||
switch (await pecl.checkPECLExtension(extension)) {
|
let install_command: string = '';
|
||||||
case true:
|
switch (version + extension) {
|
||||||
let install_command: string = '';
|
case '7.4xdebug':
|
||||||
switch (version + extension) {
|
const extension_url: string =
|
||||||
case '7.4xdebug':
|
'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
|
||||||
const extension_url: string =
|
install_command =
|
||||||
'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
|
'Invoke-WebRequest -Uri ' +
|
||||||
install_command =
|
extension_url +
|
||||||
'Invoke-WebRequest -Uri ' +
|
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
|
||||||
extension_url +
|
install_command += 'Enable-PhpExtension xdebug';
|
||||||
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll\n';
|
|
||||||
install_command += 'Enable-PhpExtension xdebug';
|
|
||||||
break;
|
|
||||||
case '7.2xdebug':
|
|
||||||
default:
|
|
||||||
install_command = 'Install-PhpExtension ' + extension;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
script +=
|
|
||||||
'if(!(php -m | findstr -i ' +
|
|
||||||
extension +
|
|
||||||
')) { ' +
|
|
||||||
'try { ' +
|
|
||||||
install_command +
|
|
||||||
'\n' +
|
|
||||||
(await utils.log(
|
|
||||||
'Installed and enabled ' + extension,
|
|
||||||
'win32',
|
|
||||||
'success',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
' } catch [Exception] { ' +
|
|
||||||
(await utils.log(
|
|
||||||
'Could not install ' + extension + ' on PHP' + version,
|
|
||||||
'win32',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
' } }\n';
|
|
||||||
break;
|
break;
|
||||||
case false:
|
case '7.2xdebug':
|
||||||
default:
|
default:
|
||||||
script +=
|
install_command = 'Install-PhpExtension ' + extension;
|
||||||
'if(!(php -m | findstr -i ' +
|
|
||||||
extension +
|
|
||||||
')) { ' +
|
|
||||||
(await utils.log(
|
|
||||||
'Could not find ' + extension + ' for PHP' + version + ' on PECL',
|
|
||||||
'win32',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
' } \n';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
script +=
|
||||||
|
'Add-Extension ' +
|
||||||
|
extension +
|
||||||
|
' "' +
|
||||||
|
install_command +
|
||||||
|
'" ' +
|
||||||
|
(await utils.getExtensionPrefix(extension)) +
|
||||||
|
' "' +
|
||||||
|
log_prefix +
|
||||||
|
'"\n';
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
@ -263,7 +133,6 @@ export async function addExtensionLinux(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
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, 'linux', log_prefix);
|
|
||||||
|
|
||||||
let install_command: string = '';
|
let install_command: string = '';
|
||||||
switch (version + extension) {
|
switch (version + extension) {
|
||||||
@ -285,25 +154,15 @@ export async function addExtensionLinux(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
'if [ ! "$(php -m | grep -i ' +
|
'add_extension ' +
|
||||||
extension +
|
extension +
|
||||||
')" ]; then ' +
|
' "' +
|
||||||
install_command +
|
install_command +
|
||||||
' && ' +
|
'" ' +
|
||||||
(await utils.log(
|
(await utils.getExtensionPrefix(extension)) +
|
||||||
'Installed and enabled ' + extension,
|
' "' +
|
||||||
'linux',
|
log_prefix +
|
||||||
'success',
|
'"\n';
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
' || ' +
|
|
||||||
(await utils.log(
|
|
||||||
'Could not find php' + version + '-' + extension + ' on APT repository',
|
|
||||||
'linux',
|
|
||||||
'error',
|
|
||||||
log_prefix
|
|
||||||
)) +
|
|
||||||
'; fi\n';
|
|
||||||
});
|
});
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,4 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call the run function
|
// call the run function
|
||||||
run().then(function() {
|
run();
|
||||||
console.log('done');
|
|
||||||
});
|
|
||||||
|
17
src/pecl.ts
17
src/pecl.ts
@ -1,17 +0,0 @@
|
|||||||
import * as hc from 'typed-rest-client/HttpClient';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to check if PECL extension exists
|
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
|
||||||
export async function checkPECLExtension(extension: string): Promise<boolean> {
|
|
||||||
const http: hc.HttpClient = new hc.HttpClient('shivammathur/php-setup', [], {
|
|
||||||
allowRetries: true,
|
|
||||||
maxRetries: 2
|
|
||||||
});
|
|
||||||
const response: hc.HttpClientResponse = await http.get(
|
|
||||||
'https://pecl.php.net/json.php?package=' + extension
|
|
||||||
);
|
|
||||||
return response.message.statusCode === 200;
|
|
||||||
}
|
|
@ -1,3 +1,4 @@
|
|||||||
|
version='7.4.0RC3'
|
||||||
brew install pkg-config autoconf bison re2c openssl@1.1 krb5 enchant libffi freetype intltool icu4c libiconv t1lib gd libzip gmp tidyp libxml2 libxslt postgresql curl >/dev/null 2>&1
|
brew install pkg-config autoconf bison re2c openssl@1.1 krb5 enchant libffi freetype intltool icu4c libiconv t1lib gd libzip gmp tidyp libxml2 libxslt postgresql curl >/dev/null 2>&1
|
||||||
brew link icu4c gettext --force >/dev/null 2>&1
|
brew link icu4c gettext --force >/dev/null 2>&1
|
||||||
|
|
||||||
@ -48,12 +49,36 @@ export PHPBREW_HOME=/opt/phpbrew
|
|||||||
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
||||||
source ~/.bash_profile >/dev/null 2>&1
|
source ~/.bash_profile >/dev/null 2>&1
|
||||||
source ~/.bashrc >/dev/null 2>&1
|
source ~/.bashrc >/dev/null 2>&1
|
||||||
phpbrew install -j 6 7.4.0RC3 +dev >/dev/null 2>&1
|
phpbrew install -j 6 $version +dev >/dev/null 2>&1
|
||||||
phpbrew switch 7.4.0RC3
|
phpbrew switch $version
|
||||||
sudo ln -sf /opt/phpbrew/php/php-7.4.0RC3/bin/* /usr/local/bin/
|
sudo ln -sf /opt/phpbrew/php/php-$version/bin/* /usr/local/bin/
|
||||||
sudo ln -sf /opt/phpbrew/php/php-7.4.0RC3/etc/php.ini /etc/php.ini
|
sudo ln -sf /opt/phpbrew/php/php-$version/etc/php.ini /etc/php.ini
|
||||||
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=$(php -i | grep "extension_dir => /opt" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /opt" | sed -e "s|.*=> s*||")
|
||||||
pecl config-set php_ini "$ini_file"
|
pecl config-set php_ini "$ini_file"
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
brew install composer
|
brew install composer
|
||||||
|
|
||||||
|
add_extension()
|
||||||
|
{
|
||||||
|
extension=$1
|
||||||
|
install_command=$2
|
||||||
|
prefix=$3
|
||||||
|
log_prefix=$4
|
||||||
|
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
|
echo "$prefix=$extension" >> "$ini_file" && echo "\033[32;1m$log_prefix: Enabled $extension\033[0m";
|
||||||
|
elif php -m | grep -i -q "$extension"; then
|
||||||
|
echo "\033[33;1m$log_prefix: $extension was already enabled\033[0m";
|
||||||
|
elif ! php -m | grep -i -q "$extension"; then
|
||||||
|
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
||||||
|
if [ "$exists" = "200" ]; then
|
||||||
|
eval "$install_command" && \
|
||||||
|
echo "\033[32;1m$log_prefix: Installed and enabled $extension\033[0m" || \
|
||||||
|
echo "\033[31;1m$log_prefix: Could not install $extension on PHP$version\033[0m";
|
||||||
|
else
|
||||||
|
if ! php -m | grep -i -q "$extension"; then
|
||||||
|
echo "\033[31;1m$log_prefix: Could not find $extension for PHP$version on PECL\033[0m";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
version=$1
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||||
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then
|
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then
|
||||||
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
|
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1
|
||||||
@ -10,4 +11,28 @@ sudo chmod 777 "$ini_file"
|
|||||||
mkdir -p "$(pecl config-get ext_dir)"
|
mkdir -p "$(pecl config-get ext_dir)"
|
||||||
composer global require hirak/prestissimo >/dev/null 2>&1
|
composer global require hirak/prestissimo >/dev/null 2>&1
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
||||||
|
|
||||||
|
add_extension()
|
||||||
|
{
|
||||||
|
extension=$1
|
||||||
|
install_command=$2
|
||||||
|
prefix=$3
|
||||||
|
log_prefix=$4
|
||||||
|
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
|
echo "$prefix=$extension" >> "$ini_file" && echo "\033[32;1m$log_prefix: Enabled $extension\033[0m";
|
||||||
|
elif php -m | grep -i -q "$extension"; then
|
||||||
|
echo "\033[33;1m$log_prefix: $extension was already enabled\033[0m";
|
||||||
|
elif ! php -m | grep -i -q "$extension"; then
|
||||||
|
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
||||||
|
if [ "$exists" = "200" ]; then
|
||||||
|
eval "$install_command" && \
|
||||||
|
echo "\033[32;1m$log_prefix: Installed and enabled $extension\033[0m" || \
|
||||||
|
echo "\033[31;1m$log_prefix: Could not install $extension on PHP$version\033[0m";
|
||||||
|
else
|
||||||
|
if ! php -m | grep -i -q "$extension"; then
|
||||||
|
echo "\033[31;1m$log_prefix: Could not find $extension for PHP$version on PECL\033[0m";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
version=$(php-config --version | cut -c 1-3)
|
existing_version=$(php-config --version | cut -c 1-3)
|
||||||
if [ "$version" != "$1" ]; then
|
version=$1
|
||||||
|
if [ "$existing_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
|
||||||
@ -37,3 +38,20 @@ sudo chmod 777 "$ini_file"
|
|||||||
sudo mkdir -p /run/php
|
sudo mkdir -p /run/php
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
||||||
|
|
||||||
|
add_extension()
|
||||||
|
{
|
||||||
|
extension=$1
|
||||||
|
install_command=$2
|
||||||
|
prefix=$3
|
||||||
|
log_prefix=$4
|
||||||
|
if ! php -m | grep -i -q "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
|
echo "$prefix=$extension" >> "$ini_file" && echo "\033[32;1m$log_prefix: Enabled $extension\033[0m";
|
||||||
|
elif php -m | grep -i -q "$extension"; then
|
||||||
|
echo "\033[33;1m$log_prefix: $extension was already enabled\033[0m";
|
||||||
|
elif ! php -m | grep -i -q "$extension"; then
|
||||||
|
eval "$install_command" && \
|
||||||
|
echo "\033[32;1m$log_prefix: Installed and enabled $extension\033[0m" || \
|
||||||
|
echo "\033[31;1m$log_prefix: Could not find php$version-$extension on APT repository\033[0m";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -40,4 +40,41 @@ if($version -lt '7.4') {
|
|||||||
Write-Host "Installing Composer" -ForegroundColor Blue
|
Write-Host "Installing Composer" -ForegroundColor Blue
|
||||||
Install-Composer -Scope System -Path C:\tools\php
|
Install-Composer -Scope System -Path C:\tools\php
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
||||||
|
|
||||||
|
Function Add-Extension($extension, $install_command, $prefix, $log_prefix)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$exist = Test-Path -Path C:\tools\php\ext\php_$extension.dll
|
||||||
|
if(!(php -m | findstr -i ${extension}) -and $exist) {
|
||||||
|
Add-Content C:\tools\php\php.ini "$prefix=php_$extension.dll"
|
||||||
|
Write-Host "$log_prefix`: Enabled $extension" -ForegroundColor green
|
||||||
|
} elseif(php -m | findstr -i $extension) {
|
||||||
|
Write-Host "$log_prefix`: $extension was already enabled" -ForegroundColor yellow
|
||||||
|
}
|
||||||
|
} catch [Exception] {
|
||||||
|
Write-Host "$log_prefix`: $extension could not be enabled" -ForegroundColor red
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = 404
|
||||||
|
try {
|
||||||
|
$status = (Invoke-WebRequest -Uri "https://pecl.php.net/json.php?package=$extension" -UseBasicParsing -DisableKeepAlive).StatusCode
|
||||||
|
} catch [Exception] {
|
||||||
|
$status = 500
|
||||||
|
}
|
||||||
|
|
||||||
|
if($status -eq 200) {
|
||||||
|
if(!(php -m | findstr -i $extension)) {
|
||||||
|
try {
|
||||||
|
Invoke-Expression $install_command
|
||||||
|
Write-Host "$log_prefix`: Installed and enabled $extension" -ForegroundColor green
|
||||||
|
} catch [Exception] {
|
||||||
|
Write-Host "$log_prefix`: Could not install $extension on PHP $version" -ForegroundColor red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!(php -m | findstr -i $extension)) {
|
||||||
|
Write-Host "$log_prefix`: Could not find $extension for PHP$version on PECL" -ForegroundColor red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -167,7 +167,7 @@ export async function log(
|
|||||||
};
|
};
|
||||||
switch (prefix) {
|
switch (prefix) {
|
||||||
case '':
|
case '':
|
||||||
prefix = prefix;
|
prefix = '';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
prefix = prefix + ': ';
|
prefix = prefix + ': ';
|
||||||
|
Loading…
Reference in New Issue
Block a user