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

Use dotnet image for godot 4 #106

Merged
merged 20 commits into from
Mar 7, 2025

Conversation

AdrasteonDev
Copy link
Contributor

This pull request allows to use the .NET Docker image instead of the mono image for Godot 4 (the mono image is still used for Godot 3). It is related to #80 (it adds the possibility to use the dotnet command for Godot 4).

As long as there is currently no godot-ci image for Godot 4 on Docker Hub, it will not break existing CI pipelines for Godot 4.

I decided to use "dotnet/sdk:6.0-focal" because I could not install "python-openssl" with the "bullseye-slim" version (and because focal is also used in the dockerfile of the non-mono version of Godot).

I also added a few comments in the YAML files related to Godot 4, and I corrected a bug in mono.Dockerfile.

I made sample projects to be sure that the images are usable for CI:

I verified that the Linux and Windows executables created by the CI pipelines of these projects run correctly.

Let me know if you have any comments or suggestions about this pull request.

@MSchmoecker
Copy link

I can confirm this works for Windows builds, Linux also built but I did not run the executable.
MacOS resulted in an empty zip and the Web export is not yet supported by Godot 4.0.2, see here godotengine/godot#70796

For anyone who wants a quick summary of the needed changes for this PR:

@AdrasteonDev
Copy link
Contributor Author

Thank you for this first review.

With the Godot 4 image, it is also required to use --export "macOS" instead of --export "Mac OSX". I added a comment about that in .gitlab-ci.yml and godot-ci.yml.
I suppose the empty zip you got with macOS is due to that.

@Calinou Calinou added bug Something isn't working enhancement New feature or request labels Apr 29, 2023
@MSchmoecker
Copy link

MSchmoecker commented Apr 29, 2023

The export target was already changed to macOS.
But after comparing everything with your example project, it turns out codesign/entitlements/disable_library_validation=true must be set in the export_presets.cfg. It is false by default when creating the export present inside Godot.

@AdrasteonDev
Copy link
Contributor Author

I merged the Gitlab CI file following #107 and #108. I will see if I need to add commits to adapt the code of the mono version following these PR

@AdrasteonDev
Copy link
Contributor Author

I added a commit to use the jammy .NET image (to match the ubuntu version used in Dockerfile following #107 and #108).

I also made modifications in these test repositories:

I tested the macOS executables: it works (for Godot 3 and 4)

@AdrasteonDev
Copy link
Contributor Author

Do you know if it will be possible to see this PR merged before the release of Godot 4.1 ? Perhaps I need to wait a little longer for the changes to be verified ?

@pcen
Copy link

pcen commented Jun 28, 2023

Ran into what I believe is this issue trying to use the image adrasteondev/godot-ci:mono-4.0.3.

Running in a github ci workflow with something like:

jobs:
  test-dotnet:
    name: Test Dotnet
    runs-on: ubuntu-20.04
    container:
      image: adrasteondev/godot-ci:mono-4.0.3
    steps:
      - name: Check Version
        run: |
            /usr/share/dotnet --version

Fails with /usr/share/dotnet: Permission denied. Attempting to invoke dotnet gives a dotnet not found error. It would be useful to be able to invoke dotnet commands in the container in order to build and run C# tests in CI.

@AdrasteonDev
Copy link
Contributor Author

AdrasteonDev commented Jul 16, 2023

Thank you for the test.

Two problems prevented your job from working correctly:

  • The dotnet image is based on Ubuntu 22.04 (not Ubuntu 20.04)
  • The dotnet command should be used directly (not /usr/share/dotnet)

You can check this repository for a working example.

I have also

  • added comments in godot-ci.yml about the Ubuntu version for Godot 4
  • created two Gitlab repositories to test the use of the dotnet command with my docker image

@davidschreiber
Copy link

davidschreiber commented Sep 18, 2023

I'm curious: What is the state of this PR? Is any help required to put this ahead? Since Godot 4.1.1 is already available, is it reasonable to update this PR to the latest stable?

@AdrasteonDev
Copy link
Contributor Author

The PR is ready to be merged if maintainers agree. I don't think it's necessary to update the PR.

If necessary you can temporarily use the image I built myself to test this PR: https://hub.docker.com/r/adrasteondev/godot-ci/tags

@liperium
Copy link

Why isn't this merged? Csharp+github is really not plug and play right now. Been fiddling with it for a couple of hours, don't even have the solution yet. ( let's hope this is it )

@gdomjan83
Copy link

gdomjan83 commented Nov 27, 2023

@AdrasteonDev AdrasteonDev
Hi. I've been using your adrasteondev/godot-ci:mono-4.1.2 docker image for running a gitlab pipeline and it works perfectly.
I'm trying to learn how to make a docker image for godot mono exports, would you mind sharing the dockerfile for that docker image?

Barichello/godot-ci image, which yours is based on has a dockerfile available, but after I tried it, it seems to me it is not working properly.

@AdrasteonDev
Copy link
Contributor Author

@AdrasteonDev AdrasteonDev Hi. I've been using your adrasteondev/godot-ci:mono-4.1.2 docker image for running a gitlab pipeline and it works perfectly. I'm trying to learn how to make a docker image for godot mono exports, would you mind sharing the dockerfile for that docker image?

Hi ! Good to see my image is useful :)

You can find it here.

You can also look at the "build-mono" job in this CI file (the variables used by the Dockerfile are defined here).

@gdomjan83
Copy link

@AdrasteonDev AdrasteonDev Hi. I've been using your adrasteondev/godot-ci:mono-4.1.2 docker image for running a gitlab pipeline and it works perfectly. I'm trying to learn how to make a docker image for godot mono exports, would you mind sharing the dockerfile for that docker image?

Hi ! Good to see my image is useful :)

