-
Notifications
You must be signed in to change notification settings - Fork 16
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
Build Swift SDKs for a Linux host if the --host
parameter matches a Linux OS (*-unknown-linux-gnu
)
#167
Build Swift SDKs for a Linux host if the --host
parameter matches a Linux OS (*-unknown-linux-gnu
)
#167
Conversation
- No need to fetch llvm or prepare lld since the host toolchain for Linux already contains it. - Only create swift_static/clang symlink if it does not exist.
- This helps improve the time it takes to run the EndToEndTests since the generator does not need to be rebuild for each test.
- The swift-sdk is kept if an end-to-end test fails to allow further debugging.
- If SWIFT_SDK_GENERATOR_TEST_LINUX_SWIFT_SDKS is set, the swift-sdks are generated for Linux hosts. Each one is then tested against a matrix of Swift docker containers to verify each distribution works with it. - If SWIFT_SDK_GENERATOR_TEST_LINUX_SWIFT_SDKS is NOT set, but the host is Linux, then a Linux swift-sdk is generated but the suite of docker containers is not used.
- If the host is aarch64, we download the aarch64 Swift toolchain.
@euanh @kateinoigakukun @MaxDesiatov I successfully ran the EdgeToEdgeTests on both an M1 Mac and a Linux x86_64 host with |
- If running on a Ubuntu 24.04 host, simply do swift package update locally and do not check in the updated Package.resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor nits, but my main concern is withTemporaryDirectory
no longer used in the buildTestcases
function, which would imply temporary data is not cleaned up and those tests are no longer idempotent.
…irectory" This reverts commit 2e6bd28.
// that contains each Swift-supported Linux distribution. This way we can validate that each | ||
// distribution is capable of building using the Linux Swift SDK. | ||
if testLinuxSwiftSDKs { | ||
let swiftContainerVersions = ["focal", "jammy", "noble", "fedora39", "rhel-ubi9", "amazonlinux2", "bookworm"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fedora 39 is already EOL but it looks like it's the most recent Fedora-based Swift container image available. 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we could always remove it from the list. But, it has to use what's currently available...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we should keep it for now so we have some Fedora coverage. ubi9
is similar but there may be differences which affect us.
I ran the
Let me know if anything else is needed here! |
This reverts commit f6e812b.
64658ea
to
4a2f69d
Compare
I removed logging changes and swift-log usage, but retained this portion in the EndToEndTests: // Cleanup
logger.info("Removing SDK to cleanup...")
try await Shell.run("swift experimental-sdk remove \(bundleName)") Since it should not require any changes for structured logging and is consistent with other logging calls here. |
@swift-ci test |
- On Linux we do not download the host LLVM since it is already included in the toolchain. However, on macOS we may or may not need to download it.
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This fixes #114 and provides the following:
--host
param or auto-detectedhostTriple.os
is.linux
, the amazonlinux2 Swift toolchain is downloaded and included in the Swift SDK. Examples:amazonlinux2
for the host toolchain as it seems to be compatible with every Swift-supported Linux distribution with glibc versions and included libraries.For testing all of this, I updated the EndToEndTests:
SWIFT_SDK_GENERATOR_TEST_LINUX_SWIFT_SDKS
env variable is defined, Swift SDKs are built for a Linux host with the arch matching the machine on which the tests are running. So on an M-series Mac, the tripleaarch64-unknown-linux-gnu
is used. Or on an Intel Mac or PC, thenx86_64-unknown-linux-gnu
is used as the--host
triple.I do have a few thoughts/questions:
-linux-x86_64
-linux-aarch64
-macos
-all