Skip to content

Commit 07f843f

Browse files
TMHSDigitalclaude
andcommitted
CI: unit tests, editor smoke test and live feed check on 4.3 and 4.7.2
Runs on push, PRs and every Monday. Godot zips are checked against pinned official SHA-512s before use. Each step also scans the log for script errors, since Godot can exit 0 after one. The live feed check runs plugin-feed.json through the plugin parser (tests/check_feed_file.gd), so a breaking catalog change fails here first. Refs TMHSDigital/Free-Game-Dev-Assets#283 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LpkeXPtfg3jGzhfoGMshTE
1 parent 7049d87 commit 07f843f

3 files changed

Lines changed: 118 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
# Mondays, after the catalog's weekly runs: catches a breaking feed change.
9+
- cron: "17 9 * * 1"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
godot:
17+
name: Godot ${{ matrix.version }}
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 15
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# The minimum supported version and the latest stable. The SHA-512s
25+
# are the official ones from each release's SHA512-SUMS.txt, pinned
26+
# here so a swapped download fails instead of running.
27+
- version: 4.3-stable
28+
sha512: fd52bb4ba8acc30ca5accd1c566d470ad7282f891ccc0995dfafabcf92bcf76280ce182bf9d80ebd885f3ed2165d01e1fc3f2928436b15498dfbd98656c2a45a
29+
- version: 4.7.2-stable
30+
sha512: 9aa00f7a605200940bce3027a567b782f49bd8e940dd06ae9e987bd65aee1b1467edd56ed84fcdcbdd44354bf613bdbb4e5d2913e925850368e150c59ed54c65
31+
env:
32+
GODOT_VERSION: ${{ matrix.version }}
33+
GODOT_SHA512: ${{ matrix.sha512 }}
34+
steps:
35+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36+
with:
37+
persist-credentials: false
38+
39+
- name: Install Godot
40+
run: |
41+
zip="Godot_v${GODOT_VERSION}_linux.x86_64.zip"
42+
curl -fsSL --retry 3 -o "$RUNNER_TEMP/godot.zip" "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/${zip}"
43+
echo "${GODOT_SHA512} $RUNNER_TEMP/godot.zip" | sha512sum -c -
44+
unzip -q "$RUNNER_TEMP/godot.zip" -d "$RUNNER_TEMP/godot"
45+
mv "$RUNNER_TEMP/godot/Godot_v${GODOT_VERSION}_linux.x86_64" "$RUNNER_TEMP/godot/godot"
46+
echo "$RUNNER_TEMP/godot" >> "$GITHUB_PATH"
47+
48+
- name: Import the project
49+
run: godot --headless --editor --quit --path . || true
50+
51+
# Godot can exit 0 after a script error, so every step also reads the log.
52+
- name: Unit tests
53+
run: |
54+
godot --headless --path . --script tests/run_tests.gd 2>&1 | tee "$RUNNER_TEMP/tests.log"
55+
status=${PIPESTATUS[0]}
56+
if grep -qE "SCRIPT ERROR|Parse Error|Failed to load script" "$RUNNER_TEMP/tests.log"; then echo "::error::script error in tests"; exit 1; fi
57+
grep -q "^tests ok:" "$RUNNER_TEMP/tests.log" || { echo "::error::tests did not report ok"; exit 1; }
58+
exit "$status"
59+
60+
- name: Editor smoke test (plugin loads and unloads)
61+
run: |
62+
godot --headless --editor --quit-after 300 --verbose --path . > "$RUNNER_TEMP/editor.log" 2>&1 || true
63+
grep -E "free_game_dev_assets|SCRIPT ERROR|Parse Error" "$RUNNER_TEMP/editor.log" || true
64+
if grep -qE "SCRIPT ERROR|Parse Error|Failed to load script" "$RUNNER_TEMP/editor.log"; then echo "::error::script error in the editor"; exit 1; fi
65+
grep -q "free_game_dev_assets: dock added" "$RUNNER_TEMP/editor.log" || { echo "::error::dock was not added"; exit 1; }
66+
grep -q "free_game_dev_assets: dock removed" "$RUNNER_TEMP/editor.log" || { echo "::error::dock was not removed on exit"; exit 1; }
67+
68+
- name: Live feed contract
69+
run: |
70+
curl -fsSL --retry 3 --compressed -o "$RUNNER_TEMP/plugin-feed.json" https://tmhsdigital.github.io/Free-Game-Dev-Assets/plugin-feed.json
71+
godot --headless --path . --script tests/check_feed_file.gd -- "$RUNNER_TEMP/plugin-feed.json" 2>&1 | tee "$RUNNER_TEMP/feed.log"
72+
status=${PIPESTATUS[0]}
73+
grep -q "^feed ok:" "$RUNNER_TEMP/feed.log" || { echo "::error::live feed check failed"; exit 1; }
74+
exit "$status"

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Early development. Planned work is tracked in [TMHSDigital/Free-Game-Dev-Assets#
2222
- [ ] Browse list with search and filters ([#280](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/280))
2323
- [ ] Entry details and actions ([#281](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/281))
2424
- [ ] Project asset list and `CREDITS.md` export ([#282](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/282))
25-
- [ ] Tests in CI ([#283](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/283))
25+
- [x] Tests in CI ([#283](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/283))
2626
- [ ] Release and Asset Library listing ([#284](https://github.com/TMHSDigital/Free-Game-Dev-Assets/issues/284))
2727

2828
## Requirements

‎tests/check_feed_file.gd‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
extends SceneTree
2+
## Contract check: runs a downloaded plugin-feed.json through the plugin's own
3+
## parser, so a breaking change in the catalog's feed fails CI before users
4+
## see it.
5+
## godot --headless --path . --script tests/check_feed_file.gd -- /path/to/plugin-feed.json
6+
7+
const Feed := preload("res://addons/free_game_dev_assets/feed.gd")
8+
9+
## Fewer entries than this means the feed lost most of the catalog.
10+
const MIN_ENTRIES := 100
11+
12+
13+
func _initialize() -> void:
14+
var args := OS.get_cmdline_user_args()
15+
if args.is_empty() or not FileAccess.file_exists(args[0]):
16+
printerr("usage: -- <path to plugin-feed.json>")
17+
quit(2)
18+
return
19+
var r := Feed.parse(FileAccess.get_file_as_string(args[0]))
20+
if not r["ok"]:
21+
printerr("feed check failed: " + String(r["error"]))
22+
quit(1)
23+
return
24+
var feed: Dictionary = r["feed"]
25+
var problems: Array[String] = []
26+
if feed["entries"].size() < MIN_ENTRIES:
27+
problems.append("only %d entries" % feed["entries"].size())
28+
if r["dropped"] > 0:
29+
problems.append("%d malformed entries dropped" % r["dropped"])
30+
if feed["categories"].is_empty() or feed["licenseFamilies"].is_empty():
31+
problems.append("categories or licenseFamilies missing")
32+
var godot := 0
33+
for e in feed["entries"]:
34+
if "godot" in e["works_in"]:
35+
godot += 1
36+
if godot == 0:
37+
problems.append("no entry works in Godot")
38+
if not problems.is_empty():
39+
printerr("feed check failed: " + ", ".join(problems))
40+
quit(1)
41+
return
42+
print("feed ok: %s, %d entries, %d work in Godot" % [feed["version"], feed["entries"].size(), godot])
43+
quit(0)

0 commit comments

Comments
 (0)