You can find it here.

You can also look at the "build-mono" job in this CI file (the variables used by the Dockerfile are defined here).

Thank you, I will give it a spin. :)

@ineffyble
Copy link

I have ended up having to fork from @AdrasteonDev's fork to get things working, as my pipeline needed the dotnet image and latest Godot version. If this change be brought in it would be very helpful 🙂

@AdrasteonDev
Copy link
Contributor Author

I've updated my code by getting the latest changes from the master branch and reproducing some of the changes you made in your fork.

For the download link, I'll get the code from the master branch once #168 has been merged.

Calinou

This comment was marked as outdated.

@Calinou
Copy link
Collaborator

Calinou commented Mar 7, 2025

Some things surprise me in this PR:

  • mono.Dockerfile still uses mono:latest by default, despite the PR title saying it switches over to the .NET image.
    • mono:latest is based on Debian buster (currently oldoldstable), which means we can't install openjdk-17-jdk-headless. The latest version available in Debian buster is OpenJDK 11, which is too old.
  • ubuntu:20.04 is still used in GitHub Actions, but it's EOL very soon. We should use ubuntu:22.04 at least, preferably ubuntu:24.04 as we don't compile Linux binaries on it (and therefore don't have to worry about Linux binary compatibility).

@kfechter
Copy link
Contributor

kfechter commented Mar 7, 2025

Working on a fix for this. Updated the mono.Dockerfile in my fork to use ubuntu:22.04 as the base image, and have it building, iI just need to set up a repo on my CI system to test that image to make sure the end to end building works for mono projects.

@kfechter
Copy link
Contributor

kfechter commented Mar 7, 2025

I'm going to open a new PR for my changes, but I have the ubuntu 22.04 container building, and my CI pipeline using the container successfully builds Windows, macOS, Linux, and Android binaries. Tested the Linux, Windows, and Android binaries and they run, macOS export zip has contents, but I don't own a mac to test the builds so I sent them over to a friend with a Mac to test (waiting on response)

Web still isn't supported in the .NET builds. looks like iOS Build support requires a mac, so my CI system won't be able to do it.

Replace default image with dotnet image
Replace ubuntu-20.04 with ubuntu-22.04
Replace ubuntu-20.04 with ubuntu-22.04
Replace ubuntu-20.04 with ubuntu-22.04
@AdrasteonDev
Copy link
Contributor Author

AdrasteonDev commented Mar 7, 2025

I reused existing ubuntu versions, and left the default value at mono:latest to have few changes from the master branch.

But since you'd like to see these changes, I've replaced mono:latest with the dotnet 8 image by default, and Ubuntu 20.04 with 22.04 (I was not sure which jobs can be upgraded to 24.04, but I'd rather not think about it, as I've only got a little free time this weekend).

I let you decide whether to merge my PR or kfechter's future PR.

It would probably be a good idea to keep my job that defines the dotnet image to use (to keep Godot 3 and Godot < 4.4 compatibility).

Copy link
Collaborator

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Thanks!

@Calinou Calinou merged commit f0c2986 into abarichello:master Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants