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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 26, 2024

Powershell does not automatically exit if a subcommand fails, ie. it behaves similar to a Bash script without set -e. This means that swift test could fail and run.ps1 would still return exit code 0, indicating success.

Add an Invoke-Program utility to run.ps1 that propagates error codes.

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

Test run (6.0 expectedly failed here to verify): https://github.com/swiftlang/swift-format/actions/runs/11529268101/job/32097477699?pr=867

@ahoppen ahoppen requested a review from a team as a code owner October 26, 2024 04:39
@ahoppen ahoppen marked this pull request as draft October 26, 2024 04:40
Powershell does not automatically exit if a subcommand fails, ie. it behaves similar to a Bash script without `set -e`. This means that `swift test` could fail and `run.ps1` would still return exit code 0, indicating success.

Add an `Invoke-Program` utility to `run.ps1` that propagates error codes.
@ahoppen ahoppen force-pushed the windows-error-propagation branch from 9bfd653 to 6110e2a Compare October 26, 2024 05:55
@ahoppen ahoppen marked this pull request as ready for review October 26, 2024 05:55
@@ -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.

@dschaefer2
Copy link
Member

Reminds me I need to finish off swiftlang/swift-package-manager#8049 so packages have a better chance of building. :).

@ahoppen ahoppen merged commit 9f2ee99 into swiftlang:main Nov 4, 2024
9 checks passed
@ahoppen ahoppen deleted the windows-error-propagation branch November 4, 2024 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants