Add coverage support, improve logs and fix bugs

This commit is contained in:
Shivam Mathur 2019-09-26 02:33:39 +05:30
parent 36104f0983
commit 1ba40f9521
26 changed files with 505 additions and 211 deletions

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

@ -33,6 +33,7 @@ describe('Features tests', () => {
'Install-PhpExtension DoesNotExist -MinimumStability stable' 'Install-PhpExtension DoesNotExist -MinimumStability stable'
); );
}); });
it('checking addExtensionOnLinux', async () => { it('checking addExtensionOnLinux', async () => {
let linux: string = await features.addExtension( let linux: string = await features.addExtension(
'xdebug, pcov', 'xdebug, pcov',
@ -46,6 +47,7 @@ describe('Features tests', () => {
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov' 'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov'
); );
}); });
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,6 +57,9 @@ 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('xdebug', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
darwin = await features.addExtension('DoesNotExist', '7.2', 'darwin'); darwin = await features.addExtension('DoesNotExist', '7.2', 'darwin');
expect(darwin).not.toContain('sudo pecl install DoesNotExist'); expect(darwin).not.toContain('sudo pecl install DoesNotExist');
}); });
@ -94,4 +99,68 @@ describe('Features tests', () => {
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');
}); });
it('checking addCoverage on windows', async () => {
let win32: string = await features.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain(
'Install-PhpExtension xdebug -MinimumStability alpha'
);
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 alpha'
);
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(
'nocov is not a coverage driver or it is not supported'
);
win32 = await features.addCoverage('pcov', '7.0', 'win32');
expect(win32).toContain('pcov requires php 7.1 or newer');
});
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'");
});
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');
});
}); });

View File

@ -86,6 +86,37 @@ 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 -e "\\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 -e "\\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 -e "\\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 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'

View File

