2019-09-06 06:47:43 +07:00
|
|
|
import {exec} from '@actions/exec/lib/exec';
|
2019-09-20 09:41:20 +07:00
|
|
|
import * as core from '@actions/core';
|
|
|
|
import * as utils from './utils';
|
|
|
|
import * as features from './features';
|
2019-09-06 06:47:43 +07:00
|
|
|
|
2019-09-20 09:41:20 +07:00
|
|
|
/**
|
|
|
|
* Run the script
|
|
|
|
*/
|
2019-09-06 06:47:43 +07:00
|
|
|
async function run() {
|
|
|
|
try {
|
2019-09-09 03:05:38 +07:00
|
|
|
// taking inputs
|
2019-09-20 09:41:20 +07:00
|
|
|
let version: string = await utils.getInput('php-version', true);
|
|
|
|
let extension_csv: string = await utils.getInput('extension-csv', false);
|
|
|
|
let ini_values_csv: string = await utils.getInput('ini-values-csv', false);
|
2019-09-26 04:03:39 +07:00
|
|
|
let coverage: string = await utils.getInput('coverage', false);
|
2019-09-18 09:10:09 +07:00
|
|
|
|
2019-09-20 09:41:20 +07:00
|
|
|
let os_version: string = process.platform;
|
2019-09-09 03:05:38 +07:00
|
|
|
// check the os version and run the respective script
|
2019-09-06 06:47:43 +07:00
|
|
|
if (os_version == 'darwin') {
|
2019-09-20 09:41:20 +07:00
|
|
|
let darwin: string = await utils.readScript(
|
|
|
|
'darwin.sh',
|
|
|
|
version,
|
|
|
|
os_version
|
|
|
|
);
|
|
|
|
darwin += await features.addExtension(extension_csv, version, os_version);
|
|
|
|
darwin += await features.addINIValues(ini_values_csv, os_version);
|
2019-09-26 04:03:39 +07:00
|
|
|
darwin += await features.addCoverage(coverage, version, os_version);
|
2019-09-20 09:41:20 +07:00
|
|
|
await utils.writeScript('darwin.sh', version, darwin);
|
2019-09-06 22:29:53 +07:00
|
|
|
await exec('sh -x ./' + version + 'darwin.sh ' + version);
|
2019-09-06 06:47:43 +07:00
|
|
|
} else if (os_version == 'win32') {
|
2019-09-20 09:41:20 +07:00
|
|
|
let windows: string = await utils.readScript(
|
|
|
|
'win32.ps1',
|
|
|
|
version,
|
|
|
|
os_version
|
2019-09-06 22:16:37 +07:00
|
|
|
);
|
2019-09-20 09:41:20 +07:00
|
|
|
windows += await features.addExtension(
|
|
|
|
extension_csv,
|
|
|
|
version,
|
|
|
|
os_version
|
|
|
|
);
|
|
|
|
windows += await features.addINIValues(ini_values_csv, os_version);
|
2019-09-26 04:03:39 +07:00
|
|
|
windows += await features.addCoverage(coverage, version, os_version);
|
2019-09-20 09:41:20 +07:00
|
|
|
await utils.writeScript('win32.ps1', version, windows);
|
|
|
|
await exec('powershell .\\' + version + 'win32.ps1 -version ' + version);
|
2019-09-06 06:47:43 +07:00
|
|
|
} else if (os_version == 'linux') {
|
2019-09-20 09:41:20 +07:00
|
|
|
let linux: string = await utils.readScript(
|
|
|
|
'linux.sh',
|
|
|
|
version,
|
|
|
|
os_version
|
|
|
|
);
|
|
|
|
linux += await features.addExtension(extension_csv, version, os_version);
|
|
|
|
linux += await features.addINIValues(ini_values_csv, os_version);
|
2019-09-26 04:03:39 +07:00
|
|
|
linux += await features.addCoverage(coverage, version, os_version);
|
2019-09-20 09:41:20 +07:00
|
|
|
await utils.writeScript('linux.sh', version, linux);
|
2019-09-06 22:16:37 +07:00
|
|
|
await exec('./' + version + 'linux.sh ' + version);
|
2019-09-06 06:47:43 +07:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
core.setFailed(err.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-07 19:31:50 +07:00
|
|
|
// call the run function
|
|
|
|
run().then(function() {
|
2019-09-06 06:47:43 +07:00
|
|
|
console.log('done');
|
|
|
|
});
|