ci: refactor main workflow with just and pre-commit#8
ci: refactor main workflow with just and pre-commit#8florianvazelle wants to merge 8 commits intolihop:masterfrom
Conversation
Fixes AmbientCG assets not loading. Cherry-picked from the awesome PR #8 by @florianvazelle.
|
Thanks for the PR. I'm glad you like the addon and that I could introduce you to It's been a while since I worked on this project, and a lot of these tools are new to me, so I'll need some time to get up to speed and review this PR properly, but I like what I see so far. Here is some initial feedback:
I hadn't heard of Just, so thanks for introducing me. It looks like a good tool that will be useful for the project. I have some shell scripts is some other projects (e.g. build.sh) that would also probably benefit from being converted in to Justfiles.
Great call 👍
I really like what you have done with the complex part of the CI, like using the composite action and That's all for now. Thanks again for the PR and I hope to get back to you with a proper review soon. |
|
Thanks for your initial feedback 🙂 Perhaps I can improve the README "developping" section to reflect what I've done in the MR, it might help to understand the different tools ? |
|
Updating the Development section of the README sounds like a good idea. Even if it's just some brief documentation with links to third-party docs. |
|
Updated ! 🙂 |
lihop
left a comment
There was a problem hiding this comment.
Here are some initial comments.
I've already cherry-picked the dependabot stuff and I've also gone through and made the code gdlint compliant in anticipation of the gdlint pre-commit hook.
The setup-godot action is working now, so I think we can remove the stuff related to that.
I will have a closer look at the Justfile soon, but I'm not so keen on it downloading the Godot binaries as I feel it clutters up the file quite a bit. I think just having a GODOT env var (defaulting to godot) which is the path to the Godot binary would simplify things. Then leave it up to the user to manage Godot installation as they see fit.
The GitHub workflow seems quite good, although currently not all the integration tests are running. I've also installed pre-commit.ci in the project to do additional checks.
In any case, I'm really grateful that you introduced me to pre-commit. It's a game changer, and I'm looking forward to using it in my other projects.
| skip = assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/** | ||
| ignore-words-list = acess |
There was a problem hiding this comment.
suggestion: Remove 'acess' from the ignored words list and skip CREDITS.md.
This will prevent missing real misspellings of 'access', and CREDITS.md is auto-generated by GLAM, so any misspellings in that file on GLAM's side should be caught by other checks.
| skip = assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/** | |
| ignore-words-list = acess | |
| skip = CREDITS.md,assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/** |
| func before_all(): | ||
| var path := ProjectSettings.globalize_path("res://test/integration/streaming") | ||
| server_pid = OS.execute("npx", ["http-server", "--port=%d" % PORT, path], false) | ||
| server_pid = OS.execute("python", ["-m", "http.server", "%d" % PORT, "-d", path], false) |
There was a problem hiding this comment.
blocker: Unfortunately this doesn't work as python's http.server does not support HTTP range requests which are used for some of the tests, so I think we should stick with npx for now.
| # TODO: Add an asset-lib publish step | ||
|
|
||
| # Run unit tests | ||
| unit: install-addons import-resources |
There was a problem hiding this comment.
suggestion: Remove install-addons and import-resources recipes.
Running these recipes as dependencies slows down this recipe significantly which isn't ideal when running the unit tests frequently.
with:
just unit
...
real 0m13.815s
without:
just unit
...
real 0m3.360s
|
|
||
| func _plugging(): | ||
| plug("bitwes/Gut", {commit = "70c08aebb318529fc7d3b07f7282b145f7512dee"}) | ||
| plug("bitwes/Gut", {commit = "18f6bddf7010b01754d6feb5f96557214e3ead8c"}) |
There was a problem hiding this comment.
suggestion: This could be changed to make the Gut version clear from a glance.
| plug("bitwes/Gut", {commit = "18f6bddf7010b01754d6feb5f96557214e3ead8c"}) | |
| plug("bitwes/Gut", {tag = "v4.7.1"}) |
I'm not sure why the other dependencies in plug.gd use commit rather than tag, but I think it's because I didn't realize at the time that gd-plug supported it.
There was a problem hiding this comment.
praise: Thanks for this. I have cherry-picked the commit that adds this file and it works well.
| /*.license export-ignore | ||
| # Exclude all top-level files and directories (except addons) from zip downloads. | ||
| # This makes installing through the AssetLib easier, because no files and folders | ||
| # need to be unchecked. |
There was a problem hiding this comment.
praise: This is a great comment. Should definitely keep this.
| # need to be unchecked. | ||
| /** export-ignore | ||
| /addons/glam !export-ignore | ||
| /addons/glam/** !export-ignore |
There was a problem hiding this comment.
blocker: This is nice, but unfortunately doesn't work. It results in an empty zip archive. There is currently a check in the workflow for this which fails with this .gitattributes file.
glam/.github/workflows/main.yml
Lines 78 to 115 in 43a9fbe
Adding files and forgetting to update
.gitattributes has caught me out a lot. It would be nice if there were a pre-commit hook for it. I'm considering adding one to setup-godot as I would also use it in other projects.
| rev: v2.0.0 | ||
| hooks: | ||
| - id: reuse | ||
| - id: reuse |
|
|
||
| # Run integration tests | ||
| integration: install-addons import-resources | ||
| just godot --no-window -s addons/gut/gut_cmdln.gd -gdir=res://test/integration/sources -gexit |
There was a problem hiding this comment.
issue: This is only running some of the integration tests. To run all, it should be:
| just godot --no-window -s addons/gut/gut_cmdln.gd -gdir=res://test/integration/sources -gexit | |
| just godot --no-window -s addons/gut/gut_cmdln.gd -gdir=res://test/integration -gexit |
| todo.gd | ||
| .gut_editor_config.json | ||
| *.swp | ||
| venv/ |
There was a problem hiding this comment.
tought: With pre-commit sandboxing the python git hooks, I don't think we need any reference to python in this project. Therefore, we could also remove the .venv/ ignore from this file.
Hi 👋
I love this addon, it's very great to download assets and prototype very quickly. You introduced me to
reuse, which is really what I was looking for to track assets when I start to develop games, and which I now use all the time. So, I want to maintainglam, and migrate it to Godot 4.But, firstly, I want to propose a better dev & CI workflow, to launch easily the CI locally.
$ just OS: linux - ARCH: x86_64 Available recipes: bump-version # Updates the addon version ci-godot-x11 *ARGS # Starts godot using Xvfb and pulseaudio ci-load-dotenv # Add some variables to Github env clean # Remove any unnecessary files clean-addons # Remove plugins default # Display all commands editor # Open the Godot editor fmt # Run files formatters godot *ARGS # Godot binary wrapper import-resources # Import game resources install-addons # Download plugins integration # Run integration tests publish # Upload the addon on Github unit # Run unit testscodespell,reuse(in the project & the addon directory), and some other hooks which allows you to format several file formats. Like the hooks you made, it can be launched automatically at each commit, or viajust fmt.http.serverof python have same behavior.Notes:
publishjob) is launched when a tag is pushed. The addon version in the.envmust be equal to the tag. And the step automatically bump addon and create a github release.setup-godotaction doesn't seems to work anymoreI'm open to feedback, it's a development workflow I use personally, so I'm familiar with it 🙂