Skip to content

Commit 6198ab2

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

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.github/workflows/pull_request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
windows_build_command: |
4646
mkdir MyPackage
4747
cd MyPackage
48-
swift package init --type library
49-
swift build -vv
48+
Invoke-Program swift package init --type library
49+
Invoke-Program swift build -vv
5050
enable_windows_docker: true
5151

5252
tests_without_docker:
@@ -59,8 +59,8 @@ jobs:
5959
windows_build_command: |
6060
mkdir MyPackage
6161
cd MyPackage
62-
swift package init --type library
63-
swift build
62+
Invoke-Program swift package init --type library
63+
Invoke-Program swift build
6464
enable_windows_docker: false
6565

6666
tests_macos:

.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)