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(verify): the flagship blamed its route for a runner that could not draw

esenginefca6dc331f75
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index b5c418d03..e88eca2f3 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -96,6 +96,19 @@ jobs:
with:
version: 5.0.0
+ # electron-preconditions: job-wide. play-stop-conserves and scene-churn-flat
+ # run the EDITOR's own check scripts, which live in the private submodule and
+ # cannot import electronRun — so both aborted in the SUID sandbox helper and
+ # reported "timeout initialize" about the editor. One display for every step,
+ # rather than a prefix on a command that lives in releaseGate.mjs.
+ - name: A display for the whole job
+ run: |
+ Xvfb :99 -screen 0 1920x1080x24 &
+ for _ in $(seq 1 30); do [ -e /tmp/.X11-unix/X99 ] && break; sleep 1; done
+ test -e /tmp/.X11-unix/X99
+ echo "DISPLAY=:99" >> "$GITHUB_ENV"
+ echo "ELECTRON_DISABLE_SANDBOX=1" >> "$GITHUB_ENV"
+
- name: Run the exit criteria
run: node tools/run-release-gate.mjs --host linux
diff --git a/tools/check-electron-preconditions.mjs b/tools/check-electron-preconditions.mjs
index b19bbb37b..57af83643 100644
--- a/tools/check-electron-preconditions.mjs
+++ b/tools/check-electron-preconditions.mjs
@@ -14,6 +14,7 @@
* that supplies by hand what electronRun now supplies for every caller.
*/
import { readdirSync, readFileSync, statSync } from 'node:fs';
+import { execFileSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -21,6 +22,9 @@ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const TOOLS = path.join(ROOT, 'tools');
const WORKFLOWS = path.join(ROOT, '.github', 'workflows');
+const tracked = (glob) => execFileSync('git', ['ls-files', glob], { cwd: ROOT, encoding: 'utf8' })
+ .split('\n').filter(Boolean);
+
/**
* Not every Electron on a runner is ours to condition. The desktop scripts live
* in the private editor submodule, which cannot import from tools/; the native
@@ -60,6 +64,22 @@ for (const file of sources(TOOLS)) {
// broke — the first version of this file said 0 and passed.
if (!launchers) problems.push('tools/ — found no electron launcher at all; this scan is broken');
+// The other half: a runner has no GPU, and Chromium blocklists WebGL2 rather
+// than falling back. Six launchers said so and the seventh did not, so the
+// flagship blamed its route for a machine where nothing could draw.
+let mains = 0;
+for (const rel of tracked('tools/launchers/*.mjs').concat(tracked('tools/render-host/*.mjs'))) {
+ const src = readFileSync(path.join(ROOT, rel), 'utf8');
+ // An Electron MAIN process is the one that can set a command-line switch; the
+ // shared modules beside them run in the page and have no say.
+ if (!/app\.(commandLine|whenReady)/.test(src)) continue;
+ mains++;
+ if (!/enable-unsafe-swiftshader/.test(src)) {
+ problems.push(`${rel} — launches Electron without the software-GL fallback`);
+ }
+}
+if (!mains) problems.push('tools/launchers — found no Electron main at all; this scan is broken');
+
// And the other direction: a workflow that still hands a verifier the display
// it now brings itself, which is the second list growing back.
for (const name of readdirSync(WORKFLOWS)) {
@@ -73,6 +93,10 @@ for (const name of readdirSync(WORKFLOWS)) {
// command below it — near enough that reading a few lines on finds it.
const near = lines.slice(i, i + 4).join('\n');
if (NOT_OURS.some((re) => re.test(near))) return;
+ // A job-wide display, declared. The private editor's scripts cannot import
+ // electronRun, so a job that runs them has to stand one up for everybody —
+ // which is not the same as writing the prefix beside a verifier that owns it.
+ if (/electron-preconditions: job-wide/.test(lines.slice(Math.max(0, i - 16), i + 2).join('\n'))) return;
problems.push(`${rel}:${i + 1} — supplies what electronRun supplies: ${line.trim().slice(0, 80)}`);
});
}
@@ -82,5 +106,5 @@ if (problems.length) {
for (const p of problems) console.error(` ${p}`);
process.exit(1);
}
-console.log(`check-electron-preconditions: ${launchers} verifier(s) launch electron, all through electronRun;`
- + ' no workflow supplies its conditions by hand.');
+console.log(`check-electron-preconditions: ${launchers} verifier(s) launch electron through electronRun,`
+ + ` ${mains} Electron main(s) carry the software-GL fallback, and no workflow supplies either by hand.`);
diff --git a/tools/launchers/play-through.mjs b/tools/launchers/play-through.mjs
index 8171913a9..2f50f2ba8 100644
--- a/tools/launchers/play-through.mjs
+++ b/tools/launchers/play-through.mjs
@@ -42,6 +42,10 @@ import { existsSync } from 'node:fs';
import path from 'node:path';
import { onRendererConsole } from '../lib/rendererConsole.mjs';
+// Every other launcher has this and this one did not, so on a runner with no GPU
+// Chromium blocklisted WebGL2, the game drew nothing, and the flagship criterion
+// reported that its route could not be played.
+app.commandLine.appendSwitch('enable-unsafe-swiftshader');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
const argv = process.argv.slice(2);
diff --git a/tools/lib/electronRun.mjs b/tools/lib/electronRun.mjs
index 25f561f37..433224198 100644
--- a/tools/lib/electronRun.mjs
+++ b/tools/lib/electronRun.mjs
@@ -23,7 +23,10 @@ import { runTool } from './runTool.mjs';
* golden asks for and shallower than a pixel judgement should be read from. */
const SCREEN = '-screen 0 1920x1080x24';
-export const NEEDS_XVFB = process.platform === 'linux' && !process.env.ESTELLA_NO_XVFB;
+// A job that already stands up one display for every step (because the private
+// editor's scripts cannot import this file) has given us one too.
+export const NEEDS_XVFB = process.platform === 'linux'
+ && !process.env.DISPLAY && !process.env.ESTELLA_NO_XVFB;
/**
* Run Electron with a script and its arguments, under whatever this host needs.
diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjs
index 90f0543b8..9793455f9 100644
--- a/tools/verify-golden.mjs
+++ b/tools/verify-golden.mjs
@@ -251,7 +251,11 @@ for (const { id, target } of pairs) {
if (exported.status !== 0) {
results.push({ id, target, stage: 'package', ok: false, why: (exported.stderr || exported.stdout || '').trim().slice(-300) });
+ // The reason was recorded and never printed, so the whole account of a
+ // failed export was two words. It is the only place the exporter speaks.
+ const why = (exported.stderr || exported.stdout || '').trim();
console.log(`✗ ${id} ${target} — package failed`);
+ for (const l of why.split('\n').slice(-8)) if (l.trim()) console.log(` ${l}`);
continue;
}
@@ -545,6 +549,8 @@ const bad = results.filter((r) => !r.ok);
console.log(`\ngolden ${TIER}: ${results.length - bad.length}/${results.length} pair(s) packaged and launched`);
for (const d of deferred) console.log(` deferred: ${d}`);
if (bad.length) {
- for (const b of bad) console.log(` ✗ ${b.id} ${b.target} (${b.stage})`);
+ for (const b of bad) {
+ console.log(` ✗ ${b.id} ${b.target} (${b.stage})${b.why ? ` — ${b.why.split('\n').pop()}` : ''}`);
+ }
process.exit(1);
}