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.

ci(nightly): the exit criteria, run by a machine

yhh923ba14658e5
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
new file mode 100644
index 000000000..61113ada1
--- /dev/null
+++ b/.github/workflows/nightly.yml
@@ -0,0 +1,89 @@
+name: Nightly
+
+# The exit criteria, run by a machine.
+#
+# releaseGate.mjs holds 31 automated criteria and nothing ever ran them: the only
+# runner was a release captain typing 27 commands, so a criterion could be red for
+# weeks with every push green. hot-update-lands-or-rolls-back was, and the pixel
+# gates at the `nightly` tier — declared, named, and invoked by nothing at all.
+#
+# The list is NOT repeated here. Each job calls run-release-gate.mjs for the host
+# it is standing on, because a workflow that named the commands itself would be
+# the second list gates.mjs exists to prevent. `host` lives on the criterion.
+on:
+ schedule:
+ # 04:00 UTC, after the day's pushes have settled.
+ - cron: '0 4 * * *'
+ workflow_dispatch:
+
+jobs:
+ # The criteria read a real engine, and the render host takes the artifact from
+ # THIS run — so the nightly builds its own rather than reaching for a push's.
+ build-emscripten:
+ name: Web (Emscripten)
+ runs-on: ubuntu-latest
+ timeout-minutes: 40
+
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: ./.github/actions/engine-submodules
+ - uses: ./.github/actions/setup
+
+ - name: Setup Emscripten
+ uses: mymindstorm/setup-emsdk@v16
+ with:
+ version: 5.0.0
+
+ - name: Setup ccache
+ uses: hendrikmuhs/[email protected]
+ with:
+ key: ${{ runner.os }}-emscripten
+ max-size: 500M
+
+ - name: Build every target
+ run: node build-tools/cli.js build -t all --no-sync
+
+ - name: Upload web wasm artifact
+ uses: actions/upload-artifact@v7
+ with:
+ name: wasm-web
+ path: build/wasm/web/
+ retention-days: 3
+
+ # 27 of the 31. The runner names the four it cannot answer from here and the
+ # four nobody can automate, so a green job is never read as a green release.
+ linux:
+ name: Exit criteria (linux)
+ runs-on: ubuntu-latest
+ needs: build-emscripten
+ timeout-minutes: 90
+
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: ./.github/actions/engine-submodules
+ - uses: ./.github/actions/setup
+ - uses: ./.github/actions/render-host
+
+ - name: Run the exit criteria
+ run: node tools/run-release-gate.mjs --host linux
+
+ # every-pixel-gate-runs, whose second half needs a GPU: a Linux runner ships no
+ # graphics driver and every webgpu run there died in requestDevice. The
+ # criterion says so itself, in its `why`.
+ macos:
+ name: Exit criteria (macos)
+ runs-on: macos-latest
+ needs: build-emscripten
+ timeout-minutes: 90
+
+ steps:
+ - uses: actions/checkout@v7
+
+ - uses: ./.github/actions/engine-submodules
+ - uses: ./.github/actions/setup
+ - uses: ./.github/actions/render-host
+
+ - name: Run the exit criteria
+ run: node tools/run-release-gate.mjs --host macos
diff --git a/tools/check-release-gate.mjs b/tools/check-release-gate.mjs
index b43ab1385..6a0260b0a 100644
--- a/tools/check-release-gate.mjs
+++ b/tools/check-release-gate.mjs
@@ -51,6 +51,15 @@ for (const c of CRITERIA) {
if (c.manual !== undefined && !(typeof c.manual === 'string' && c.manual.trim())) {
fail(`"${c.id}" is manual without saying who does it and why a machine cannot`);
}
+ // A criterion that can only be answered somewhere particular owes the reason,
+ // exactly as a gate's `where` owes its `why`: unexplained, it reads as a
+ // criterion somebody quietly stopped running.
+ const HOSTS = ['linux', 'macos', 'android', 'device'];
+ if (c.host !== undefined) {
+ if (!HOSTS.includes(c.host)) fail(`"${c.id}" declares host "${c.host}" (have: ${HOSTS.join(', ')})`);
+ if (!c.why?.trim()) fail(`"${c.id}" narrows to one host without saying why the others cannot answer it`);
+ }
+ if (c.why && c.host === undefined) fail(`"${c.id}" gives a why for a host it does not declare`);
// The point of `needs`: a verifier that is deleted or renamed fails HERE,
// loudly, rather than at whatever moment somebody trusts the list next.
if (c.answeredBy && !c.needs?.length) fail(`"${c.id}" names a command but no file it lives in`);
diff --git a/tools/releaseGate.mjs b/tools/releaseGate.mjs
index 57191476e..3ad2009b6 100644
--- a/tools/releaseGate.mjs
+++ b/tools/releaseGate.mjs
@@ -32,6 +32,11 @@ export const RELEASE = JSON.parse(readFileSync(
/**
* `answeredBy` is a shell command run from the repo root; `needs` are the files
* it lives in, so deleting a verifier fails the gate rather than the release.
+ *
+ * `host` says where a criterion CAN be answered — the same dimension gates.mjs
+ * spells `where`, and it owes a `why` for the same reason. Absent means a plain
+ * Linux runner, which is most of them; the four that say otherwise need a GPU,
+ * an Android toolchain, or a phone somebody is holding.
*/
export const CRITERIA = [
{
@@ -54,6 +59,8 @@ export const CRITERIA = [
},
{
id: 'launch-smoke-every-platform',
+ host: 'android',
+ why: 'verify-native-boot boots the package on an emulator, which needs the Android SDK',
says: 'every shipping platform launches a package and draws',
answeredBy: 'node tools/verify-golden.mjs --tier release'
+ ' && node tools/verify-desktop-render.mjs --tier pr'
@@ -67,6 +74,8 @@ export const CRITERIA = [
},
{
id: '3d-runs-where-it-ships',
+ host: 'android',
+ why: 'the same emulator boot, for the 3D corpus',
says: 'a game whose world is 3D packages, launches and answers input — on the web and on a device',
// Two ways for the solver to be absent — a side module fetched beside the
// engine, a library compiled into a native host — and both leave a game
@@ -77,6 +86,8 @@ export const CRITERIA = [
},
{
id: 'every-pixel-gate-runs',
+ host: 'macos',
+ why: 'the second backend needs a real GPU — a Linux runner ships no graphics driver and every webgpu run there died in requestDevice',
says: 'every declared pixel gate has run, not just the ones CI happens to list',
// CI pays for the pr tier on each push. The rest — spine, video, particles,
// every material scene, text, ktx2 — was declared and run by nothing at all
@@ -180,6 +191,8 @@ export const CRITERIA = [
},
{
id: 'a-crash-leaves-something-the-player-can-send',
+ host: 'device',
+ why: '--require-device: a boot record surviving a crash is a claim about real hardware, and a simulator cannot make it',
says: 'the boot record survives a crash on a real device, with the phase and a backtrace',
// `--require-device` on purpose: without it the tool skips where there is no
// phone, which is right on a laptop and is a false pass under a release.
diff --git a/tools/run-release-gate.mjs b/tools/run-release-gate.mjs
index 2d75fe816..f35473721 100644
--- a/tools/run-release-gate.mjs
+++ b/tools/run-release-gate.mjs
@@ -29,9 +29,16 @@ const flag = (name) => {
return i >= 0 ? argv[i + 1] : null;
};
const ONLY = flag('only')?.split(',').map((s) => s.trim()).filter(Boolean) ?? null;
+// Where this runner is standing. A criterion says which host can answer it; the
+// default is a plain Linux runner, which is 27 of the 31.
+const HOST = flag('host') ?? 'linux';
-const automated = CRITERIA.filter((c) => c.answeredBy)
+const runnable = CRITERIA.filter((c) => c.answeredBy);
+const automated = runnable
+ .filter((c) => (c.host ?? 'linux') === HOST)
.filter((c) => !ONLY || ONLY.some((o) => c.id.includes(o)));
+/** Answerable, but not from here — named below, never silently absent. */
+const elsewhere = runnable.filter((c) => (c.host ?? 'linux') !== HOST);
const manual = CRITERIA.filter((c) => c.manual);
/**
@@ -48,14 +55,24 @@ for (const c of automated) {
}
console.log(`release gate ${RELEASE}: ${automated.length} criteria in ${jobs.length} command(s)`
- + (ONLY ? ` (--only ${ONLY.join(',')})` : ''));
+ + ` on host ${HOST}` + (ONLY ? ` (--only ${ONLY.join(',')})` : ''));
if (argv.includes('--plan')) {
for (const j of jobs) console.log(` ${j.ids.join(', ')}\n ${j.run}`);
for (const m of manual) console.log(` BY HAND ${m.id} — ${m.manual}`);
+ reportElsewhere();
process.exit(0);
}
+/** What another host owes, so a green run here is never read as a green release.
+ * Only a NARROWED criterion carries a why; the default host is not a narrowing
+ * and has nothing to explain. */
+function reportElsewhere() {
+ for (const c of elsewhere) {
+ console.log(` not on this host: ${c.id} (${c.host ?? 'linux'})${c.why ? ` — ${c.why}` : ''}`);
+ }
+}
+
// Every criterion, not the first failure: which of them a release is short of is
// the useful answer, and stopping early turns the rest into silence — the same
// reason verify-render reports its whole matrix.
@@ -83,4 +100,5 @@ for (const j of failed) console.log(` ✗ ${j.ids.join(', ')} — ${j.why}`);
// summary that omits the four nobody can automate reads as though it is.
console.log(` ${manual.length} criteria are BY HAND and this cannot answer them:`);
for (const m of manual) console.log(` ${m.id} — ${m.manual}`);
+reportElsewhere();
process.exit(short.length ? 1 : 0);