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: the android exit criterion boots the template this commit builds, through one action

esengine25371bd8ebc7
diff --git a/.github/actions/android-template/action.yml b/.github/actions/android-template/action.yml
new file mode 100644
index 000000000..3cf629237
--- /dev/null
+++ b/.github/actions/android-template/action.yml
@@ -0,0 +1,55 @@
+name: Android runtime template from this checkout
+description: Build the Android runtime template (arm64-v8a + x86_64) from the checked-out engine into a directory.
+
+# One build, wherever an Android template has to come from this commit — the
+# release, the nightly exit criteria, the smoke and compat runs. Four hand copies
+# had already drifted: one keyed its cache by hand and another lost the partial
+# restore, so the same commit paid for Dawn in one job and not the next.
+#
+# Expects the checkout's engine submodules, the setup action and a built SDK: the
+# SDK bundle is compiled INTO the host, and every caller builds it for its own use.
+
+inputs:
+ out:
+ description: Directory the template archive is written into.
+ required: false
+ default: artifacts
+
+runs:
+ using: composite
+ steps:
+ - name: Read the native dependency pins
+ id: pins
+ shell: bash
+ run: node build-tools/cli.js native --deps-cache-key android >> "$GITHUB_OUTPUT"
+
+ # The partial restore on purpose: a Dawn build for a different pin is still most
+ # of this one's object files.
+ - name: Cache the pinned checkouts + Dawn builds
+ uses: actions/cache@v4
+ with:
+ path: build/native-deps
+ key: ${{ steps.pins.outputs.key }}
+ restore-keys: native-deps-android-
+
+ - name: Set up the Android NDK
+ id: ndk
+ uses: nttld/setup-ndk@v1
+ with:
+ ndk-version: r28
+
+ - name: Fetch Dawn + QuickJS at their pinned commits
+ shell: bash
+ run: node build-tools/cli.js native --fetch-deps
+
+ # Both ABIs into ONE template: arm64 is every real device, x86_64 the emulator.
+ # The emitter refuses an incomplete template, so an x86_64-only build fails at
+ # the emit rather than the compile.
+ - name: Build the template (arm64 + x86_64)
+ shell: bash
+ env:
+ ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
+ OUT: ${{ inputs.out }}
+ run: |
+ node build-tools/cli.js native --abi arm64-v8a
+ node build-tools/cli.js native --abi x86_64 --template-out "$OUT"
diff --git a/.github/actions/native-template/action.yml b/.github/actions/native-template/action.yml
index 01839031c..f43ecdd61 100644
--- a/.github/actions/native-template/action.yml
+++ b/.github/actions/native-template/action.yml
@@ -1,55 +1,64 @@
-name: Runtime template from a release
-description: Download and unpack a published native runtime template into template/.
+name: Runtime template into template/
+description: Verify and unpack a native runtime template into template/ — archives already on disk, or a published release.
# What a game is packaged INTO. verify-native-boot defaults to <root>/template,
# which a plain checkout does not have — and unchecked, every one of 47 exports
# failed with an empty reason before it learned to say so.
#
-# The RELEASE template on purpose, not this branch's: building one costs ~40
-# minutes, which a nightly cannot pay daily. What that answers is the half a
-# creator lives in — today's game content on the host they already installed.
-# HEAD's own template is native-smoke's question, and the release pipeline calls
-# it. Two halves, not two copies.
+# Where the archive comes from is the caller's question: `from-dir` takes archives
+# already on disk (built from this checkout by the android-template action, or an
+# artifact of this run), and without it the release names one. Either way it is
+# checked the same way before anything is packaged into it.
inputs:
platform:
description: android or ios.
required: true
+ from-dir:
+ description: Directory holding the template archive already (blank = download it from a release).
+ required: false
+ default: ''
tag:
- description: Release tag to take it from (blank = the latest release).
+ description: Release tag to download from when `from-dir` is blank (blank = the latest release).
required: false
default: ''
token:
- description: Token for `gh release download`.
- required: true
+ description: Token for `gh release download`; needed only when downloading.
+ required: false
+ default: ''
runs:
using: composite
steps:
- - name: Take the template from the release
+ - name: Take the template
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
TAG: ${{ inputs.tag }}
PLATFORM: ${{ inputs.platform }}
+ FROM_DIR: ${{ inputs.from-dir }}
run: |
set -euo pipefail
- if [ -z "$TAG" ]; then
- TAG=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName)
- echo "no tag given — taking the $PLATFORM template from $TAG"
+ DIR="$FROM_DIR"
+ if [ -z "$DIR" ]; then
+ if [ -z "$TAG" ]; then
+ TAG=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName)
+ echo "no tag given — taking the $PLATFORM template from $TAG"
+ fi
+ # NOT `templates/`, which the checkout already uses for the eight project
+ # starters: downloading into it works only while nothing else there is a
+ # zip, and `unzip templates/*.zip` would then take whichever came first.
+ DIR=.native-template-dl
+ rm -rf "$DIR"
+ gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \
+ -p "estella-native-$PLATFORM-*.zip" -D "$DIR"
fi
- # NOT `templates/`, which the checkout already uses for the eight project
- # starters: downloading into it works only while nothing else there is a
- # zip, and `unzip templates/*.zip` would then take whichever came first.
- rm -rf .native-template-dl
- gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \
- -p "estella-native-$PLATFORM-*.zip" -D .native-template-dl
# Under release strictness, so nothing is packaged around an archive the
# publish gate would reject anyway.
- node build-tools/cli.js verify-template .native-template-dl/*.zip
+ node build-tools/cli.js verify-template "$DIR"/estella-native-"$PLATFORM"-*.zip
rm -rf template && mkdir -p template
- unzip -q .native-template-dl/*.zip -d template
+ unzip -q "$DIR"/estella-native-"$PLATFORM"-*.zip -d template
# `mkdir -p` already made the directory, so its existence proves nothing;
# what the next step needs is that the archive put something in it.
[ -n "$(ls -A template)" ] || { echo "::error::$PLATFORM template unpacked to nothing"; exit 1; }
- echo "unpacked $(ls .native-template-dl) into template/ ($(ls -A template | wc -l) entries)"
+ echo "unpacked $(ls "$DIR") into template/ ($(ls -A template | wc -l) entries)"
diff --git a/.github/workflows/android-canary-apk.yml b/.github/workflows/android-canary-apk.yml
index 5864947c1..e4a33ef1a 100644
--- a/.github/workflows/android-canary-apk.yml
+++ b/.github/workflows/android-canary-apk.yml
@@ -96,65 +96,20 @@ jobs:
fi
echo "from=$WANT" >> "$GITHUB_OUTPUT"
- - name: Take the template from the latest release
- if: steps.src.outputs.from == 'release'
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- set -euo pipefail
- TAG=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName)
- echo "template from $TAG"
- mkdir -p artifacts
- gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \
- -p 'estella-native-android-*.zip' -D artifacts
-
- - name: Read the native dependency pins
- if: steps.src.outputs.from == 'head'
- id: pins
- run: |
- node -e "const p=require('./toolchain.manifest.json').native;\
- console.log('dawn='+p.dawn.commit);console.log('quickjs='+p.quickjs.commit)" >> "$GITHUB_OUTPUT"
-
- # restore-keys without the pins, because a Dawn build for a DIFFERENT pin is
- # still most of this one's object files. Note the release pipeline's own cache
- # is written from a tag ref and is therefore unreachable from any branch —
- # see the PR discussion; warming this from master is separate work.
- - name: Cache the pinned checkouts + Dawn builds
- if: steps.src.outputs.from == 'head'
- uses: actions/cache@v4
- with:
- path: build/native-deps
- key: native-deps-android-${{ steps.pins.outputs.dawn }}-${{ steps.pins.outputs.quickjs }}
- restore-keys: native-deps-android-
-
- - name: Set up the Android NDK
- if: steps.src.outputs.from == 'head'
- uses: nttld/setup-ndk@v1
- id: ndk
- with:
- ndk-version: r28
-
- - name: Fetch Dawn + QuickJS at their pinned commits
- if: steps.src.outputs.from == 'head'
- run: node build-tools/cli.js native --fetch-deps
-
# BOTH ABIs, even though every emulator here is x86_64: ANDROID_ABIS names
# arm64-v8a and x86_64 as what a template must carry, and the emitter refuses
- # an incomplete one. An x86_64-only build fails at the emit step, not at the
- # compile — which is exactly how this was found.
+ # an incomplete one.
- name: Build the Android runtime template from this branch
if: steps.src.outputs.from == 'head'
- env:
- ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
- run: |
- node build-tools/cli.js native --abi arm64-v8a
- node build-tools/cli.js native --abi x86_64 --template-out artifacts
+ uses: ./.github/actions/android-template
+ with:
+ out: artifacts
- - name: Unpack the template
- run: |
- node build-tools/cli.js verify-template artifacts/*.zip
- mkdir -p template
- unzip -q artifacts/*.zip -d template
+ - uses: ./.github/actions/native-template
+ with:
+ platform: android
+ from-dir: ${{ steps.src.outputs.from == 'head' && 'artifacts' || '' }}
+ token: ${{ secrets.GITHUB_TOKEN }}
# Packaged the way the editor's Package dialog does it, once: every version
# in the matrix installs the identical file, so a difference between two rows
diff --git a/.github/workflows/native-smoke.yml b/.github/workflows/native-smoke.yml
index d10109962..2f0346a2a 100644
--- a/.github/workflows/native-smoke.yml
+++ b/.github/workflows/native-smoke.yml
@@ -101,29 +101,31 @@ jobs:
- name: Build SDK
run: pnpm --filter ./sdk build
+ - name: Build the Android template (arm64 + x86_64)
+ if: matrix.name == 'android'
+ uses: ./.github/actions/android-template
+ with:
+ out: artifacts
+
- name: Read the native dependency pins
+ if: matrix.name == 'ios'
id: pins
shell: bash
- run: node build-tools/cli.js native --deps-cache-key ${{ matrix.name }} >> "$GITHUB_OUTPUT"
+ run: node build-tools/cli.js native --deps-cache-key ios >> "$GITHUB_OUTPUT"
- name: Cache the pinned checkouts + Dawn builds
+ if: matrix.name == 'ios'
uses: actions/cache@v4
with:
path: build/native-deps
key: ${{ steps.pins.outputs.key }}
- name: Set up CMake + Ninja
- if: startsWith(matrix.os, 'macos')
+ if: matrix.name == 'ios'
run: brew install cmake ninja
- - name: Set up the Android NDK
- if: matrix.name == 'android'
- uses: nttld/setup-ndk@v1
- id: ndk
- with:
- ndk-version: r28
-
- name: Fetch Dawn + QuickJS at their pinned commits
+ if: matrix.name == 'ios'
run: node build-tools/cli.js native --fetch-deps
- name: Build the iOS template (device + simulator)
@@ -132,16 +134,6 @@ jobs:
node build-tools/cli.js native --target ios --simulator --no-template
node build-tools/cli.js native --target ios --template-out artifacts
- # Both architectures into ONE template: the emitter refuses an incomplete
- # one, and an x86_64-only build fails at the emit rather than the compile.
- - name: Build the Android template (arm64 + x86_64)
- if: matrix.name == 'android'
- env:
- ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
- run: |
- node build-tools/cli.js native --abi arm64-v8a
- node build-tools/cli.js native --abi x86_64 --template-out artifacts
-
# The name the shards below download when no tag names a release.
- name: Upload template artifact
uses: actions/upload-artifact@v7
@@ -182,14 +174,6 @@ jobs:
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- - name: Take the template from the release
- if: steps.src.outputs.tag != ''
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- gh release download "${{ steps.src.outputs.tag }}" --repo "$GITHUB_REPOSITORY" \
- -p 'estella-native-android-*.zip' -D templates
-
- name: Take the template from this run
if: steps.src.outputs.tag == ''
uses: actions/download-artifact@v8
@@ -197,13 +181,12 @@ jobs:
name: native-template-android
path: templates
- # Under release strictness, so this never packages around an archive the
- # publish gate would reject anyway.
- - name: Unpack the template
- run: |
- node build-tools/cli.js verify-template templates/*.zip
- mkdir -p template
- unzip -q templates/*.zip -d template
+ - uses: ./.github/actions/native-template
+ with:
+ platform: android
+ from-dir: ${{ steps.src.outputs.tag == '' && 'templates' || '' }}
+ tag: ${{ steps.src.outputs.tag }}
+ token: ${{ secrets.GITHUB_TOKEN }}
- name: Build the SDK the games are bundled against
run: pnpm --filter ./sdk build
@@ -276,14 +259,6 @@ jobs:
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- - name: Take the template from the release
- if: steps.src.outputs.tag != ''
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- gh release download "${{ steps.src.outputs.tag }}" --repo "$GITHUB_REPOSITORY" \
- -p 'estella-native-ios-*.zip' -D templates
-
- name: Take the template from this run
if: steps.src.outputs.tag == ''
uses: actions/download-artifact@v8
@@ -291,11 +266,12 @@ jobs:
name: native-template-ios
path: templates
- - name: Unpack the template
- run: |
- node build-tools/cli.js verify-template templates/*.zip
- mkdir -p template
- unzip -q templates/*.zip -d template
+ - uses: ./.github/actions/native-template
+ with:
+ platform: ios
+ from-dir: ${{ steps.src.outputs.tag == '' && 'templates' || '' }}
+ tag: ${{ steps.src.outputs.tag }}
+ token: ${{ secrets.GITHUB_TOKEN }}
- name: Build the SDK the games are bundled against
run: pnpm --filter ./sdk build
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index c29736bdb..7977d47b7 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -298,7 +298,8 @@ jobs:
name: Exit criteria (android)
runs-on: ubuntu-latest
needs: build-emscripten
- timeout-minutes: 90
+ # About forty minutes of it building the template this commit ships.
+ timeout-minutes: 150
steps:
- uses: actions/checkout@v7
@@ -316,13 +317,18 @@ jobs:
actions-cache-folder: .emsdk-ci
cache-key: emsdk-5.0.0-${{ runner.os }}-${{ runner.arch }}
- # A game is packaged INTO a template, and this job never had one: the default
- # path is a directory a checkout does not carry, so all 47 exports failed at
- # once. The action's own comment says why this takes the released one.
+ # A game is packaged INTO a template, and it is THIS commit's. The released one
+ # answered a different question — today's examples on the host a creator already
+ # has — and was red every night an example used something newer than the release,
+ # whatever the code in front of it did. render-host above built the SDK the
+ # host embeds.
+ - uses: ./.github/actions/android-template
+ with:
+ out: .native-template-build
- uses: ./.github/actions/native-template
with:
platform: android
- token: ${{ secrets.GITHUB_TOKEN }}
+ from-dir: .native-template-build
# Nested virtualisation for the emulator, as the compat matrix does.
- name: Enable KVM
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index 0b6ee0153..2072e949a 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -158,7 +158,9 @@ jobs:
- name: Build SDK
run: pnpm --filter ./sdk build
+ # Android builds through its own action, which does these three itself.
- name: Read the native dependency pins
+ if: matrix.name != 'android'
id: pins
shell: bash
run: node build-tools/cli.js native --deps-cache-key ${{ matrix.name }} >> "$GITHUB_OUTPUT"
@@ -167,6 +169,7 @@ jobs:
# reproducible for a given commit, so this is warm on every release that
# does not move it.
- name: Cache the pinned checkouts + Dawn builds
+ if: matrix.name != 'android'
uses: actions/cache@v4
with:
path: build/native-deps
@@ -203,14 +206,8 @@ jobs:
if: matrix.name == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- - name: Set up the Android NDK
- if: matrix.name == 'android'
- uses: nttld/setup-ndk@v1
- id: ndk
- with:
- ndk-version: r28
-
- name: Fetch Dawn + QuickJS at their pinned commits
+ if: matrix.name != 'android'
run: node build-tools/cli.js native --fetch-deps
# `native` builds Dawn for the target if the cache did not carry it, then
@@ -221,16 +218,11 @@ jobs:
node build-tools/cli.js native --target ios --simulator --no-template
node build-tools/cli.js native --target ios --template-out artifacts
- # Both architectures into ONE template: arm64 is every real device, x86_64 is
- # the emulator — which is how anyone without a phone tries the game at all.
- # The emitter keeps the architecture the previous run built.
- name: Build the Android template (arm64 + x86_64)
if: matrix.name == 'android'
- env:
- ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
- run: |
- node build-tools/cli.js native --abi arm64-v8a
- node build-tools/cli.js native --abi x86_64 --template-out artifacts
+ uses: ./.github/actions/android-template
+ with:
+ out: artifacts
# One executable per OS, and no Steamworks SDK on it: the redistributable is
# licensed to partners, so it reaches a package from the developer's own SDK
diff --git a/tools/releaseGate.mjs b/tools/releaseGate.mjs
index 3665d37f6..c55772afc 100644
--- a/tools/releaseGate.mjs
+++ b/tools/releaseGate.mjs
@@ -81,7 +81,7 @@ export const CRITERIA = [
{
id: '3d-runs-where-it-ships',
host: 'android',
- why: 'the same emulator boot, for the 3D corpus — nightly answers it against the RELEASED template, which is the host a creator already has; HEAD\'s own template costs 40 minutes to build and is native-smoke\'s question, asked by the release pipeline',
+ why: 'the same emulator boot, for the 3D corpus — only an emulator answers it, and it boots the template built from the commit being judged',
says: 'a game whose world is 3D boots and draws on a device',
// The web half is golden-packages' own command, and was run twice for one
// verdict. Only an emulator answers this: a solver that never compiled into