Skip to content
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

Multiplatform worfklow with windows fix #149

Merged

Conversation

mikehardy
Copy link
Contributor

This PR should supercede both of these:

I developed this on my fork with the patch from @voczi from #147 as a starting point, picked into a branch where I worked on the workflow.

I made a PR into my fork's main branch to run CI (over and over and over) until I was sure I had it working

Test run showing success: https://github.com/mikehardy/keeper/actions/runs/9686107630

There is nothing fancy about the windows fix itself, it's standard Path.separator() and System.lineSeparator() stuff - exactly as you would expect

There are two fancy things about the workflow / test fixes:

  • zip doesn't work on windows so the build reports artifact uses path declarations in the upload-artifact action instead of a find/zip-then-upload style
  • toolchain doesn't work well on windows (I left a comment with reference to upstream issue) so for the test we cannot use gradle toolchain or it fails on windows

End result of all the work is that keeper will run on windows, will be verified working on windows in CI, and as a bonus you'll have your emulator tests hardware accelerated

Cheers

it.absolutePath
.removePrefix(prefix)
.removePrefix(File.separator)
.replace(File.separator, "/") to it
Copy link
Collaborator

Choose a reason for hiding this comment

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

I asked about this on the other PR too, but this seems counterintuitive to me. Isn't the "/" character the problematic one? If so, why are we adding it back manually here? Or is it because this is a zip and we need to force it to always use "/" regardless of the source OS?

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's the latter I believe - because it's a zip

Though, I haven't tested it, I could play around with different versions of it to see conclusively but not today

The testing around this is ace now though - that was a bear!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh wait, found it. zip specification

https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

item 4.4.17.1


   4.4.17 file name: (Variable)

       4.4.17.1 The name of the file, with optional relative path.
       The path stored MUST NOT contain a drive or
       device letter, or a leading slash.  All slashes
       MUST be forward slashes '/' as opposed to
       backwards slashes '\' for compatibility with Amiga
       and UNIX file systems etc.  If input came from standard
       input, there is no file name field.  

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ZacSweers any code that causes persistent doubts yet is based on a specification deserves a good comment, so this morning as I got moving again I took that specification chunk and sprinkled it as comments with specification reference in that code. Future maintainers will hopefully rejoice

@mikehardy mikehardy force-pushed the multiplatform-worfklow-with-windows-fix branch from 9d0b8b2 to 850db0a Compare June 27, 2024 13:32
on ubuntu-latest you must have /dev/kvm permissions for the runner
user in order for hardware acceleration in the emulator to work
@mikehardy mikehardy force-pushed the multiplatform-worfklow-with-windows-fix branch from 850db0a to 0e5fa76 Compare June 27, 2024 16:41
@mikehardy
Copy link
Contributor Author

Oh no!


Running test: Test extensionMarkerWarning(com.slack.keeper.KeeperFunctionalTest)

com.slack.keeper.KeeperFunctionalTest > extensionMarkerWarning FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at KeeperFunctionalTest.kt:263
Running test: Test extensionMarker(com.slack.keeper.KeeperFunctionalTest)

This is similar to what I battled through while working on it, where I discovered that the gradle toolchain didn't work. But I got it working in the CI actions on my fork and I also reproduced it locally and fixed it locally

Note to myself as I'll probably look at this later when I'm more tired: Running the plugin test with CI=true in front of gradle and --debug spec'd for gradle let's me see the errors then I can fix them.

Very strange it worked on my fork but failed here though. Sorry for the hassle, thought it was good to go

@mikehardy mikehardy force-pushed the multiplatform-worfklow-with-windows-fix branch from 0e5fa76 to 42bf43b Compare June 27, 2024 23:07
@mikehardy
Copy link
Contributor Author

mikehardy commented Jun 27, 2024

Easier than I thought, was a bad rebase as I added the zip spec comments, accidentally dropped the test fixes that were already reviewed and good 🤦. Also did a ./gradlew :spotlessApply

Re-added, re-pushed, CI running again here https://github.com/mikehardy/keeper/actions/runs/9704804942 --> ✅

Doesn't seem to want to auto-run here but it should go all-green again after the rebase fixup

@mikehardy mikehardy force-pushed the multiplatform-worfklow-with-windows-fix branch from 42bf43b to 300e123 Compare June 27, 2024 23:09
@ZacSweers ZacSweers merged commit 6783ba6 into slackhq:main Jun 28, 2024
14 checks passed
@ZacSweers
Copy link
Collaborator

Thanks!

@mikehardy
Copy link
Contributor Author

That PR was harder than expected!

First time I've ever worked on a gradle plugin, unexpectedly difficult to test but the test rig here is really good - it's just a tough chunk of the ecosystem to work on. Anyway, happy to help, keeper allowed us to test our app in release mode and we (where "we" is really @voczi :-) ) shrank our app from 43MB to 35MB and we've got a 3.5million devices that are going to be happy with that

Cheers

@mikehardy mikehardy deleted the multiplatform-worfklow-with-windows-fix branch June 28, 2024 11:26
@ZacSweers
Copy link
Collaborator

Awesome! I'll try to cut a release today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants