-
Notifications
You must be signed in to change notification settings - Fork 3
ci: refactor main workflow with just and pre-commit #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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 ! 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/** |
@@ -17,7 +17,7 @@ var server_pid: int | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -4,7 +4,7 @@ extends "res://addons/gd-plug/plug.gd" | |||
|
|||
|
|||
func _plugging(): | |||
plug("bitwes/Gut", {commit = "70c08aebb318529fc7d3b07f7282b145f7512dee"}) | |||
plug("bitwes/Gut", {commit = "18f6bddf7010b01754d6feb5f96557214e3ead8c"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
# Git archive should only include addons/glam directory. | |
check-archive: | |
name: 'Check Archive' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create git archive | |
run: git archive -o archive.zip HEAD | |
- name: Extract archive | |
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped | |
- name: Copy extracted archive to working directory | |
run: cp -avr /tmp/unzipped ./unzipped | |
- name: REUSE compliance check | |
uses: fsfe/reuse-action@v2 | |
with: | |
args: --root ./unzipped/addons/glam lint | |
- name: Check that archive only contains addons directory | |
run: | | |
shopt -s nullglob dotglob | |
ls -laR /tmp/unzipped | |
files=(/tmp/unzipped/*) | |
if [ ${#files[@]} -ne 1 ]; then | |
echo "Wrong number of files in archive (${#files[@]}) expected 1." | |
exit 1 | |
fi | |
if [ ! -d "/tmp/unzipped/addons" ]; then | |
echo "Expected directory (addons) not found." | |
exit 1 | |
fi | |
files=(/tmp/unzipped/addons) | |
if [ ${#files[@]} -ne 1 ]; then | |
echo "Wrong number of files in addons directory (${#files[@]}) expected 1." | |
exit 1 | |
fi | |
if [ ! -d "/tmp/unzipped/addons/glam" ]; then | |
echo "Expected directory (addons/glam) not found." | |
exit 1 | |
fi |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: reuse
appears twice here.
|
||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -14,3 +14,4 @@ mono_crash.* | |||
todo.gd | |||
.gut_editor_config.json | |||
*.swp | |||
venv/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
codespell
,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.server
of python have same behavior.Notes:
publish
job) is launched when a tag is pushed. The addon version in the.env
must be equal to the tag. And the step automatically bump addon and create a github release.setup-godot
action doesn't seems to work anymoreI'm open to feedback, it's a development workflow I use personally, so I'm familiar with it 🙂