Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(ci): compare the scene the package ships, and stop pretending about video

esengine341fa0fadac2
diff --git a/examples/hot-update-demo/updates/v2-manifest.json.meta b/examples/hot-update-demo/updates/v2-manifest.json.meta
new file mode 100644
index 000000000..7056c693a
--- /dev/null
+++ b/examples/hot-update-demo/updates/v2-manifest.json.meta
@@ -0,0 +1,6 @@
+{
+ "uuid": "e4d19289-eb58-4352-926c-231d0f7e3abb",
+ "version": "2.0",
+ "type": "json",
+ "importer": {}
+}
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index ff3224c09..af307cf3a 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -153,6 +153,10 @@ export const GOLDEN = [
certifies: ['single-file'],
targets: ['playable', 'web'],
tier: 'nightly',
+ // Measured: this package scores 0.0763 against ITSELF — it shuffles the tiles
+ // per run and the video is at a different timestamp each time. Nothing the
+ // comparison says about it would be about the packaging.
+ parityGap: 'shuffles per run and plays video; two runs of one build do not match either',
interactGap: 'pointer-driven; no stable tile target pinned yet',
},
{
diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjs
index c25f65376..4b9b12a49 100644
--- a/tools/verify-golden.mjs
+++ b/tools/verify-golden.mjs
@@ -37,6 +37,10 @@ const NO_PARITY = argv.includes('--no-parity');
* A mini-game needs its vendor's globals, so it goes through its own launcher. */
const OWNED = new Set(['web', 'playable', 'wechat']);
const LAUNCHER = (target) => (target === 'wechat' ? 'launch-minigame.mjs' : 'launch-export.mjs');
+/** Targets whose surface this runner can size to the editor's, which is what
+ * makes a frame comparable at all. Measured on one project: web 0.0009,
+ * playable 0.0027, wechat 0.0027 — the packaging wrapper is not what differs. */
+const COMPARABLE = OWNED;
const DESKTOP = path.join(ROOT, 'desktop');
if (SHOTS) mkdirSync(SHOTS, { recursive: true });
@@ -50,14 +54,21 @@ const deferred = projects.flatMap((g) => g.targets.filter((t) => !OWNED.has(t)).
console.log(`golden ${TIER}: ${projects.length} project(s), ${pairs.length} pair(s) here`
+ (deferred.length ? `, ${deferred.length} left to the platform verifiers` : ''));
-/** The shape the game is authored for. A package derives its orientation gate
- * from this, so the comparison surface has to agree with it. */
-function designAspect(id) {
+/** What the project declares: the shape it is authored for, and the scene a
+ * package will ship as its entry. */
+function manifestOf(id) {
try {
- const r = JSON.parse(readFileSync(path.join(projectDir(id), 'project.esproject'), 'utf8')).designResolution;
- if (r?.width > 0 && r?.height > 0) return { w: r.width, h: r.height };
- } catch { /* fall through to the default shape */ }
- return { w: 16, h: 9 };
+ return JSON.parse(readFileSync(path.join(projectDir(id), 'project.esproject'), 'utf8'));
+ } catch {
+ return {};
+ }
+}
+
+/** A package derives its orientation gate from this, so the comparison surface
+ * has to agree with it. */
+function designAspect(id) {
+ const r = manifestOf(id).designResolution;
+ return r?.width > 0 && r?.height > 0 ? { w: r.width, h: r.height } : { w: 16, h: 9 };
}
/**
@@ -79,6 +90,10 @@ function captureEditorFrame(id, out) {
...process.env,
ESTELLA_SHOT: out,
ESTELLA_SHOT_PROJECT: projectDir(id),
+ // The scene the PACKAGE ships, named rather than inherited: opening a
+ // project reopens whatever was last open, which is untracked local state —
+ // so the two sides would differ by a developer's workspace file.
+ ...(manifestOf(id).defaultScene ? { ESTELLA_SHOT_SCENE: manifestOf(id).defaultScene } : {}),
ESTELLA_SHOT_PLAY: '1',
ESTELLA_SHOT_CROP: 'iframe[title="Game"]',
ESTELLA_SHOT_EVAL: `window.__estellaEditor.setPanelSize('viewport', ${JSON.stringify(panel)})`,
@@ -110,7 +125,7 @@ for (const { id, target } of pairs) {
// Parity compares like for like, so the package is opened at exactly the size
// the editor's play surface came out — never a guessed one.
const golden = atTier(TIER).find((g) => g.id === id);
- const tolerance = target === 'web' && !NO_PARITY ? parityFor(golden) : null;
+ const tolerance = COMPARABLE.has(target) && !NO_PARITY ? parityFor(golden) : null;
const editorPng = path.join(WORK, `${id}-editor.png`);
const editor = tolerance != null ? captureEditorFrame(id, editorPng) : null;
if (editor && !editor.ok) {