Skip to content

Commit 976845a

Browse files
committed
GitHub Actions: Test project exporting on CI
This allows finding issues in headless project export early on, including when exporting for a dedicated server. We also use this opportunity to check whether the audiovisual output between the project being run from its files and the exported PCK matches (it should always be a perfect match, assuming the same GPU is used for both runs). This can be used to catch audiovisual discrepancies, which could indicate a bug in the export process.
1 parent 2d113cc commit 976845a

File tree

110 files changed

+2852
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2852
-1
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Export Godot project
2+
description: Export a test Godot project.
3+
4+
inputs:
5+
bin:
6+
description: The path to the Godot executable
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Build test GDExtension
13+
shell: sh
14+
run: |
15+
git clone --depth=1 https://github.com/godotengine/godot-cpp.git misc/test_project/addons/test_extension/src/godot-cpp
16+
scons target=template_debug
17+
scons target=template_release
18+
19+
- name: Import resources and export project
20+
shell: sh
21+
run: |
22+
23+
echo "Exporting project for Linux (PCK)"
24+
xvfb-run ${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux" /tmp/test_project.pck 2>&1 | tee log.txt || true
25+
misc/scripts/check_ci_log.py log.txt
26+
27+
echo "Exporting project for Linux (ZIP)"
28+
xvfb-run ${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux" /tmp/test_project.zip 2>&1 | tee log.txt || true
29+
misc/scripts/check_ci_log.py log.txt
30+
31+
echo "Exporting project for Linux as dedicated server (PCK)"
32+
xvfb-run ${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux Server" /tmp/test_project_server.pck 2>&1 | tee log.txt || true
33+
misc/scripts/check_ci_log.py log.txt
34+
35+
- name: Run project files from folder
36+
shell: sh
37+
run: |
38+
xvfb-run ${{ inputs.bin }} --path misc/test_project/ --audio-driver Dummy --write-movie /tmp/test_project_folder.png --quit
39+
# FIXME: Not checked currently, as leaked resources on exit cause CI failures.
40+
# misc/scripts/check_ci_log.py log.txt
41+
42+
xvfb-run ${{ inputs.bin }} --path misc/test_project/ --headless --quit
43+
44+
- name: Run exported project PCK/ZIP
45+
shell: sh
46+
run: |
47+
xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.pck --audio-driver Dummy --write-movie /tmp/test_project_pck.png --quit
48+
# FIXME: Not checked currently, as leaked resources on exit cause CI failures.
49+
# misc/scripts/check_ci_log.py log.txt
50+
51+
xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.zip --audio-driver Dummy --write-movie /tmp/test_project_zip.png --quit
52+
53+
# Headless mode is implied for dedicated server PCKs.
54+
xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project_server.pck --quit
55+
56+
echo "Checking whether video output from project folder and exported project match..."
57+
md5sum /tmp/test_project*.png | md5sum --check
58+
59+
echo "Checking whether audio output from project folder and exported project match..."
60+
md5sum /tmp/test_project*.wav | md5sum --check

.github/workflows/linux_builds.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
build-mono: true
3333
doc-test: true
3434
proj-conv: true
35+
proj-export: true
3536
api-compat: true
3637
artifact: true
3738
# Validate godot-cpp compatibility on one arbitrary editor build.
@@ -112,7 +113,7 @@ jobs:
112113
submodules: recursive
113114

114115
- name: Linux dependencies for tests
115-
if: matrix.proj-test
116+
if: matrix.proj-test || matrix.proj-export
116117
run: |
117118
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
118119
sudo apt-get install mesa-vulkan-drivers
@@ -250,6 +251,13 @@ jobs:
250251
with:
251252
bin: ${{ matrix.bin }}
252253

254+
# Test project export
255+
- name: Test project export
256+
uses: ./.github/actions/godot-project-export
257+
if: matrix.proj-export
258+
with:
259+
bin: ${{ matrix.bin }}
260+
253261
# Test the project converter
254262
- name: Test project converter
255263
uses: ./.github/actions/godot-converter-test

misc/test_project/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.dblite
2+
3+
# Ignore the submodule so we don't add it to version control.
4+
# We clone it on CI when needed instead.
5+
addons/test_extension/src/godot-cpp

misc/test_project/SConstruct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python
2+
3+
# ruff: noqa: F821
4+
5+
# This file is for building as a Godot GDExtension.
6+
SConscript("addons/test_extension/SConstruct")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# GDExtension generated files
2+
*.gen.*
3+
.sconsign*.dblite
4+
bin/
5+
compile_commands.json
6+
src/gen/
7+
8+
# Compiled files
9+
*.bc
10+
*.creator
11+
*.creator.user
12+
*.dblite
13+
*.exp
14+
*.files
15+
*.idb
16+
*.includes
17+
*.lib
18+
*.o
19+
*.os
20+
*.pdb
21+
*.pyc
22+
*.so
23+
*.obj
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python
2+
3+
# ruff: noqa: F821
4+
5+
# This file is for building as a Godot GDExtension.
6+
7+
env = SConscript("src/godot-cpp/SConstruct")
8+
9+
# Add source files.
10+
env.Append(CPPPATH=["src/"])
11+
sources = Glob("src/*.cpp")
12+
13+
env.Append(CPPDEFINES=["GDEXTENSION"])
14+
15+
bin_path = "bin/"
16+
extension_name = "test_extension"
17+
debug_or_release = "release" if env["target"] == "template_release" else "debug"
18+
19+
if "arch_suffix" not in env:
20+
env["arch_suffix"] = env["arch"]
21+
22+
if env["target"] in ["editor", "template_debug"]:
23+
# GDExtension has editor classes available in debug templates, which allows editor code to compile.
24+
# If you don't want to compile editor stuff in templates, move these 2 lines to a separate "if" block.
25+
env.Append(CPPPATH=["src/editor/"])
26+
sources += Glob("src/editor/*.cpp")
27+
# Add documentation XML files as a generated cpp file. Only works in Godot 4.3+.
28+
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
29+
sources.append(doc_data)
30+
31+
# Create the library target (e.g. libtest_extension.linux.debug.x86_64.so).
32+
if env["platform"] == "macos":
33+
library = env.SharedLibrary(
34+
"{0}/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format(
35+
bin_path,
36+
extension_name,
37+
env["platform"],
38+
debug_or_release,
39+
),
40+
source=sources,
41+
)
42+
else:
43+
library = env.SharedLibrary(
44+
"{}/{}{}.{}.{}.{}{}".format(
45+
bin_path,
46+
env.subst("$SHLIBPREFIX"),
47+
extension_name,
48+
env["platform"],
49+
debug_or_release,
50+
env["arch_suffix"],
51+
env["SHLIBSUFFIX"],
52+
),
53+
source=sources,
54+
)
55+
56+
Default(library)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="ExampleNode" inherits="Node" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3+
<brief_description>
4+
GDExtension example node.
5+
</brief_description>
6+
<description>
7+
An example node that demonstrates how to create a node in [GDExtension], which can be compiled and loaded by [GDExtensionManager]. This example node can also be compiled as an engine module, if that option was selected in the editor when creating the GDExtension.
8+
</description>
9+
<tutorials>
10+
<link title="GDExtension overview">$DOCS_URL/tutorials/scripting/gdextension/what_is_gdextension.html</link>
11+
<link title="GDExtension example in C++">$DOCS_URL/tutorials/scripting/gdextension/gdextension_cpp_example.html</link>
12+
</tutorials>
13+
<methods>
14+
<method name="print_hello" qualifiers="const">
15+
<return type="void" />
16+
<description>
17+
Prints either [code]"Hello, World! From GDExtension."[/code] if compiled as GDExtension or [code]"Hello, World! From a module."[/code] if compiled as a module, determined by the [code]#if[/code] directives in the C++ code.
18+
</description>
19+
</method>
20+
<method name="return_hello" qualifiers="const">
21+
<return type="String" />
22+
<description>
23+
Returns either [code]"Hello, World! From GDExtension."[/code] if compiled as GDExtension or [code]"Hello, World! From a module."[/code] if compiled as a module, determined by the [code]#if[/code] directives in the C++ code. If neither a module or extension, the code does not compile.
24+
</description>
25+
</method>
26+
</methods>
27+
</class>
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://c2vqvdr1f7bi"
6+
path="res://.godot/imported/ExampleNode.svg-ef666cf6c5f1fff2a869dcc1fef33b50.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://addons/test_extension/icons/ExampleNode.svg"
14+
dest_files=["res://.godot/imported/ExampleNode.svg-ef666cf6c5f1fff2a869dcc1fef33b50.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/uastc_level=0
22+
compress/rdo_quality_loss=0.0
23+
compress/hdr_compression=1
24+
compress/normal_map=0
25+
compress/channel_pack=0
26+
mipmaps/generate=false
27+
mipmaps/limit=-1
28+
roughness/mode=0
29+
roughness/src_normal=""
30+
process/channel_remap/red=0
31+
process/channel_remap/green=1
32+
process/channel_remap/blue=2
33+
process/channel_remap/alpha=3
34+
process/fix_alpha_border=true
35+
process/premult_alpha=false
36+
process/normal_map_invert_y=false
37+
process/hdr_as_srgb=false
38+
process/hdr_clamp_exposure=false
39+
process/size_limit=0
40+
detect_3d/compress_to=1
41+
svg/scale=4.0
42+
editor/scale_with_editor_scale=false
43+
editor/convert_colors_with_editor_theme=false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)