Skip to content

Propagate errors from the Windows run script #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/workflows/swift_package_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ on:
default: ""
windows_build_command:
type: string
description: "Windows Command Prompt command to build and test the package"
description: |
Windows Command Prompt command to build and test the package.
Note that Powershell does not automatically exit if a subcommand fails. The Invoke-Program utility is available to propagate non-zero exit codes.
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`.
default: "swift test"
linux_env_vars:
description: "List of environment variables"
Expand Down Expand Up @@ -84,7 +87,7 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ['5.9', '5.10', '6.0', 'nightly', 'nightly-6.0']
swift_version: ['5.9', '6.0', 'nightly', 'nightly-6.0']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add 5.10 back

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we need to disable Windows 5.10 again because it fails to build Swift packages with

Invalid manifest (compiled with: ["C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Toolchains\\5.10.1+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\TemporaryDirectory.AXNJbD\\vfs.yaml", "-L", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Toolchains\\5.10.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Platforms\\5.10.1\\Windows.platform\\Developer\\SDKs\\Windows.sdk", "-libc", "MD", "-I", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Platforms\\5.10.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Platforms\\5.10.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\x86_64", "-L", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Platforms\\5.10.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\x86_64", "-use-ld=lld", "-swift-version", "5", "-I", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Programs\\Swift\\Toolchains\\5.10.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "5.6.0", "C:\\source\\Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-o", "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\TemporaryDirectory.Ngb23o\\source-manifest.exe"])
Missing or empty JSON output from manifest compilation for source

5.10 never worked, it was just mistakingly always reported as success, despite failing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our matrix we just said Windows is 6.0+. Since we never had CI for Windows on our packages that makes our lives easier and we don't have to chase old toolchain bugs.

exclude:
- ${{ fromJson(inputs.windows_exclude_swift_versions) }}
steps:
Expand All @@ -103,15 +106,23 @@ jobs:
- name: Create test script
run: |
mkdir $env:TEMP\test-script
echo 'Set-PSDebug -Trace 1' >> $env:TEMP\test-script\run.ps1
echo '$ErrorActionPreference = "Stop"' >> $env:TEMP\test-script\run.ps1
echo 'swift --version' >> $env:TEMP\test-script\run.ps1
echo 'swift test --version' >> $env:TEMP\test-script\run.ps1
echo 'cd C:\source\' >> $env:TEMP\test-script\run.ps1
echo @'
Set-PSDebug -Trace 1
# Run the command following `Invoke-Program`.
# If that command returns a non-zero exit code, return the same exit code from this script.
function Invoke-Program($Executable) {
& $Executable @args
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
}
Invoke-Program swift --version
Invoke-Program swift test --version
Invoke-Program cd C:\source\
${{ inputs.windows_pre_build_command }}
Invoke-Program ${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
'@ >> $env:TEMP\test-script\run.ps1
echo '${{ inputs.windows_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}' >> $env:TEMP\test-script\run.ps1
- name: Build / Test
timeout-minutes: 60
run: |
Expand Down