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

Add Windows to CI matrix #83

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Add Windows to CI matrix #83

merged 2 commits into from
Jun 10, 2024

Conversation

martinling
Copy link
Member

@martinling martinling commented Jan 8, 2024

This PR adds Windows to the platforms Packetry is built and tested on in GitHub Actions.

This was a pain in the ass, that I have given up on multiple times in frustration, over the past several months.

The necessary dependencies are installed via vcpkg using the run-vcpkg action. This action requires specifying a specific commit of vcpkg. I have specified the commit ID for the 2024.05.24 release. There seems to be no way to make it always use the latest version. I also tried vcpkg-action, but was unable to get the GTK packages to build with it.

The PKG_CONFIG and PKG_CONFIG_PATH environment variables need to be set to point to files installed by vcpkg, so that the build system for the gtk-rs packages can find its dependencies when built with cargo. For binaries to be able to run, which is necessary for tests to pass, the PATH variable also needs to be updated so that the necessary DLLs are found from the vcpkg install.

It was difficult to find the correct way to set these variables and make them persist to the next step. I eventually found the necessary clue in this issue. The official documentation is completely useless here, as those instructions do not work on Windows runners.

The other difficulty was that run-vcpkg does not set any environment variable indicating where it has installed things to. It sets VCPKG_ROOT but this only refers to where it has checked out the vcpkg repository. The installation is placed somewhere completely different, with a random component in the path.

Eventually I resorted to using action-tmate to get a remote shell on a runner, from which I was able to figure out that run-vcpkg also sets VCPKG_DEFAULT_BINARY_CACHE, the path to which happens to be adjacent to the installation path. So the installation directory can be found at $env:VCPKG_DEFAULT_BINARY_CACHE/../vcpkg_installed/x64-windows.

Obvious, huh?

@martinling martinling force-pushed the windows-ci branch 10 times, most recently from 35636d2 to 1ac3ef7 Compare January 9, 2024 15:15
@martinling martinling force-pushed the windows-ci branch 8 times, most recently from 0eb7679 to 7878ec5 Compare May 21, 2024 14:11
@martinling martinling force-pushed the windows-ci branch 2 times, most recently from 6c8c69e to dd1a25a Compare June 9, 2024 17:32
@martinling martinling marked this pull request as ready for review June 9, 2024 23:15
Copy link
Member

@miek miek left a comment

Choose a reason for hiding this comment

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

🎉

@miek miek merged commit 8120c1e into main Jun 10, 2024
16 checks passed
@martinling martinling deleted the windows-ci branch July 15, 2024 16:14
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