neon-sprawl/.github/workflows/gdscript.yml

77 lines
2.4 KiB
YAML

# Lint, format-check, and unit-test GDScript (Godot 4.6). gdtoolkit: https://github.com/Scony/godot-gdscript-toolkit
# GDUnit4 v6.1.2 under client/addons/gdUnit4; tests in client/test/
name: GDScript
on:
push:
branches: [main]
paths:
- "client/scripts/**"
- "client/test/**"
- "client/addons/**"
- "client/project.godot"
- ".github/workflows/gdscript.yml"
pull_request:
branches: [main]
paths:
- "client/scripts/**"
- "client/test/**"
- "client/addons/**"
- "client/project.godot"
- ".github/workflows/gdscript.yml"
jobs:
lint_and_test:
runs-on: ubuntu-latest
# Folder is addons/gdUnit4 (capital U). Lowercase gdunit4 fails on Linux (case-sensitive res://).
env:
GDUNIT_CMDTOOL: res://addons/gdUnit4/bin/GdUnitCmdTool.gd
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install gdtoolkit
run: pip install "gdtoolkit==4.5.0"
- name: gdlint
run: gdlint client/scripts client/test
- name: gdformat (check only)
run: gdformat --check client/scripts client/test
- name: Cache Godot 4.6
uses: actions/cache@v4
id: godot-cache
with:
path: ~/godot/Godot_v4.6-stable_linux.x86_64
key: godot-4.6-stable-linux-x86_64
- name: Download Godot 4.6
if: steps.godot-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/godot
wget -q "https://github.com/godotengine/godot/releases/download/4.6-stable/Godot_v4.6-stable_linux.x86_64.zip" -O /tmp/godot.zip
unzip -q /tmp/godot.zip -d ~/godot
chmod +x ~/godot/Godot_v4.6-stable_linux.x86_64
- name: Import project (.godot)
working-directory: client
run: ~/godot/Godot_v4.6-stable_linux.x86_64 --headless --import --path . --quit-after 10
- name: Verify GDUnit path (Linux res:// is case-sensitive)
working-directory: client
run: |
test -f addons/gdUnit4/bin/GdUnitCmdTool.gd || {
echo "::error::Missing GdUnit CLI script. Use addons/gdUnit4 (capital U), not gdunit4."
ls -la addons/ || true
exit 1
}
- name: GDUnit4 (headless)
working-directory: client
run: |
~/godot/Godot_v4.6-stable_linux.x86_64 --headless --path . -s "$GDUNIT_CMDTOOL" --ignoreHeadlessMode -a res://test