Skip to content

Commit c9f055c

Browse files
committed
fix type hints for recording the results to a list of dictionaries.
1 parent 7b59c33 commit c9f055c

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.github/workflows/ci-cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
run: cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
162162

163163
- name: Run sccache stat for check
164-
run: ${{ env.SCCACHE_PATH }} --show-stats >> ${{ env.GITHUB_STEP_SUMMARY }}
164+
run: ${{ env.SCCACHE_PATH }} --show-stats >> $GITHUB_STEP_SUMMARY
165165
env:
166166
GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }}
167167

test/run-tests.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import urllib.request
1717
import zipfile
1818
from pathlib import Path
19-
from typing import List, Tuple
19+
from typing import Any, Dict, List, Tuple
2020

2121
# ----------------------------------------------
2222
# Configuration
@@ -184,13 +184,10 @@ def find_binary(pattern_part):
184184
# ----------------------------------------------
185185
# Helpers
186186
# ----------------------------------------------
187-
def record_test_result(results: list, version: str, success: bool, duration: int):
187+
def record_test_result(results: List[Dict[str, Any]], version: str, success: bool, duration: int) -> None:
188188
status = "✅ PASSED" if success else "❌ FAILED"
189-
results.append({
190-
"godot_version": version or "master",
191-
"status": status,
192-
"duration_seconds": duration
193-
})
189+
results.append({"godot_version": version or "master", "status": status, "duration_seconds": duration})
190+
194191

195192
def vprint(*args, **kwargs):
196193
if verbose:
@@ -574,7 +571,6 @@ def silent(*_args, **_kwargs):
574571

575572
overall_success = True
576573

577-
578574
results = [] # list of dicts for table + JSON
579575

580576
for version in versions:
@@ -643,9 +639,9 @@ def silent(*_args, **_kwargs):
643639
# Simple ASCII bar chart of current run durations (max bar = 60 chars)
644640
if results:
645641
f.write("\n### Duration (seconds)\n")
646-
max_dur = max(r['duration_seconds'] for r in results)
642+
max_dur = max(r["duration_seconds"] for r in results)
647643
for r in results:
648-
bar_len = int(60 * r['duration_seconds'] / max_dur) if max_dur > 0 else 0
644+
bar_len = int(60 * r["duration_seconds"] / max_dur) if max_dur > 0 else 0
649645
bar = "█" * bar_len
650646
f.write(f"{r['godot_version']:13} |{bar} {r['duration_seconds']}s\n")
651647
except Exception:
@@ -655,13 +651,18 @@ def silent(*_args, **_kwargs):
655651
metrics_path = SCRIPT_DIR / "test-metrics.json"
656652
try:
657653
import json
654+
658655
with open(metrics_path, "w", encoding="utf-8") as f:
659-
json.dump({
660-
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime()),
661-
"platform": os.environ.get("RUNNER_OS", "unknown"),
662-
"runner": os.environ.get("RUNNER_NAME", "unknown"),
663-
"results": results
664-
}, f, indent=2)
656+
json.dump(
657+
{
658+
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime()),
659+
"platform": os.environ.get("RUNNER_OS", "unknown"),
660+
"runner": os.environ.get("RUNNER_NAME", "unknown"),
661+
"results": results,
662+
},
663+
f,
664+
indent=2,
665+
)
665666
except Exception:
666667
pass
667668

0 commit comments

Comments
 (0)