Skip to content

Commit f79e5cb

Browse files
committed
Try invoke-program instead
1 parent 8778810 commit f79e5cb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/swift_package_test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ on:
9797
default: ""
9898
windows_build_command:
9999
type: string
100-
description: "Windows Command Prompt command to build and test the package"
101-
default: "swift test"
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`.
104+
default: "Invoke-Program swift test"
102105
macos_env_vars:
103106
description: "Newline separated list of environment variables"
104107
type: string
@@ -383,8 +386,6 @@ jobs:
383386
mkdir $env:TEMP\test-script
384387
echo @'
385388
Set-PSDebug -Trace 1
386-
$ErrorActionPreference = 'Stop'
387-
388389
if ("${{ inputs.enable_windows_docker }}" -eq "true") {
389390
$Source = "C:\source"
390391
} else {
@@ -399,12 +400,11 @@ jobs:
399400
exit $LastExitCode
400401
}
401402
}
402-
403-
swift --version
404-
swift test --version
405-
cd $Source
403+
Invoke-Program swift --version
404+
Invoke-Program swift test --version
405+
Invoke-Program cd $Source
406406
${{ inputs.windows_pre_build_command }}
407-
${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
407+
Invoke-Program ${{ 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)