@ -18,15 +18,15 @@ 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') { if (os_version === 'win32') {
return yield addExtensionWindows(extensions, version); return yield addExtensionWindows(extension_csv, version);
} }
else if (os_version === 'linux') { else if (os_version === 'linux') {
return yield addExtensionLinux(extensions, version); return yield addExtensionLinux(extension_csv, version);
} }
return yield addExtensionDarwin(extensions); return yield addExtensionDarwin(extension_csv, version);
}); });
} }
exports.addExtension = addExtension; exports.addExtension = addExtension;
@ -46,14 +46,15 @@ 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 Enable-PhpExtension ${extension} C:\\tools\\php\n` +
} (yield utils.log(extension + ' enabled', 'win32', 'success')) +
} catch [Exception] { `}
echo $_ } catch [Exception] {\n` +
}\n`; (yield utils.log(extension + ' could not be installed', 'win32', 'error')) +
` }\n`);
}); });
} }
exports.enableExtensionWindows = enableExtensionWindows; exports.enableExtensionWindows = enableExtensionWindows;
@ -64,10 +65,10 @@ exports.enableExtensionWindows = enableExtensionWindows;
*/ */
function enableExtensionUnix(extension) { function enableExtensionUnix(extension) {
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 ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"' echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'\n` +
echo "${extension} enabled" (yield utils.log(extension + ' enabled', 'unix', 'success')) +
fi\n`; `; fi\n`);
}); });
} }
exports.enableExtensionUnix = enableExtensionUnix; exports.enableExtensionUnix = enableExtensionUnix;
@ -75,24 +76,29 @@ 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);
if (yield pecl.checkPECLExtension(extension)) { if (yield pecl.checkPECLExtension(extension)) {
if (version === '5.6' && extension === 'xdebug') {
extension = 'xdebug-2.5.5';
}
script += script +=
'if [ ! "$(php -m | grep ' + 'if [ ! "$(php -m | grep ' +
extension + extension +
')" ]; then sudo pecl install ' + ')" ]; then sudo pecl install ' +
extension + extension +
' || echo "Couldn\'t find extension: ' + ' || ' +
extension + (yield utils.log("Couldn't install extension: " + extension, 'darwin', 'error')) +
'"; fi\n'; '; fi\n';
} }
}); });
}); });
@ -112,6 +118,7 @@ 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_version = 'stable';
@ -127,8 +134,8 @@ function addExtensionWindows(extension_csv, version) {
extension + extension +
' -MinimumStability ' + ' -MinimumStability ' +
extension_version + extension_version +
' } catch [Exception] { echo $_; echo "Could not install extension: "' + ' } catch [Exception] { ' +
extension + (yield utils.log('Could not install extension: ' + extension, 'win32', 'error')) +
' } }\n'; ' } }\n';
} }
}); });
@ -149,6 +156,7 @@ 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);
script += script +=
@ -158,11 +166,9 @@ function addExtensionLinux(extension_csv, version) {
version + version +
'-' + '-' +
extension + extension +
' || echo "Couldn\'t find extension php' + ' || ' +
version + (yield utils.log("Couldn't find extension php" + version + '-' + extension, 'linux', 'error')) +
'-' + '; fi\n';
extension +
'"; fi\n';
}); });
}); });
return script; return script;
@ -207,3 +213,48 @@ 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 = '\n';
if (coverage) {
coverage = coverage.toLowerCase();
// pcov
if (coverage === 'pcov') {
// if version is 7.1 or newer
if (version >= '7.1') {
script += yield addExtension(coverage, version, os_version);
script += yield addINIValues('pcov.enabled=1', os_version);
// add command to disable xdebug and enable pcov
if (os_version === 'linux') {
script += "sudo phpdismod xdebug || echo 'xdebug not installed'\n";
script += "sudo phpenmod pcov || echo 'pcov not installed'\n";
}
else if (os_version === 'darwin') {
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
}
else {
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
}
// success
script += yield utils.log('pcov enabled as coverage driver', os_version, 'success');
// version is not supported
}
else {
script += yield utils.log('pcov requires php 7.1 or newer', os_version, 'warning');
}
//xdebug
}
else if (coverage === 'xdebug') {
script += yield addExtension(coverage, version, os_version);
script += yield utils.log('Xdebug enabled as coverage driver', os_version, 'success');
// unknown coverage driver
}
else {
script += yield utils.log(coverage + ' is not a coverage driver or it is not supported', os_version, 'warning');
}
}
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

@ -102,3 +102,22 @@ 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* () {
if (os_version === 'win32') {
const color = {
error: 'red',
success: 'green',
warning: 'yellow'
};
return "Write-Host '" + message + "' -ForegroundColor " + color[log_type];
}
const color = {
error: '31',
success: '32',
warning: '33'
};
return 'echo -e "\\033[' + color[log_type] + ';1m' + message + '\\033[0m"';
});
}
exports.log = log;

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,EACf,UAA6B,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K,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;AACb,CAAC,EA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C;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.5",
"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.5",
"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

@ -2,17 +2,17 @@ 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') { if (os_version === 'win32') {
return await addExtensionWindows(extensions, version); return await addExtensionWindows(extension_csv, version);
} else if (os_version === 'linux') { } else if (os_version === 'linux') {
return await addExtensionLinux(extensions, version); return await addExtensionLinux(extension_csv, version);
} }
return await addExtensionDarwin(extensions); return await addExtensionDarwin(extension_csv, version);
} }
export async function addINIValues(ini_values_csv: string, os_version: string) { export async function addINIValues(ini_values_csv: string, os_version: string) {
@ -28,14 +28,17 @@ 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 Enable-PhpExtension ${extension} C:\\tools\\php\n` +
} (await utils.log(extension + ' enabled', 'win32', 'success')) +
} catch [Exception] { `}
echo $_ } catch [Exception] {\n` +
}\n`; (await utils.log(extension + ' could not be installed', 'win32', 'error')) +
` }\n`
);
} }
/** /**
@ -44,34 +47,46 @@ export async function enableExtensionWindows(extension: string) {
* @param extension * @param extension
*/ */
export async function enableExtensionUnix(extension: string) { export async function enableExtensionUnix(extension: string) {
return `if [ ! "$(php -m | grep ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then return (
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"' `if [ ! "$(php -m | grep ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
echo "${extension} enabled" echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'\n` +
fi\n`; (await utils.log(extension + ' enabled', 'unix', '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);
if (await pecl.checkPECLExtension(extension)) { if (await pecl.checkPECLExtension(extension)) {
if (version === '5.6' && extension === 'xdebug') {
extension = 'xdebug-2.5.5';
}
script += script +=
'if [ ! "$(php -m | grep ' + 'if [ ! "$(php -m | grep ' +
extension + extension +
')" ]; then sudo pecl install ' + ')" ]; then sudo pecl install ' +
extension + extension +
' || echo "Couldn\'t find extension: ' + ' || ' +
extension + (await utils.log(
'"; fi\n'; "Couldn't install extension: " + extension,
'darwin',
'error'
)) +
'; fi\n';
} }
}); });
return script; return script;
@ -90,6 +105,7 @@ 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_version = 'stable';
@ -105,8 +121,12 @@ export async function addExtensionWindows(
extension + extension +
' -MinimumStability ' + ' -MinimumStability ' +
extension_version + extension_version +
' } catch [Exception] { echo $_; echo "Could not install extension: "' + ' } catch [Exception] { ' +
extension + (await utils.log(
'Could not install extension: ' + extension,
'win32',
'error'
)) +
' } }\n'; ' } }\n';
} }
}); });
@ -126,6 +146,7 @@ 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);
script += script +=
@ -135,11 +156,13 @@ export async function addExtensionLinux(
version + version +
'-' + '-' +
extension + extension +
' || echo "Couldn\'t find extension php' + ' || ' +
version + (await utils.log(
'-' + "Couldn't find extension php" + version + '-' + extension,
extension + 'linux',
'"; fi\n'; 'error'
)) +
'; fi\n';
}); });
return script; return script;
} }
@ -177,3 +200,62 @@ export async function addINIValuesWindows(
}); });
return script; return script;
} }
export async function addCoverage(
coverage: string,
version: string,
os_version: string
): Promise<string> {
let script: string = '\n';
if (coverage) {
coverage = coverage.toLowerCase();
// pcov
if (coverage === 'pcov') {
// if version is 7.1 or newer
if (version >= '7.1') {
script += await addExtension(coverage, version, os_version);
script += await addINIValues('pcov.enabled=1', os_version);
// add command to disable xdebug and enable pcov
if (os_version === 'linux') {
script += "sudo phpdismod xdebug || echo 'xdebug not installed'\n";
script += "sudo phpenmod pcov || echo 'pcov not installed'\n";
} else if (os_version === 'darwin') {
script += 'sudo sed -i \'\' "/xdebug/d" $ini_file\n';
} else {
script +=
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php }\n';
}
// success
script += await utils.log(
'pcov enabled as coverage driver',
os_version,
'success'
);
// version is not supported
} else {
script += await utils.log(
'pcov requires php 7.1 or newer',
os_version,
'warning'
);
}
//xdebug
} else if (coverage === 'xdebug') {
script += await addExtension(coverage, version, os_version);
script += await utils.log(
'Xdebug enabled as coverage driver',
os_version,
'success'
);
// unknown coverage driver
} else {
script += await utils.log(
coverage + ' is not a coverage driver or it is not supported',
os_version,
'warning'
);
}
}
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
@ -23,6 +24,7 @@ async function run() {
); );
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 +39,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 +50,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

@ -89,3 +89,24 @@ 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> {
if (os_version === 'win32') {
const color: any = {
error: 'red',
success: 'green',
warning: 'yellow'
};
return "Write-Host '" + message + "' -ForegroundColor " + color[log_type];
}
const color: any = {
error: '31',
success: '32',
warning: '33'
};
return 'echo -e "\\033[' + color[log_type] + ';1m' + message + '\\033[0m"';
}