Skip to content

Commit

Permalink
gdextension_build: Added testing of other versions of godot.
Browse files Browse the repository at this point in the history
gdextension_build: Added a test of the `--check-only` argument (without `MainLoop`).
setup_godot: Added support for installing multiple versions at the same time.
Web deploy: godot version updated to 4.3
new version
  • Loading branch information
DmitriySalnikov committed Nov 13, 2024
1 parent 742443c commit ee99ec9
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 26 deletions.
11 changes: 6 additions & 5 deletions .github/actions/setup_godot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ runs:
echo "Fixed path: $tmp_path_unix"
fi
echo "path=$tmp_path/godot_installation" >> $GITHUB_OUTPUT
echo "path_unix=$tmp_path_unix/godot_installation" >> $GITHUB_OUTPUT
echo "path=$tmp_path/godot_installation_${{inputs.tag}}" >> $GITHUB_OUTPUT
echo "path_unix=$tmp_path_unix/godot_installation_${{inputs.tag}}" >> $GITHUB_OUTPUT
if [[ "${{inputs.file_suffix}}" == *"macos"* ]]; then
echo "exe=$tmp_path_unix/godot_installation/Godot.app/Contents/MacOS/Godot" >> $GITHUB_OUTPUT
echo "exe=$tmp_path_unix/godot_installation_${{inputs.tag}}/Godot.app/Contents/MacOS/Godot" >> $GITHUB_OUTPUT
else
echo "exe=$tmp_path_unix/godot_installation/godot" >> $GITHUB_OUTPUT
echo "exe=$tmp_path_unix/godot_installation_${{inputs.tag}}/godot" >> $GITHUB_OUTPUT
fi
- name: Restore cache directory
Expand Down Expand Up @@ -77,6 +77,7 @@ runs:
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
shell: bash
run: |
# TODO test mono
if [ "${{inputs.is_mono}}" == "true" ]; then
echo "Move the Mono files to the root of the temporary folder"
mv -f Godot*/* temp_download/ || true
Expand Down Expand Up @@ -115,7 +116,7 @@ runs:
fi
done
echo "Move files to installation folder"
echo "Move files to the installation folder"
mv -f temp_download/ ${{steps.store_folder.outputs.path_unix}}/
touch ${{steps.store_folder.outputs.path_unix}}/._sc_
Expand Down
77 changes: 59 additions & 18 deletions .github/workflows/gdextension_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,29 @@ jobs:
cp -r ${{env.TESTS_PATH}} ${{env.PROJECT_PATH}}/${{env.TESTS_PATH}}
find ${{env.PROJECT_PATH}} -mindepth 1
- name: Setup Godot
- name: Setup Godot 4.1
uses: ./.github/actions/setup_godot
id: setup_godot
id: setup_godot_4_1
with:
tag: ${{env.GODOT_VERSION}}
tag: 4.1.4-stable
file_suffix: ${{matrix.file_suffix}}
download_export_templates: false
is_mono: false

- name: Setup Godot 4.2
uses: ./.github/actions/setup_godot
id: setup_godot_4_2
with:
tag: 4.2.2-stable
file_suffix: ${{matrix.file_suffix}}
download_export_templates: false
is_mono: false

- name: Setup Godot 4.3
uses: ./.github/actions/setup_godot
id: setup_godot_4_3
with:
tag: 4.3-stable
file_suffix: ${{matrix.file_suffix}}
download_export_templates: false
is_mono: false
Expand All @@ -458,23 +476,46 @@ jobs:
- name: Test run
shell: bash --noprofile --norc -o pipefail {0}
run: |
max_attempts=3
current_attempt=1
last_exit_code=0
until [ $current_attempt -gt $max_attempts ]; do
run_tests() {
godot_exe="$1"
echo "🧪Testing $godot_exe"
max_attempts=3
current_attempt=1
last_exit_code=0
# Cleanup
rm -f "${{env.PROJECT_PATH}}/SUCCESS"
rm -rf "${{env.PROJECT_PATH}}/.godot"
until [ $current_attempt -gt $max_attempts ]; do
current_attempt=$((current_attempt + 1))
timeout 2m ${{steps.setup_godot.outputs.godot}} -v -e --headless --path ${{env.PROJECT_PATH}} --quit || true
timeout 2m ${{steps.setup_godot.outputs.godot}} -v --headless --path ${{env.PROJECT_PATH}} res://headless_test.tscn || true
echo "🛒 Project preparation"
timeout 2m $godot_exe -v -e --headless --path ${{env.PROJECT_PATH}} --quit || true
echo "☑ --check-only test without MainLoop"
timeout 2m $godot_exe -v --headless --path ${{env.PROJECT_PATH}} --check-only --script res://check-only_test.gd
if [ $? -ne 0 ]; then
echo "[$godot_exe] The test without MainLoop failed. Exiting."
exit 1
fi
echo "🧪 Actual testing"
timeout 2m $godot_exe -v --headless --path ${{env.PROJECT_PATH}} res://headless_test.tscn || true
if [ ! -f "${{env.PROJECT_PATH}}/SUCCESS" ]; then
echo "The file reporting success has not been created! Failed."
last_exit_code=1
echo "[$godot_exe] The file reporting success has not been created! Failed."
last_exit_code=1
else
echo "The file reporting success has been created! Success!"
exit 0
echo "[$godot_exe] The file reporting success has been created! Success!"
exit 0
fi
done
echo "The maximum number of attempts has been reached. Last error code: $?"
exit $last_exit_code
done
echo "[$godot_exe] The maximum number of attempts has been reached. Last error code: $?"
exit $last_exit_code
}
run_tests "${{steps.setup_godot_4_1.outputs.godot}}"
run_tests "${{steps.setup_godot_4_2.outputs.godot}}"
run_tests "${{steps.setup_godot_4_3.outputs.godot}}"
2 changes: 1 addition & 1 deletion .github/workflows/web_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ jobs:
needs: [data_preparation, generate_docs, web-gdextension]

env:
GODOT_VERSION: 4.2.2-stable
GODOT_VERSION: 4.3-stable
PROJECT_PATH: dd3d_web_build
BUILD_FOLDER: demo_build

Expand Down
17 changes: 17 additions & 0 deletions dd3d_web_build/check-only_test.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends SceneTree


func _init():
if true:
var _s = DebugDraw3D.new_scoped_config().set_thickness(0.1)
DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE, DebugDraw3D.empty_color, true, 1.2)
DebugDraw3D.draw_sphere(Vector3.ZERO, 0.5, DebugDraw3D.empty_color, 1.5)
DebugDraw3D.draw_gizmo(Transform3D().scaled_local(Vector3.ONE*0.4), Color.BROWN, true, 2.5)
DebugDraw2D.set_text("FPS", "0")
DebugDraw2D.begin_text_group("Info")
DebugDraw2D.set_text("INFO", "hello", 1, DebugDraw2D.empty_color, 1)
DebugDraw2D.end_text_group()
DebugDraw3D.draw_sphere(Vector3.ZERO)
DebugDraw3D.config.frustum_length_scale = 0.07
DebugDrawManager.clear_all()
quit()
2 changes: 1 addition & 1 deletion src/debug_draw_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void DebugDrawManager::_integrate_into_engine() {
if (!SCENE_TREE()) {
// Running via the console with a custom `MainLoop` or with `--check-only`
set_debug_enabled(false);
return;
// TODO test return;
}

// disable by default for headless
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define DD3D_MAJOR 1
#define DD3D_MINOR 4
#define DD3D_PATCH 5
#define DD3D_PATCH 6
#define DD3D_VERSION ((DD3D_MAJOR << (8 * 3)) + (DD3D_MINOR << (8 * 2)) + (DD3D_PATCH << (8 * 1)))

#define _DD3D_VERSION_STR_TEXT(text) #text
Expand Down

0 comments on commit ee99ec9

Please sign in to comment.