chore: run GDScript CI on every PR; skip lint/test when unchanged
parent
3e6cda6383
commit
248600db4e
|
|
@ -1,5 +1,10 @@
|
||||||
# Lint, format-check, and unit-test GDScript (Godot 4.6). gdtoolkit: https://github.com/Scony/godot-gdscript-toolkit
|
# 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/
|
# GDUnit4 v6.1.2 under client/addons/gdUnit4; tests in client/test/
|
||||||
|
#
|
||||||
|
# PRs: workflow always runs so "GDScript / lint_and_test" can be a required check. Path-sensitive
|
||||||
|
# work uses step-level `if` — skipped steps still leave the job successful (unlike a workflow
|
||||||
|
# skipped via `on.paths`, which leaves the required check missing/pending).
|
||||||
|
# push: path filter on `on` avoids redundant runs on unrelated commits to main.
|
||||||
name: GDScript
|
name: GDScript
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -13,12 +18,11 @@ on:
|
||||||
- ".github/workflows/gdscript.yml"
|
- ".github/workflows/gdscript.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
|
||||||
- "client/scripts/**"
|
# dorny/paths-filter reads the PR file list from the GitHub API; needs pull-requests:read.
|
||||||
- "client/test/**"
|
permissions:
|
||||||
- "client/addons/**"
|
contents: read
|
||||||
- "client/project.godot"
|
pull-requests: read
|
||||||
- ".github/workflows/gdscript.yml"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint_and_test:
|
lint_and_test:
|
||||||
|
|
@ -29,20 +33,42 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Detect GDScript-relevant changes (PR only)
|
||||||
|
id: paths
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
gdscript:
|
||||||
|
- "client/scripts/**"
|
||||||
|
- "client/test/**"
|
||||||
|
- "client/addons/**"
|
||||||
|
- "client/project.godot"
|
||||||
|
- ".github/workflows/gdscript.yml"
|
||||||
|
|
||||||
|
- name: Skip GDScript lint and tests (no client GDScript paths in this PR)
|
||||||
|
if: github.event_name == 'pull_request' && steps.paths.outputs.gdscript != 'true'
|
||||||
|
run: echo "Skipping gdlint, gdformat, and GDUnit4."
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
|
|
||||||
- name: Install gdtoolkit
|
- name: Install gdtoolkit
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
run: pip install "gdtoolkit==4.5.0"
|
run: pip install "gdtoolkit==4.5.0"
|
||||||
|
|
||||||
- name: gdlint
|
- name: gdlint
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
run: gdlint client/scripts client/test
|
run: gdlint client/scripts client/test
|
||||||
|
|
||||||
- name: gdformat (check only)
|
- name: gdformat (check only)
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
run: gdformat --check client/scripts client/test
|
run: gdformat --check client/scripts client/test
|
||||||
|
|
||||||
- name: Cache Godot 4.6
|
- name: Cache Godot 4.6
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
id: godot-cache
|
id: godot-cache
|
||||||
with:
|
with:
|
||||||
|
|
@ -50,7 +76,7 @@ jobs:
|
||||||
key: godot-4.6-stable-linux-x86_64
|
key: godot-4.6-stable-linux-x86_64
|
||||||
|
|
||||||
- name: Download Godot 4.6
|
- name: Download Godot 4.6
|
||||||
if: steps.godot-cache.outputs.cache-hit != 'true'
|
if: (github.event_name == 'push' || steps.paths.outputs.gdscript == 'true') && steps.godot-cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/godot
|
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
|
wget -q "https://github.com/godotengine/godot/releases/download/4.6-stable/Godot_v4.6-stable_linux.x86_64.zip" -O /tmp/godot.zip
|
||||||
|
|
@ -58,10 +84,12 @@ jobs:
|
||||||
chmod +x ~/godot/Godot_v4.6-stable_linux.x86_64
|
chmod +x ~/godot/Godot_v4.6-stable_linux.x86_64
|
||||||
|
|
||||||
- name: Import project (.godot)
|
- name: Import project (.godot)
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
working-directory: client
|
working-directory: client
|
||||||
run: ~/godot/Godot_v4.6-stable_linux.x86_64 --headless --import --path . --quit-after 10
|
run: ~/godot/Godot_v4.6-stable_linux.x86_64 --headless --import --path . --quit-after 10
|
||||||
|
|
||||||
- name: Verify GDUnit path (Linux res:// is case-sensitive)
|
- name: Verify GDUnit path (Linux res:// is case-sensitive)
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
working-directory: client
|
working-directory: client
|
||||||
run: |
|
run: |
|
||||||
test -f addons/gdUnit4/bin/GdUnitCmdTool.gd || {
|
test -f addons/gdUnit4/bin/GdUnitCmdTool.gd || {
|
||||||
|
|
@ -73,6 +101,7 @@ jobs:
|
||||||
# GdUnit returns 0 if *executed* tests pass, even when Godot logs SCRIPT ERROR during suite
|
# GdUnit returns 0 if *executed* tests pass, even when Godot logs SCRIPT ERROR during suite
|
||||||
# discovery (broken test files are skipped). Fail the job if those errors appear in output.
|
# discovery (broken test files are skipped). Fail the job if those errors appear in output.
|
||||||
- name: GDUnit4 (headless)
|
- name: GDUnit4 (headless)
|
||||||
|
if: github.event_name == 'push' || steps.paths.outputs.gdscript == 'true'
|
||||||
working-directory: client
|
working-directory: client
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue