From 968d49ed73ae30b734304fd31e083b9121f1f896 Mon Sep 17 00:00:00 2001 From: anyreso Date: Mon, 15 Apr 2024 05:26:21 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=9A=20Gitlab=20CI/CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++ .gitlab-ci.yml | 80 ++++++++++++++++++++++++++++++++++++++++++++ .gutconfig.json | 33 ++++++++++++++++++ project.godot | 2 +- tests/test_basics.gd | 1 - 5 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 .gutconfig.json diff --git a/.gitignore b/.gitignore index 62bcfc3..34b23bc 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ export_presets.cfg # Added by Squinternator: *.dll files compiled by the windows build addons/godot-jolt/windows/~godot-jolt_windows-x64_editor.dll addons/terrain_3d/bin/~libterrain.windows.debug.x86_64.dll + +build + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..57a1acc --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,80 @@ +image: $CI_REGISTRY/open-fpsz/docker-godot/godot + +stages: + - addons + - tests + - export + +# cache imported assets between runs +cache: &global_cache + key: $CI_MERGE_REQUEST_IID + paths: + - .godot + +# run godot to load addons +addons: + stage: addons + script: + - timeout 10 godot --headless --editor --verbose || true + - timeout 10 godot --headless --editor --verbose || true + only: + - main + - develop + +# run tests +tests: + stage: tests + needs: [ "addons" ] + script: + - godot --headless --path "$PWD" -s addons/gut/gut_cmdln.gd + only: + - main + - develop + +# export binaries +.export_presets: + needs: [ "tests" ] + before_script: + - cp "$EXPORT_PRESETS" export_presets.cfg + only: + - main + +variables: + EXPORT_NAME: open-fpsz + +linux: + stage: export + extends: [ .export_presets ] + when: manual + script: + - mkdir -v -p build/linux + - godot --headless --verbose --export-release "Linux/X11" build/linux/$EXPORT_NAME.x86_64 + artifacts: + name: $EXPORT_NAME-$CI_JOB_NAME + paths: + - build/linux + +windows: + stage: export + extends: [ .export_presets ] + when: manual + script: + - mkdir -v -p build/windows + - godot --headless --verbose --export-release "Windows Desktop" build/windows/$EXPORT_NAME.exe + artifacts: + name: $EXPORT_NAME-$CI_JOB_NAME + paths: + - build/windows + +mac: + stage: export + extends: [ .export_presets ] + when: manual + script: + - mkdir -v -p build/mac + - godot --headless --verbose --export-release "Mac OSX" build/mac/$EXPORT_NAME.zip + artifacts: + name: $EXPORT_NAME-$CI_JOB_NAME + paths: + - build/mac + diff --git a/.gutconfig.json b/.gutconfig.json new file mode 100644 index 0000000..8704e3c --- /dev/null +++ b/.gutconfig.json @@ -0,0 +1,33 @@ +{ + "background_color": "262626ff", + "compact_mode": false, + "configured_dirs": [], + "dirs": ["res://tests"], + "disable_colors": false, + "double_strategy": "SCRIPT_ONLY", + "errors_do_not_cause_failure": false, + "font_color": "ccccccff", + "font_name": "CourierPrime", + "font_size": 16, + "gut_on_top": true, + "hide_orphans": true, + "ignore_pause": true, + "include_subdirs": true, + "inner_class": "", + "junit_xml_file": "", + "junit_xml_timestamp": false, + "log_level": 1, + "opacity": 100, + "paint_after": 0.1, + "post_run_script": "", + "pre_run_script": "", + "prefix": "test_", + "selected": "", + "should_exit": true, + "should_exit_on_success": false, + "should_maximize": false, + "suffix": ".gd", + "tests": [], + "unit_test_name": "" +} + diff --git a/project.godot b/project.godot index 690e672..8c7f2eb 100644 --- a/project.godot +++ b/project.godot @@ -21,7 +21,7 @@ movie_writer/disable_vsync=true [editor_plugins] -enabled=PackedStringArray("res://addons/terrain_3d/plugin.cfg") +enabled=PackedStringArray("res://addons/gut/plugin.cfg", "res://addons/terrain_3d/plugin.cfg") [input] diff --git a/tests/test_basics.gd b/tests/test_basics.gd index 52c24f4..0a7339c 100644 --- a/tests/test_basics.gd +++ b/tests/test_basics.gd @@ -19,4 +19,3 @@ func _test_projectile_class(): assert(projectile != null, "Projectile class should be instantiated") assert(projectile.speed == 78.4, "Projectile damage should be initialized to 78.4") projectile.queue_free() - From 29b445799c6605d60fc676fce307c673c1ae7eb1 Mon Sep 17 00:00:00 2001 From: anyreso Date: Mon, 15 Apr 2024 01:33:25 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20fix=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_basics.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_basics.gd b/tests/test_basics.gd index 0a7339c..4faf653 100644 --- a/tests/test_basics.gd +++ b/tests/test_basics.gd @@ -18,4 +18,4 @@ func _test_projectile_class(): var projectile = Projectile.new() assert(projectile != null, "Projectile class should be instantiated") assert(projectile.speed == 78.4, "Projectile damage should be initialized to 78.4") - projectile.queue_free() + projectile.queue_free()