Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andPKG_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, thePATH
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 setsVCPKG_ROOT
but this only refers to where it has checked out thevcpkg
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 setsVCPKG_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?