Skip to content

Commit 4a012e6

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 22a28e0 commit 4a012e6

File tree

88 files changed

+2312
-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.

88 files changed

+2312
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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: Import resources and export project
13+
shell: sh
14+
run: |
15+
#echo "Importing resources"
16+
#${{ inputs.bin }} --headless --path misc/test_project/ --import 2>&1 | tee log.txt || true
17+
18+
echo "Exporting project for Linux (PCK)"
19+
${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux" /tmp/test_project.pck 2>&1 | tee log.txt || true
20+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
21+
22+
echo "Exporting project for Linux (ZIP)"
23+
${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux" /tmp/test_project.zip 2>&1 | tee log.txt || true
24+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
25+
unzip -l /tmp/test_project.zip
26+
27+
echo "Exporting project for Linux as dedicated server (PCK)"
28+
${{ inputs.bin }} --headless --path misc/test_project/ --export-pack "Linux Server" /tmp/test_project_server.pck 2>&1 | tee log.txt || true
29+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
30+
31+
ls -l /tmp
32+
33+
- name: Run project files from folder
34+
shell: sh
35+
run: |
36+
xvfb-run ${{ inputs.bin }} --path misc/test_project/ --language fr --resolution 64x64 --write-movie /tmp/test_project_folder.png --quit 2>&1 | tee log.txt || true
37+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
38+
39+
${{ inputs.bin }} --headless --path misc/test_project/ --quit 2>&1 | tee log.txt || true
40+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
41+
42+
- name: Run exported project PCK/ZIP
43+
shell: sh
44+
run: |
45+
xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.pck --language fr --resolution 64x64 --write-movie /tmp/test_project_pck.png --quit 2>&1 | tee log.txt || true
46+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
47+
48+
xvfb-run ${{ inputs.bin }} --main-pack /tmp/test_project.zip --language fr --resolution 64x64 --write-movie /tmp/test_project_zip.png --quit 2>&1 | tee log.txt || true
49+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
50+
51+
# Headless mode is implied for dedicated server PCKs.
52+
${{ inputs.bin }} --main-pack /tmp/test_project_server.pck --quit 2>&1 | tee log.txt || true
53+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
54+
55+
echo "Checking whether video output from project folder and exported project match..."
56+
md5sum /tmp/test_project*.png | md5sum --check
57+
58+
echo "Checking whether audio output from project folder and exported project match..."
59+
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
@@ -35,6 +35,7 @@ jobs:
3535
build-mono: true
3636
doc-test: true
3737
proj-conv: true
38+
proj-export: true
3839
api-compat: true
3940
artifact: true
4041
# Validate godot-cpp compatibility on one arbitrary editor build.
@@ -118,7 +119,7 @@ jobs:
118119
run: |
119120
sudo apt-get update
120121
sudo apt-get install libwayland-bin # TODO: Figure out somehow how to embed this one.
121-
if [ "${{ matrix.proj-test }}" == "true" ]; then
122+
if [ "${{ matrix.proj-test }}" == "true" -o "${{ matrix.proj-export }}" == "true" ]; then
122123
sudo apt-get install mesa-vulkan-drivers
123124
fi
124125
@@ -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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ xcuserdata/
232232

233233
# Actual VS project files we don't use
234234
*.sln
235+
!misc/test_project/TestProject.sln
235236
*.vcxproj*
236237

237238
# User-specific files

misc/scripts/check_ci_log.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4+
import os
45
import sys
56

67
if len(sys.argv) < 2:
@@ -58,6 +59,12 @@
5859
print("ERROR: Assertion failed in project, check execution log for more info")
5960
sys.exit(55)
6061

62+
if os.environ.get("GODOT_CHECK_CI_LOG_ALL_ERRORS"):
63+
# If any occurrence of "ERROR:" is found in the log, we consider it a failure.
64+
if file_contents.find("ERROR:") != -1:
65+
print("ERROR: 'ERROR:' found in log and GODOT_CHECK_CI_LOG_ALL_ERRORS is set.")
66+
sys.exit(56)
67+
6168
# For now Godot leaks a lot of rendering stuff so for now we just show info
6269
# about it and this needs to be re-enabled after fixing this memory leaks.
6370

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/LICENSE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# License for third-party files
2+
3+
## `polyhaven/*`
4+
5+
Copyright (c) Poly Haven
6+
7+
- Upstream: https://polyhaven.com
8+
- License: CC0-1.0
9+
10+
## `fonts/librequake_conchars.webp`
11+
12+
- Upstream: https://github.com/lavenderdotpet/LibreQuake
13+
- License: BSD-3-Clause

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
shader_type spatial;
2+
3+
global uniform vec3 offset;
4+
instance uniform vec3 emission : source_color = vec3(1.0, 0.0, 0.0);
5+
uniform vec3 color : source_color = vec3(1.0, 0.0, 0.0);
6+
7+
void vertex() {
8+
VERTEX.xyz += offset;
9+
}
10+
11+
void fragment() {
12+
ALBEDO = color.rgb;
13+
EMISSION = emission.rgb;
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://cqkjq1u1jfe1c
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[gd_resource type="VisualShader" load_steps=2 format=3 uid="uid://barg7ns55yag2"]
2+
3+
[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_bwiop"]
4+
output_port_for_preview = 0
5+
parameter_name = "ColorParameter"
6+
default_value_enabled = true
7+
default_value = Color(1, 0, 0, 1)
8+
9+
[resource]
10+
nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_bwiop")
11+
nodes/fragment/2/position = Vector2(20, 260)
12+
nodes/fragment/connections = PackedInt32Array(2, 0, 0, 0)

0 commit comments

Comments
 (0)