diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index d8009e64..632724e0 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -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'); diff --git a/dist/index.js b/dist/index.js index 3bf35cee..d088d2fb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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); diff --git a/src/install.ts b/src/install.ts index e2af537d..99c6aaa6 100644 --- a/src/install.ts +++ b/src/install.ts @@ -60,7 +60,10 @@ export async function run(): Promise { 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); } diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 8e69a7a2..15293ce0 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -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" diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 18b9d151..08518ca1 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -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" diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 8eb6525f..dd861c97 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -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. diff --git a/src/tools.ts b/src/tools.ts index 3a9cbbb3..922a1678 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -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'