Skip to content

Commit 8778810

Browse files
committed
Try use ErrorActionPreference instead of Invoke-Program
1 parent c4ddc51 commit 8778810

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/swift_package_test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ on:
9797
default: ""
9898
windows_build_command:
9999
type: string
100-
description: |
101-
Windows Command Prompt command to build and test the package.
102-
Note that Powershell does not automatically exit if a subcommand fails. The Invoke-Program utility is available to propagate non-zero exit codes.
103-
It is strongly encouraged to run all command using `Invoke-Program` unless you want to continue on error eg. `Invoke-Program git apply patch.diff` instead of `git apply patch.diff`.
100+
description: "Windows Command Prompt command to build and test the package"
104101
default: "swift test"
105102
macos_env_vars:
106103
description: "Newline separated list of environment variables"
@@ -386,6 +383,8 @@ jobs:
386383
mkdir $env:TEMP\test-script
387384
echo @'
388385
Set-PSDebug -Trace 1
386+
$ErrorActionPreference = 'Stop'
387+
389388
if ("${{ inputs.enable_windows_docker }}" -eq "true") {
390389
$Source = "C:\source"
391390
} else {
@@ -400,11 +399,12 @@ jobs:
400399
exit $LastExitCode
401400
}
402401
}
403-
Invoke-Program swift --version
404-
Invoke-Program swift test --version
405-
Invoke-Program cd $Source
402+
403+
swift --version
404+
swift test --version
405+
cd $Source
406406
${{ inputs.windows_pre_build_command }}
407-
Invoke-Program ${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
407+
${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
408408
'@ >> $env:TEMP\test-script\run.ps1
409409
# Docker build
410410
- name: Docker Build / Test

0 commit comments

Comments
 (0)