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

CI: Cross-compile Windows build with mingw #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

unvermuthet
Copy link
Contributor

@unvermuthet unvermuthet commented Mar 5, 2025

Currently the setup-godot-cpp actions install MinGW but then the scons command doesn't have use_mingw=yes set. This seems like a waste of time. At the last meeting we agreed that it would be a better idea to switch from MSVC to MinGW since binaries are said to have better performance and Link Time Optimizations can be enabled.

Just use_mingw=yes works but with lto=auto it fails.. Can someone diagnose this?
https://github.com/unvermuthet/godot-cpp-template/actions/runs/13672331130/job/38225569652

This can be fixed by cross-compiling on ubuntu-22.04. There the LTO works.

@paddy-exe paddy-exe added the enhancement New feature or request label Mar 5, 2025
@dsnopek
Copy link
Contributor

dsnopek commented Mar 5, 2025

I personally think switching to cross-compiling is acceptable. It may even run faster on CI.

@unvermuthet
Copy link
Contributor Author

Let's get some more input on this. In the meeting someone suggested that cross-compiling would not play well with running tests for Windows. Was that Enetheru? I didn't quite understand it.

@dsnopek
Copy link
Contributor

dsnopek commented Mar 5, 2025

Oh, I suppose if you wanted to run the Windows build in some automated tests, you'd need to be on a Windows runner to do that. But there's no reason you can't cross-compile for Windows, and then if you want to do tests, have a follow-up job that downloads the artifacts and runs them

@unvermuthet
Copy link
Contributor Author

That's what I do for my project. There is a test job that downloads the merged build artifact, downloads Godot and runs GUT integration tests (Does anyone know of an existing action for this?). You would have to do this on a separate matrix because of the cross-compilation, so that you can actually set windows-latest as the runner os, but I doubt that you'd wanna test every build that's made so a separate smaller matrix sounds reasonable.

@Ivorforce
Copy link
Contributor

That's what I do for my project. There is a test job that downloads the merged build artifact, downloads Godot and runs GUT integration tests (Does anyone know of an existing action for this?)

I'm using the action abarichello/godot-ci for this. I haven't used GUT but I'm imagining it would be possible to run unit tests with a CLI command from there.

It might be worth it to expand the template with at least some boilerplate for this if we go for cross-compilation, but that can be done in another PR.

@unvermuthet
Copy link
Contributor Author

Well right now there is no boilerplate for testing at all, right? It's really good to have for extension development. But I could also see it as bloat for people trying to make their game logic, and could be considered out of scope for CI on this.

What do you imagine under boilerplate?

@@ -61,6 +61,7 @@ jobs:
with:
platform: ${{ matrix.target.platform }}
em-version: 3.1.62
mingw-version: "" # Use package manager default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The input's default (12.2.0) is not available on Ubuntu 22.04. Empty string causes setup-mingw to use the package manager default.

@Ivorforce
Copy link
Contributor

could be considered out of scope for CI on this.

Yep, let's postpone that for another PR. It doesn't have to be added now :)

What do you imagine under boilerplate?

I was imagining a short "unit test" per dev OS that runs after the builds run, just one that runs godot and checks if a certain scene crashes. But arguably that's out of scope for godot-cpp-template. Either way should be separately discussed.

@unvermuthet
Copy link
Contributor Author

It's now successfully cross-compiling Windows builds on Ubuntu

@unvermuthet unvermuthet marked this pull request as ready for review March 5, 2025 20:52
@unvermuthet unvermuthet changed the title CI: Use MinGW for Windows builds CI: Cross-compile Windows build with mingw Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants