Skip to content

Conversation

@jrflat
Copy link
Contributor

@jrflat jrflat commented Jul 30, 2025

This PR adds linux-static-sdk-build and wasm-sdk-build jobs to the swift_package_test.yml workflow. These jobs use a new script install-and-build-with-sdk.sh that finds the latest Linux static or Wasm SDKs for the given Swift version, downloads a matching toolchain if needed, and runs <swift-executable> build --swift-sdk <sdk-name> <flags>.

The script is called with the following parameters

bash ./install-and-build-with-sdk.sh [--static] [--wasm] [--flags="<build-flags>"] <swift-version>

such as

bash ./install-and-build-with-sdk.sh --static --flags="--verbose" nightly-6.2

The swift_package_test.yml workflow includes new inputs:

  • enable_linux_static_sdk_build: boolean (default: false)
  • linux_static_sdk_versions: string (default: "[\"nightly-6.2\"]")
  • linux_static_sdk_pre_build_command: string (default: "")
  • enable_wasm_sdk_build: boolean (default: false)
  • wasm_sdk_versions: string (default: "[\"nightly-6.2\"]")
  • wasm_sdk_pre_build_command: string (default: "")

The jobs run on a Ubuntu container with the provided Swift version to maximize the chance that the installed toolchain snapshot will match the static or Wasm SDK snapshot. However, even if they don't match, the script will find and download the correct toolchain and use the correct Swift executable in the build command. For instance, I tested a variety of versions like 6.0, 6.1, and nightly-6.2 on a container with a Swift main snapshot, and the script downloads and uses the respective 6.0, 6.1, and nightly-6.2 toolchains to build.

Note that inputting an older Swift version where the corresponding SDK isn't available, such as wasm_sdk_versions: "[\"6.0\"]", will still result in an error.

@jrflat jrflat requested a review from a team as a code owner July 30, 2025 18:17
@shahmishal
Copy link
Member

Thank you for adding support for static sdk, can you please add a check in https://github.com/swiftlang/github-workflows/blob/main/.github/workflows/pull_request.yml to make sure we don't regress the static sdk check in the future.

@jrflat
Copy link
Contributor Author

jrflat commented Jul 30, 2025

Yes will do. I think I'll also add support for more Swift versions, so we could also test with the 6.1 release static SDK, etc. if desired

@jrflat jrflat changed the title Add workflow for Linux static SDK build Add workflow for Linux static SDK and Wasm SDK builds Aug 1, 2025
@jrflat jrflat changed the title Add workflow for Linux static SDK and Wasm SDK builds Add workflows for Linux static SDK and Wasm SDK builds Aug 1, 2025
@jrflat jrflat force-pushed the linux-static-sdk-build branch from e99b1d9 to 47757d7 Compare August 1, 2025 16:54
@jrflat jrflat changed the title Add workflows for Linux static SDK and Wasm SDK builds Add jobs for Linux static SDK and Wasm SDK builds Aug 1, 2025
run: |
${{ inputs.linux_static_sdk_pre_build_command }}
which curl || (apt -q update && apt -yq install curl)
curl -s --retry 3 https://raw.githubusercontent.com/jrflat/github-workflows/refs/heads/linux-static-sdk-build/.github/workflows/scripts/install-and-build-with-sdk.sh | \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will change this to swiftlang/github-workflows/refs/heads/main before merging, but I wanted to get testing in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 85552f9

enable_windows_docker: true
# TODO: jflat - Remove after PR testing
linux_static_sdk_versions: "[\"6.0\", \"6.1\", \"nightly-main\", \"nightly-6.2\"]"
wasm_sdk_versions: "[\"nightly-main\", \"nightly-6.2\"]"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove these before merging so that only the default versions (nightly-6.2) are tested, but I wanted to get more extended coverage when testing this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in 85552f9

@jrflat
Copy link
Contributor Author

jrflat commented Aug 1, 2025

Seems like #140 should prevent the Xcode 16.0 and 16.1 failures (by removing them).

@jrflat
Copy link
Contributor Author

jrflat commented Aug 1, 2025

Updated the script URL to point to swiftlang:main branch instead of jrflat:linux-static-sdk-build to prepare for merge. The jobs are failing on this PR but will pass in future PRs once the script is merged.

Passing tests from the previous commit for reference: https://github.com/swiftlang/github-workflows/pull/142/checks?sha=47757d7ea31678a1e11791bf5a9fd248659508c5

@jrflat
Copy link
Contributor Author

jrflat commented Aug 1, 2025

@shahmishal if the above merge strategy sounds good to you would you mind merging this?

Another option could be to merge the script first, and then enable the PR tests separately, but I figured it would be easier to do it in one go.

@shahmishal shahmishal merged commit 1dac9d5 into swiftlang:main Aug 1, 2025
36 of 38 checks passed
@shahmishal
Copy link
Member

thanks!

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.

2 participants