-
Notifications
You must be signed in to change notification settings - Fork 55
Add reusable action for MSVC + Win SDK overrides #956
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
base: main
Are you sure you want to change the base?
Conversation
This introduces a new reusable action, `setup-build`, which will eventually replace all of the custom installation steps in the swift-build jobs. Currently it only supports providing explicit versions for MSVC and the Windows SDK. This also adds tests for the `setup-build` action, with a configurable runner, ensuring we can catch issues early as runner images get updated.
description: Sets up the build environment for the current job | ||
|
||
inputs: | ||
windows-sdk-version: |
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.
Any reason to prefix the options with windows-
?
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.
This is going to be expanded to also add sccache and cmake, which are cross-platforms. I intend to reduce the number of if:
in the swift workflow.
However, I did rename the msvc-version
input, since Windows is implied there.
description: The Windows MSVC version to use, e.g. "14.42" | ||
required: false | ||
type: string | ||
setup-vs-dev-env: |
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.
Especially since this is also Windows specific
id: verify-input | ||
shell: pwsh | ||
run: | | ||
if ($IsWindows) { |
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.
Where is $IsWindows
defined?
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.
It's an automatic variable set up by pwsh. I was looking for something better to use to differentiate between Windows/macOS/Other. Unfortunately, the only other option I found is [environment]::OSVersion.Platform
, which is set to Unix
on MacOS.
$MajorVersion = $WinMsvcVersion.Major | ||
$MinorVersion = $WinMsvcVersion.Minor | ||
$BuildVersion = 17 | ||
$RevisionVersion = $MinorVersion - 30 |
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.
What is this based on?
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.
14.29.16.11 was the last VS16 toolchain version.
14.30.17.0 was the first VS17 toolchain version.
14.31.17.1 was the second VS17 toolchain version.
Etc.
Basically, the first toolchain that shipped with VS17 was 14.30 and the revision number is based on that. I added a comment to explain that.
You can find the package names here. Note that counterintuitively, while the build tools version is 14.42, the compiler itself has version 19.42.
Point is, we can't have nice things.
$WinMsvcVersion = [System.Version]::Parse($WinMsvcVersionString) | ||
$MajorVersion = $WinMsvcVersion.Major | ||
$MinorVersion = $WinMsvcVersion.Minor | ||
$BuildVersion = 17 |
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.
Why hardcoded to VS17? (2022)
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.
I am trying to avoid having to specify 2 versions: the MSVC build tools version and the package version, so I am computing the package version from the major.minor
build tools version.
To simplify things, I am only supporting VS17 here. I do not expect that we also want to support VS16 toolchains, but this will require updating once Microsoft releases VS18.
FYI, I am removing the |
This introduces a new reusable action,
setup-build
, which will eventually replace all of the custom installation steps in the swift-build jobs. Currently it only supports providing explicit versions for MSVC and the Windows SDK.This also adds tests for the
setup-build
action, with a configurable runner, ensuring we can catch issues early as runner images get updated.Bug: #821