MikeSchulze / gdUnit4-action

This is a GitHub actions workflow for running GdUnit4 unit tests in Godot 4.x
MIT License
29 stars 5 forks source link

GD-19: Action fails in build step if different type warnings are treated as Errors in Project settings #19

Closed vikerman closed 6 months ago

vikerman commented 6 months ago

The used gdUnit4-action version

gdUnit4-action@v1.0.3 (Latest Release)

The used Godot version

v4.2.1

Operating System

Linux

Describe the bug

I am developing a Godot project with most type warnings set to Error.

GDUnit4 had no issues running locally in the UI with those settings but the GitHub action has lot of type errors starting from build_project.gd and console.gd and won't run successfully.

I went back to the default Godot settings and the GitHub Actions ran fine.

(I will probably try a workaround of replacing the project settings with a default one with no type errors in the Github Actions workflow)

MikeSchulze commented 6 months ago

Hi, can you please provide more details. e.g. logs on which step the action fails.

vikerman commented 6 months ago

Created a repro repo - https://github.com/vikerman/GDUnitTest with most of the type warnings as errors

Tests run locally in UI Fails in rebuildProjectCache()

Relevant log:

Start of the recovery of the project cache ... 
ERROR: Rebuild project cache failed with exit code 1. Aborting tests. 

Full logs - https://github.com/vikerman/GDUnitTest/actions/runs/8102654822/job/22145616131

I found the actual error by switching to rebuildProjectCache_() in my local fork of the action with console output.

I went down the rabbit hole a bit of trying to fix the type errors. But once I got past the rebuildProjectCache() errors I started getting script parse errors due to type issues while running the tests and I gave up.

MikeSchulze commented 6 months ago

hm, that looks strange, it seems the project cache can't be restored for some reason. I'm away for the weekend, so I won't have time to look at it until next Monday.

vikerman commented 6 months ago

No hurry! As I said I will probably try to work around for now by using a more lenient type settings just for the CI workflow.

Thanks for the awesome tool.

MikeSchulze commented 6 months ago

Update to MikeSchulze/gdUnit4-action@v1.0.4

vikerman commented 6 months ago

The cache restoration passes once I upgrade to v1.0.4. But as I mentioned earlier there are issues in the test running step also.

You can fork my test repo and that should run the action when you make any change - https://github.com/vikerman/GDUnitTest

Here are the error log lines after I upgraded to v1.0.4

Debugger Break, Reason: 'Parser Error: Constant "GdUnitTools" has an implicitly inferred static type. (Warning treated as error.)'
*Frame 0 - res://./addons/gdUnit4/bin/GdUnitCmdTool.gd:4 in function ''
Enter "help" for assistance.

Full logs: https://github.com/vikerman/GDUnitTest/actions/runs/8193892620/job/22408668020

MikeSchulze commented 6 months ago

Please do not include plugins for warnings when using such strict rules! The plugin is not fully type save and will produce a lot of warnings. All these warnings are the result of migrating from gdunit3 to gdunit4 and I never did a cleanup.

vikerman commented 6 months ago

Oh sorry - is there a way to apply warnings only to my project and not to the plugins? Very new to Godot.

vikerman commented 6 months ago

Screenshot_20240308-100851 Found it - sorry about the confusion. Leaving this here for future reference by others. It's in the same place (Debug->GDScript) where Warnings/Errors for type issues can be configured.

vikerman commented 6 months ago

Sorry the saga continues but I think I found the fix. For the above setting to properly work in the CI script runtest.sh has to call the script with "res://" instead of "./" in the path for the script.

Tested in my test repo - Tests finally pass! - https://github.com/vikerman/GDUnitTest/actions/runs/8217131139/job/22472487126

The local fixes in the test repo : https://github.com/vikerman/GDUnitTest/commit/64086e3 https://github.com/vikerman/GDUnitTest/commit/a3a8336

Will create a bug in gdUnit4 and submit a fix