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

Provide support for Godot 4 #104

Merged
merged 2 commits into from
Mar 15, 2023
Merged

Conversation

BjoernAkAManf
Copy link
Contributor

Godot 4 is still in beta, but there are some changes that will be in Effect in the Future.

In particular this change is backwards compatible to the existing workflows. In particular linux_headless has been sunset and replaced by the regular linux distribution (linux.x86_64). To run Godot in a headless context, it is now necessary to specify the display-driver to be "headless".

With this change a Workflow can be created for the beta releases of Godot.

The following Workflow File (it's based on the official one) can be used to create an image on ghcr.io now (without this PR).
If you want i can also contribute the changes to the release workflow, so once godot4 has been released, the images can be created automatically:

All in all thanks for creating this container image. Has been a blast in the past already.

name: build

env:
  IMAGE_NAME: godot-ci

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version of engine to build e.g. "3.4.4", "3.5"'
        required: true
        type: string

      release_name:
        description: 'Release name, usually "stable", but can also be something like "rc3", "beta1"'
        type: string
        default: "stable"
        required: true

      godot_platform:
        description: 'Name of the Platform to download. For Godot 3.X this is linux_headless.64, while for Godot 4 it is linux.x86_64'
        type: string
        default: "linux.x86_64"
        required: true

      godot_args:
        description: 'Appends additional arguments to the Godot invocation running the container running. This allows to specify the display driver in Godot 4+. Otherwise empty'
        type: string
        default: "--display-driver headless"
        required: true


jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          repository: abarichello/godot-ci

      - name: 'Fork: Add fix for Godot 4'
        run: |
          REPLACE_NEEDLE=linux_headless.64
          sed -i 's/'${REPLACE_NEEDLE}'/${GODOT_PLATFORM}/g' Dockerfile
          sed -i 's/RUN godot -e -q/RUN godot -e -q ${GODOT_TEST_ARGS}/g' Dockerfile
          sed -i '/ARG SUBDIR=""/a ARG GODOT_PLATFORM="'${REPLACE_NEEDLE}'"' Dockerfile
          sed -i '/ARG SUBDIR=""/a ARG GODOT_TEST_ARGS=""' Dockerfile

      - run:  echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v1.14.1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - run:  echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV

      - name: Build and push Docker images
        uses: docker/build-push-action@v2.9.0
        with:
          context: .
          file: Dockerfile
          push: true
          tags: |
            ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
          build-args: |
            GODOT_VERSION=${{ github.event.inputs.version }}
            RELEASE_NAME=${{ github.event.inputs.release_name }}
            SUBDIR=${{  github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }}
            GODOT_PLATFORM=${{ github.event.inputs.godot_platform }}
            GODOT_TEST_ARGS=${{ github.event.inputs.godot_args }}

Godot 4 is still in beta, but there are some changes that will be in Effect in the Future.

In particular this change is backwards compatible to the existing workflows.
In particular linux_headless has been sunset and replaced by the regular linux distribution (linux.x86_64).
To run Godot in a headless context, it is now necessary to specify the display-driver to be "headless".

With this change a Workflow can be created for the beta releases of Godot.
@Calinou Calinou added the enhancement New feature or request label Jan 24, 2023
Godot renamed the templates folder.
Adds a Symbolic Link to support both without any overhead

See godotengine/godot#63093
@BjoernAkAManf
Copy link
Contributor Author

Another example:

when using the above mentioned Workflow to create a package (e.g. ghcr.io/bjoernakamanf/godot-ci:4.0.beta14 * )
docker run --rm -it -w /game -v $(pwd):/game ghcr.io/bjoernakamanf/godot-ci:4.0.beta14 godot --display-driver headless --export-release "Windows Desktop"

  • i could make that public if there is demand for that. Though i don't plan to support any of the images beyond my own usage. (latest beta, export for Windows, Linux, Web, maybe MacOS)

@teekennedy
Copy link

teekennedy commented Feb 28, 2023

Thanks for getting this working @BjoernAkAManf ! I tried the workflow file from your comment against 4.0 rc5 and it mostly works, but the part of the Dockerfile that runs godot -e -q --display-driver headless (using the default godot_args input) never exits. I suspect that it's continuing to run in server mode.

I got it to work by setting godot_args to --headless --quit. --quit tells Godot to quit after its first iteration, and --headless is a shortcut for --display-driver headless --audio-driver Dummy.

@realkotob
Copy link
Collaborator

realkotob commented Mar 2, 2023

Support for Godot 4.0 was added as a release tag yesterday. 🎉

@realkotob realkotob closed this Mar 2, 2023
@Brawmario Brawmario mentioned this pull request Mar 2, 2023
@Brawmario
Copy link

The changes here are still relevant, the current release of Godot CI 4.0 failed!

@realkotob realkotob reopened this Mar 2, 2023
@realkotob
Copy link
Collaborator

@Brawmario Good catch thanks!

@josefalanga
Copy link

merging this PR would make it work, or anything else in necessary?

@BjoernAkAManf
Copy link
Contributor Author

BjoernAkAManf commented Mar 4, 2023

merging this PR would make it work, or anything else in necessary?

Well yes. You'd need to run it with the appropiate arguments though, as i designed it in a way, that it is compatible with godot 3. Similar to @teekennedy 's comment.

2023-01-26T21:03:45.2449593Z build-args: GODOT_VERSION=4.0
RELEASE_NAME=beta15
SUBDIR=/beta15
GODOT_PLATFORM=linux.x86_64
GODOT_TEST_ARGS=--headless --quit

EDIT: Version 4 works as well:

2023-03-04T16:14:35.3741804Z build-args: GODOT_VERSION=4.0
RELEASE_NAME=stable
SUBDIR=
GODOT_PLATFORM=linux.x86_64
GODOT_TEST_ARGS=--headless --quit

@Calinou
Copy link
Collaborator

Calinou commented Mar 4, 2023

@realkotob Is this PR good to merge?

@realkotob
Copy link
Collaborator

realkotob commented Mar 15, 2023

Let's merge this and see if it needs further fixes. Thank you 🙏

@realkotob realkotob merged commit 90fcfe5 into abarichello:master Mar 15, 2023
@BjoernAkAManf BjoernAkAManf deleted the patch-1 branch March 15, 2023 17:42
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.

6 participants