-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add support for newer Windows SDKs #72
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
==========================================
+ Coverage 91.00% 91.02% +0.02%
==========================================
Files 30 30
Lines 900 903 +3
Branches 122 125 +3
==========================================
+ Hits 819 822 +3
Misses 80 80
Partials 1 1
☔ View full report in Codecov by Sentry. |
The runner is Windows 10. Logic fixed. |
@soumyamahunt Can you help to build and push |
And is it necessary & how to test the Windows SDK version logic? |
You can run
yes for E2E test generated |
@@ -11,17 +11,18 @@ import {Installation} from './installation' | |||
|
|||
export class WindowsToolchainInstaller extends VerifyingToolchainInstaller<WindowsToolchainSnapshot> { | |||
private get vsRequirement() { | |||
const reccommended = '10.0.17763' | |||
const recommended = '10.0.19041' |
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 for this change? Swift.org mentions 10.0.17763
is the lowest version supported and I would like the action have maximum compatibility.
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.
IIRC Windows 10 SDK (10.0.17763) is the default of Visual Studio 2017, which is long outdated and has compatibility issues with even VS 2019. Official Swift toolchains and SDKs are actually built against the newest setup, which means Windows 11 SDK (10.0.22621) for Swift 5.9.
I actually think Windows 11 SDK (10.0.22000) is better since it’s the default of Visual Studio 2022, but 19041 is new enough for now.
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.
The current logic uses the grater SDK version between current platform and 10.0.17763
. So for Windows 11 version 10.0.22621
, that version SDK will be chosen but if action is used on a Windows version lesser than 10.0.17763
then SDK of 10.0.17763
will be used.
This variable should be the lowest SDK version supported by Swift, not the latest one. Otherwise action will download the SDK unnecessarily, when it can reuse pre-installed SDK version.
src/installer/windows/index.ts
Outdated
const version = semver.gte(current, reccommended) ? current : reccommended | ||
const winsdk = semver.patch(version) | ||
const version = semver.gte(current, recommended) ? current : recommended | ||
const winsdkMajor = semver.gte(version, '10.0.22000') ? semver.major(version) : 11 |
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.
There could be better way of writing this that works for future release of Windows, i.e. Windows 12
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.
Basically no one knows what version logic MS will use for Windows 12🤷 Maybe they’re going to stick to 10 as major version….
@@ -66,6 +67,7 @@ export class WindowsToolchainInstaller extends VerifyingToolchainInstaller<Windo | |||
} | |||
core.debug(`Swift installed at "${swiftPath}"`) | |||
const visualStudio = await VisualStudio.setup(this.vsRequirement) | |||
// FIXME(stevapple): This is no longer required for Swift 5.9+ |
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.
Are you planning to address this in current PR or in a future PR?
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.
A future PR I think. Needs to figure out how to pass the version around, so it might be a big fix.
I cannot access my computer in ~2hrs and now I’m using an iPad🤦
Is it possible to run |
Integration tests use The reason E2E works differently is because I wanted to add test for real-world usage. Unlike other GitHub actions, this action accesses files from If we go approach of generating
No need to hurry, anyway action works fine on current windows runners.
For now you can add unit-tests with mocking the OS, there is no way to test properly until GitHub adds Windows 11 runner. |
It turns out that there's no reliable way to Give up after literally trying all possible "safe" solutions. |
Not sure what you have tried, there are already tests that mock os, please refer here for example. Also please add setup-swift/.github/workflows/main.yml Line 236 in 5dfc518
setup-swift/.github/workflows/main.yml Lines 249 to 251 in 5dfc518
|
Mocking |
@@ -249,6 +249,9 @@ jobs: | |||
- os: windows-latest | |||
swift: '5.3' | |||
development: false | |||
- os: windows-2019 |
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.
please add windows-2019
with latest
swift as well
const winsdkMajor = semver.lt(version, '10.0.22000') | ||
? semver.major(version) | ||
: 11 | ||
const winsdkMinor = semver.patch(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.
please extract the windows major version logic to a separate function, it will be easier to update in future.
@@ -11,17 +11,18 @@ import {Installation} from './installation' | |||
|
|||
export class WindowsToolchainInstaller extends VerifyingToolchainInstaller<WindowsToolchainSnapshot> { | |||
private get vsRequirement() { | |||
const reccommended = '10.0.17763' | |||
const recommended = '10.0.19041' |
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.
The current logic uses the grater SDK version between current platform and 10.0.17763
. So for Windows 11 version 10.0.22621
, that version SDK will be chosen but if action is used on a Windows version lesser than 10.0.17763
then SDK of 10.0.17763
will be used.
This variable should be the lowest SDK version supported by Swift, not the latest one. Otherwise action will download the SDK unnecessarily, when it can reuse pre-installed SDK version.
@stevapple can you rebase this PR, I am thinking of adding this as part of next release. |
I may need some more time to look at previous discussions and try to handle these more elegantly. Thanks for getting this back to me😂 |
dist/index.js
;This requires a SemVer minor release.