Skip to content

Commit 6d8d124

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 6d8d124

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
git clone --depth=1 https://github.com/godotengine/godot-tests.git /tmp/godot-tests
16+
17+
echo "Exporting project for Linux (PCK)"
18+
${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/project_export/ --export-pack "Linux" /tmp/test_project.pck 2>&1 | tee log.txt || true
19+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
20+
21+
echo "Exporting project for Linux (ZIP)"
22+
${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/project_export/ --export-pack "Linux" /tmp/test_project.zip 2>&1 | tee log.txt || true
23+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
24+
25+
echo "Exporting project for Linux as dedicated server (PCK)"
26+
${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/project_export/ --export-pack "Linux Server" /tmp/test_project_server.pck 2>&1 | tee log.txt || true
27+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
28+
29+
- name: Run project files from folder
30+
shell: sh
31+
run: |
32+
xvfb-run ${{ inputs.bin }} --path /tmp/godot-tests/tests/project_export/ --language fr --resolution 64x64 --write-movie /tmp/test_project_folder.png --quit 2>&1 | tee log.txt || true
33+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
34+
35+
${{ inputs.bin }} --headless --path /tmp/godot-tests/tests/project_export/ --quit 2>&1 | tee log.txt || true
36+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
37+
38+
- name: Run exported project PCK/ZIP
39+
shell: sh
40+
run: |
41+
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
42+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
43+
44+
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
45+
GODOT_CHECK_CI_LOG_ALL_ERRORS=1 misc/scripts/check_ci_log.py log.txt
46+
47+
# Headless mode is implied for dedicated server PCKs.
48+
${{ inputs.bin }} --main-pack /tmp/test_project_server.pck --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+
echo "Checking whether video output from project folder and exported project match..."
52+
md5sum /tmp/test_project*.png | md5sum --check
53+
54+
echo "Checking whether audio output from project folder and exported project match..."
55+
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

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

0 commit comments

Comments
 (0)