-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 3.57 KB
/
Copy pathci.yml
File metadata and controls
90 lines (77 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: CI
# Runs the four manifest gates on every push to main and every PR:
# 1. compile gate — every engine .gd parses/type-checks (tools/check_scripts.gd)
# 2. unit tests — the GUT suite under test/ (0 tests or a skipped script fails)
# 3. leak gate — benchmark's portable ObjectDB-leak detector
# 4. lint gate — gdlint over addons/card_combat (.gdlintrc config)
# The benchmark's µs figures are hardware-specific and NOT asserted here; only its
# leak detector (exit 1 on a reference cycle) is portable, so CI runs it with a
# small combat count for speed.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
env:
GODOT_VERSION: "4.6"
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Cache the extracted binary keyed by version so a re-run skips the download.
- name: Cache Godot binary
id: cache-godot
uses: actions/cache@v4
with:
path: ~/godot-bin
key: godot-${{ env.GODOT_VERSION }}-stable-linux
- name: Install Godot ${{ env.GODOT_VERSION }}
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
set -euo pipefail
BASE="Godot_v${GODOT_VERSION}-stable_linux.x86_64"
URL="https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/${BASE}.zip"
mkdir -p ~/godot-bin
curl -fsSL "$URL" -o /tmp/godot.zip
unzip -o /tmp/godot.zip -d ~/godot-bin
mv ~/godot-bin/${BASE} ~/godot-bin/godot
chmod +x ~/godot-bin/godot
- name: Add Godot to PATH
run: echo "$HOME/godot-bin" >> "$GITHUB_PATH"
# First headless run generates the .godot import cache (icon, etc.); without it
# GUT can fail to load resources. Import errors must surface, so no `|| true`.
- name: Import resources
run: godot --headless --path . --import
- name: Compile gate
run: godot --headless --path . --script addons/card_combat/tools/check_scripts.gd
# GUT's exit code alone cannot be trusted: it exits 0 both when it collects
# ZERO tests ("Nothing was run") and when a test script fails to parse (it
# skips the whole file and reports the remaining tests green). Both verified
# empirically on GUT 9.6. So the step also fails on an empty run and on any
# skipped/unloadable test script — 0 tests is never a pass (repo rule).
- name: Unit tests (GUT)
run: |
set -euo pipefail
godot --headless --path . -s addons/gut/gut_cmdln.gd -gdir=res://test -ginclude_subdirs -gexit 2>&1 | tee /tmp/gut.log
tests="$(awk '/^Tests/ {print $2; exit}' /tmp/gut.log)"
if [ -z "${tests}" ] || [ "${tests}" -eq 0 ]; then
echo "::error::GUT collected 0 tests — test collection is broken"
exit 1
fi
if grep -qE "Failed to load script|SCRIPT ERROR" /tmp/gut.log; then
echo "::error::GUT skipped at least one test script that failed to load/parse"
exit 1
fi
echo "GUT ran ${tests} tests"
- name: Leak gate (benchmark)
run: godot --headless --path . --script addons/card_combat/benchmark/combat_benchmark.gd -- 40
# Complementary lint gate (manifest `lint` command): gdlint catches the
# correctness/naming smells the headless compile gate cannot see. Config in
# .gdlintrc at the repo root.
- name: Lint gate (gdlint)
run: |
set -euo pipefail
python3 -m pip install --quiet "gdtoolkit==4.*"
gdlint addons/card_combat