mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for fail-fast env variable
This commit is contained in:
parent
96d8c1e901
commit
b77ec78d01
@ -349,12 +349,12 @@ describe('Tools tests', () => {
|
||||
|
||||
script = await tools.addDevTools('phpize', 'win32');
|
||||
expect(script).toContain(
|
||||
'Add-Log "$cross" "phpize" "phpize is not a windows tool"'
|
||||
'Add-Log "$tick" "phpize" "phpize is not a windows tool"'
|
||||
);
|
||||
|
||||
script = await tools.addDevTools('php-config', 'win32');
|
||||
expect(script).toContain(
|
||||
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
|
||||
'Add-Log "$tick" "php-config" "php-config is not a windows tool"'
|
||||
);
|
||||
|
||||
script = await tools.addDevTools('tool', 'openbsd');
|
||||
|
5
dist/index.js
vendored
5
dist/index.js
vendored
@ -2084,7 +2084,7 @@ async function addDevTools(tool, os_version) {
|
||||
case 'darwin':
|
||||
return 'add_devtools ' + tool;
|
||||
case 'win32':
|
||||
return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
|
||||
return await utils.addLog('$tick', tool, tool + ' is not a windows tool', 'win32');
|
||||
default:
|
||||
return await utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||
}
|
||||
@ -2583,7 +2583,8 @@ async function run() {
|
||||
const tool = await utils.scriptTool(os_version);
|
||||
const script = os_version + (await utils.scriptExtension(os_version));
|
||||
const location = await getScript(script, version, os_version);
|
||||
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
|
||||
const fail_fast = await utils.readEnv('fail-fast');
|
||||
await exec_1.exec(await utils.joins(tool, location, version, __dirname, fail_fast));
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
@ -60,7 +60,10 @@ export async function run(): Promise<void> {
|
||||
const tool = await utils.scriptTool(os_version);
|
||||
const script = os_version + (await utils.scriptExtension(os_version));
|
||||
const location = await getScript(script, version, os_version);
|
||||
await exec(await utils.joins(tool, location, version, __dirname));
|
||||
const fail_fast = await utils.readEnv('fail-fast');
|
||||
await exec(
|
||||
await utils.joins(tool, location, version, __dirname, fail_fast)
|
||||
);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ add_log() {
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
else
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
[ "$fail_fast" = "true" ] && exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
@ -268,6 +269,7 @@ tick="✓"
|
||||
cross="✗"
|
||||
version=$1
|
||||
dist=$2
|
||||
fail_fast=$3
|
||||
nodot_version=${1/./}
|
||||
old_versions="5.[3-5]"
|
||||
tool_path_dir="/usr/local/bin"
|
||||
|
@ -13,6 +13,7 @@ add_log() {
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
else
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
||||
[ "$fail_fast" = "true" ] && exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
@ -423,6 +424,7 @@ cross="✗"
|
||||
pecl_config="false"
|
||||
version=$1
|
||||
dist=$2
|
||||
fail_fast=$3
|
||||
nightly_versions="8.[0-1]"
|
||||
old_versions="5.[3-5]"
|
||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
|
@ -8,7 +8,10 @@ param (
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$dist
|
||||
$dist,
|
||||
[Parameter(Position = 2, Mandatory = $false)]
|
||||
[string]
|
||||
$fail_fast = 'false'
|
||||
)
|
||||
|
||||
# Function to log start of a operation.
|
||||
@ -18,8 +21,14 @@ Function Step-Log($message) {
|
||||
|
||||
# Function to log result of a operation.
|
||||
Function Add-Log($mark, $subject, $message) {
|
||||
$code = if ($mark -eq $cross) { "31" } else { "32" }
|
||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message
|
||||
if ($mark -eq $tick) {
|
||||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
||||
} else {
|
||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
||||
if($fail_fast -eq 'true') {
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Function to add a line to a powershell profile safely.
|
||||
|
@ -378,7 +378,7 @@ export async function addDevTools(
|
||||
return 'add_devtools ' + tool;
|
||||
case 'win32':
|
||||
return await utils.addLog(
|
||||
'$cross',
|
||||
'$tick',
|
||||
tool,
|
||||
tool + ' is not a windows tool',
|
||||
'win32'
|
||||
|
Loading…
Reference in New Issue
Block a user