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): booting a packaged game needs an engine, so it runs where one exists

esengine3b0470f2c12e
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 855a8847d..acb809dad 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -252,6 +252,13 @@ jobs:
ESTELLA_REQUIRE_WASM: '1'
run: node tools/check-arena-server.mjs
+ # Booting a packaged game needs the same real engine, and for the same
+ # reason it belongs here rather than in the fast lane.
+ - name: Check a packaged game's script failure
+ env:
+ ESTELLA_REQUIRE_WASM: '1'
+ run: node tools/check-script-failure.mjs
+
- name: Check performance snapshot
env:
ESENGINE_WASM_DIR: ${{ github.workspace }}/build/wasm/web
diff --git a/tools/check-script-failure.mjs b/tools/check-script-failure.mjs
index bdec98054..24108ec8e 100644
--- a/tools/check-script-failure.mjs
+++ b/tools/check-script-failure.mjs
@@ -18,7 +18,7 @@
* node tools/check-script-failure.mjs
*/
import { spawnSync } from 'node:child_process';
-import { cpSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { runElectron } from './lib/electronRun.mjs';
@@ -26,6 +26,24 @@ import { runElectron } from './lib/electronRun.mjs';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const WORK = path.join(ROOT, '.golden', 'script-failure');
const SOURCE = path.join(ROOT, 'examples', 'hello-world');
+
+// It BOOTS what it packages, so it needs a real engine — the same two places the
+// exporter looks. Skipped where building one is a choice, an error where CI has
+// the artifact: otherwise "no runtime here" reads as "the package is broken".
+const RUNTIME = [path.join(ROOT, 'build', 'wasm', 'web'),
+ path.join(ROOT, 'desktop', 'public', 'wasm')]
+ .find((d) => existsSync(path.join(d, 'esengine.wasm')));
+if (!RUNTIME) {
+ const build = 'node build-tools/cli.js build -t web';
+ if (process.env.ESTELLA_REQUIRE_WASM) {
+ console.error('check-script-failure: ESTELLA_REQUIRE_WASM is set and there is no engine'
+ + ` runtime in build/wasm/web or desktop/public/wasm.\n ${build}`);
+ process.exit(1);
+ }
+ console.log('check-script-failure: no engine runtime to boot — skipped'
+ + ` (build it with \`${build}\`; the engine-coupled CI job sets ESTELLA_REQUIRE_WASM).`);
+ process.exit(0);
+}
const LAUNCHER = path.join(ROOT, 'tools', 'launchers', 'launch-export.mjs');
const MARKER = 'DOGFOOD_BOOT_FAILURE';
diff --git a/tools/gates.mjs b/tools/gates.mjs
index a9a61c0cd..edbf07df6 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -270,7 +270,13 @@ export const GATES = [
// Windows deletes asynchronously: the rmdir races the unlink it just did, and
// the temp tree a test made comes back ENOTEMPTY at random. Node's retry loop
// is right there and defaults to OFF.
- { id: 'script-failure', run: 'node tools/check-script-failure.mjs' },
+ {
+ id: 'script-failure',
+ run: 'node tools/check-script-failure.mjs',
+ where: 'local',
+ why: 'it BOOTS the package it builds, so it needs a real engine runtime and the fast CI'
+ + ' lane builds none; the engine-coupled job runs it on the artifact',
+ },
{ id: 'screen-domain', run: 'node tools/check-screen-domain.mjs' },
{ id: 'rm-retries', run: 'node tools/check-rm-retries.mjs' },
{ id: 'examples', run: 'node build-tools/cli.js check-examples' },