Skip to content

Use Swift 5.4 for Windows job on GitHub Actions #89

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 3 commits into from
Sep 10, 2021
Merged

Use Swift 5.4 for Windows job on GitHub Actions #89

merged 3 commits into from
Sep 10, 2021

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Sep 3, 2021

I've updated the Windows job on GitHub Actions to use a release build of Swift 5.4, and also updated the dependency in Package.swift and Package.resolved.

Additionally, all GitHub Actions triggers were updated to prevent jobs from running twice on pull requests created from branches in the same repositories.

@google-cla
Copy link

google-cla bot commented Sep 3, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@MaxDesiatov
Copy link
Contributor Author

@googlebot I signed it!

@MaxDesiatov
Copy link
Contributor Author

@compnerd would you have a moment to have a look?

Comment on lines 5 to 6
pull_request:
branches: "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be needed

Suggested change
pull_request:
branches: "*"
pull_request:

Comment on lines 5 to 6
pull_request:
branches: "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pull_request:
branches: "*"
pull_request:

Comment on lines 5 to 6
pull_request:
branches: "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pull_request:
branches: "*"
pull_request:

Package.swift Outdated
@@ -24,7 +24,7 @@ let package = Package(
targets: ["Benchmark"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.0.1"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.4.4"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you split this out into a separate change please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looked like old version of SAP could fail to build with Swift 5.4 on Windows for some reason. But I've reverted the update in Package.swift and Package.resolved for now as you've requested. Curious to see if CI passes on Windows without updating the SAP dependency. Could you approve it for another CI run? I'm not able to trigger it with a sole push.

@MaxDesiatov MaxDesiatov changed the title Use Swift 5.4 for Windows job on GitHub Actions, update SAP Use Swift 5.4 for Windows job on GitHub Actions Sep 5, 2021
@MaxDesiatov MaxDesiatov requested a review from compnerd September 5, 2021 16:17
@compnerd
Copy link
Contributor

compnerd commented Sep 6, 2021

Ah, I wonder if its the MSVCRT -> CRT renaming that you are referring to. I think that we could just do something like:

#if os(Windows)
#if canImport(CRT)
import CRT
#else
import MSVCRT
#endif
#endif

@MaxDesiatov
Copy link
Contributor Author

MaxDesiatov commented Sep 6, 2021

As far as I understand, this was fixed in the latest version of SAP, the current locked version fails to build on Windows with these kind of errors:

swift-argument-parser\Sources\ArgumentParser\Usage\HelpGenerator.swift:299:13: error: cannot find type 'CONSOLE_SCREEN_BUFFER_INFO' in scope

Would you like me to bring back the SAP update to this PR to fix that?

@MaxDesiatov
Copy link
Contributor Author

I've confirmed in my fork https://github.com/MaxDesiatov/swift-benchmark/pull/2 that it won't build with the old snapshot currently used in this repository.
I've created a separate PR on this repo for SAP update, just in case. But that will fail too, as it did in my fork. #90

So I think that SAP update and CI update to Swift 5.4 should be included in this same PR for CI to be all green, unless I'm missing something?

@compnerd
Copy link
Contributor

compnerd commented Sep 6, 2021

It can be made to work - s-a-p uses canImport to import CRT without the fallback for MSVCRT and that changed in the 5.4 release. I suppose that its not worth the effort to split out the changes, but in general, it is preferable to stage the versions before bumping the release IMO.

@MaxDesiatov
Copy link
Contributor Author

MaxDesiatov commented Sep 7, 2021

it is preferable to stage the versions before bumping the release IMO.

I totally agree, but I'm still a bit confused as to how to land these two changes in separate PRs and to keep their respective CI status green at the same time. For now I'm bringing back the update to s-a-p version, but keeping it as a separate commit. That would preserve the separation after merge if you don't squash it. Ready for review and a CI run.

@compnerd
Copy link
Contributor

I was thinking that we could inject a CRT module that just does @_exported import MSVCRT. But again, I'm not too happy with that either. Sorry for the churn here. I think that the original idea of just bumping it together is fine.

@compnerd compnerd merged commit a0564bf into google:main Sep 10, 2021
@MaxDesiatov MaxDesiatov deleted the swift-5.4-windows branch September 10, 2021 17:09
@MaxDesiatov
Copy link
Contributor Author

Thanks! Would it be possible to tag a new version so that other libraries targeting Windows could depend on that instead of the main branch?

@MaxDesiatov
Copy link
Contributor Author

@regexident I see you've tagged the previous release, would you be able to tag a new one with this change included?

@regexident
Copy link
Contributor

@MaxDesiatov I did? On mobile right now so can't check, but I doubt it since I'm just a random contributor like you. 😄

@MaxDesiatov
Copy link
Contributor Author

Well, this is weird...

Screenshot 2021-09-18 at 14 54 44

@compnerd
Copy link
Contributor

@MaxDesiatov I've tagged 0.1.1; I didn't see a reason for any thing bigger in terms of a version bump, the only change was for newer Swift releases on WIndows.

@MaxDesiatov
Copy link
Contributor Author

Fantastic, thanks! 0.1.1 works perfectly fine for this 👍

@regexident
Copy link
Contributor

Oh, interesting. I stand corrected then. 😅

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.

3 participants