Check your browser build in CI
The native workflow from Check your game in CI checks the Windows game. This optional second workflow checks the browser build from Build for the browser. It builds the game, tests its rules under Node, packages the page with its notices, draws and quits that packaged page in headless Chrome, then keeps the package as a downloadable artifact of the run.
Your game’s repository can remain private. The workflow asks only for contents: read to
check out its files. It grants no Pages or deployment permissions, uses no publication secret
and publishes no website. Put your game on the web remains the
separate manual publication route; choosing where to host the finished game does not decide
who can read its source.
Add the optional workflow
Section titled “Add the optional workflow”Start with the unchanged starter project, or the same project made through the submodule
walkthrough, already on GitHub. Keep its existing
.github/workflows/ci.yml for Windows. From the project’s folder, make a second file:
if not exist .github\workflows mkdir .github\workflowsnotepad .github\workflows\browser.ymlPaste this entire workflow into it, save and close Notepad. If you renamed the game, change
the three input filenames containing MyGame and their .js and .wasm output names to your
game’s names too. The HTML becomes index.html in the package, as in the manual web release.
# Optional: copy to .github/workflows/browser.yml in your game project.# Builds, tests and keeps a downloadable browser artifact. It publishes no site.name: browser build and test
on: push: pull_request: workflow_dispatch:
permissions: contents: read
env: EMSDK_VERSION: 6.0.12
jobs: browser: runs-on: windows-latest timeout-minutes: 90 defaults: run: shell: cmd steps: - uses: actions/checkout@v4 with: submodules: recursive
- name: Find build tools and Chrome shell: pwsh run: | $vs = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath if (-not $vs) { throw 'Visual Studio C++ tools were not found.' } "VCVARS=$vs/VC/Auxiliary/Build/vcvars64.bat" >> $env:GITHUB_ENV "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV $chrome = "$env:ProgramFiles/Google/Chrome/Application/chrome.exe" if (-not (Test-Path -LiteralPath $chrome)) { throw 'Chrome was not found.' } "CHROME=$chrome" >> $env:GITHUB_ENV
- name: Cache Emscripten id: emsdk uses: actions/cache@v4 with: path: C:/emsdk key: starter-emsdk-${{ runner.os }}-${{ env.EMSDK_VERSION }}
- name: Install Emscripten if: steps.emsdk.outputs.cache-hit != 'true' run: | git clone --depth 1 --branch %EMSDK_VERSION% https://github.com/emscripten-core/emsdk.git C:/emsdk || exit /b 1 call C:/emsdk/emsdk.bat install %EMSDK_VERSION% || exit /b 1 call C:/emsdk/emsdk.bat activate %EMSDK_VERSION% || exit /b 1
- name: Cache vcpkg's browser binaries uses: actions/cache@v4 with: path: ~/AppData/Local/vcpkg/archives key: starter-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('vcpkg.json') }} restore-keys: starter-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-
- name: Configure, build and test rules run: | call "%VCVARS%" || exit /b 1 call C:/emsdk/emsdk_env.bat || exit /b 1 cmake --preset wasm-release || exit /b 1 cmake --build --preset wasm-release --parallel 2 || exit /b 1 ctest --preset wasm-release || exit /b 1
- name: Package the browser runtime and notices run: | call C:/emsdk/emsdk_env.bat || exit /b 1 set "engine=external/labrador" set "emscripten=%EMSDK%/upstream/emscripten" "%EMSDK_NODE%" "%engine%/tools/web_bundle/bundle.mjs" ^ --out out/web-release ^ --repository . ^ --emscripten "%emscripten%" ^ --build-type Release ^ --file "index.html=out/build/wasm-release/game/MyGame.html" ^ --file "MyGame.js=out/build/wasm-release/game/MyGame.js" ^ --file "MyGame.wasm=out/build/wasm-release/game/MyGame.wasm" ^ --notice "%engine%/NOTICE" ^ --licence "Labrador=%engine%/LICENSE" ^ --licence "Microsoft sample code=%engine%/tools/web_bundle/Microsoft-LICENSE.txt" ^ --licence "RapidJSON=%engine%/external/rapidjson/license.txt" ^ --licence "LodePNG=out/build/wasm-release/vcpkg_installed/wasm32-emscripten/share/lodepng/copyright" ^ --licence "JetBrains Mono=game/content/fonts/OFL.txt" ^ --licence "Emscripten=%emscripten%/LICENSE" ^ --licence "libc++=%emscripten%/system/lib/libcxx/LICENSE.TXT" ^ --licence "libc++abi=%emscripten%/system/lib/libcxxabi/LICENSE.TXT" ^ --licence "libunwind=%emscripten%/system/lib/libunwind/LICENSE.TXT" ^ --licence "compiler-rt=%emscripten%/system/lib/compiler-rt/LICENSE.TXT" ^ --licence "musl=%emscripten%/system/lib/libc/musl/COPYRIGHT" || exit /b 1
- name: Start Chrome's GPU process continue-on-error: true run: | call C:/emsdk/emsdk_env.bat || exit /b 1 "%EMSDK_NODE%" external/labrador/tests/render/web/run_page.mjs --browser "%CHROME%" --page out/web-release/index.html --quit-keys Escape,Enter --timeout 60
- name: Draw and quit the packaged page run: | call C:/emsdk/emsdk_env.bat || exit /b 1 "%EMSDK_NODE%" external/labrador/tests/render/web/run_page.mjs --browser "%CHROME%" --page out/web-release/index.html --quit-keys Escape,Enter --timeout 60
- name: Keep the tested runtime uses: actions/upload-artifact@v4 with: name: mygame-browser path: out/web-release/ if-no-files-found: error retention-days: 7Commit the file and push when you are ready, as Sending the next change shows. The separate browser build and test workflow starts on pushes and pull requests. Its browser job has the same 90-minute timeout as the native example. Installing the pinned SDK and fetching vcpkg packages makes its first run longer than a cached one.
What it checks and keeps
Section titled “What it checks and keeps”The SDK version matches Labrador’s pinned compiler. Emscripten and vcpkg have separate caches; the browser dependency key includes both that compiler version and the game’s manifest. Each command step loads its own tool environment, since steps do not share a command prompt.
The rules run through ctest --preset wasm-release. The template embeds its content in the
module, so its runtime is three files: MyGame.html, MyGame.js and MyGame.wasm. The bundler
renames the page to index.html and adds NOTICE.txt and BUILD.json in out/web-release/.
The record names the source commit, compiler version, build type and file hashes; it does not
measure a physical display or prove that the game plays well on a phone.
The browser check serves that package, rather than the build folder. After it draws,
Escape,Enter opens and confirms the starter’s quit question; success ends with
Module.onQuit was called. Console errors and warnings, loader failures, Module.onError and
a page that never quits fail the check. If you change the game’s quit controls, update
--quit-keys in both browser steps. A missing runtime or licence input fails packaging, and
a failed final browser check prevents the artifact upload.
The first browser step starts Chrome’s GPU process and may fail without failing the job. Labrador’s hosted runners have a recorded first-page context-loss problem; the second step must pass against the same package. The first load is preparation and supplies no acceptance evidence on its own.
On a successful run, open its summary and download mygame-browser under Artifacts. It contains the five files above and is retained for seven days. Serve the extracted folder over HTTP as Build for the browser shows; opening the HTML as a local file does not run it. Before sharing or publishing it, add the visible notices link from Put your game on the web step 1 to your page template and rebuild.
If you later use external content such as a .data preload, worker scripts or other downloaded
files, add those runtime files to the bundler’s --file list and keep their relative names.
Add the licences of any new dependencies too. The final browser check will catch missing files
the tested route loads; it cannot discover files used only by a later level or another route.
What was checked
Section titled “What was checked”The workflow’s permissions, artifact path, required final check and optional nature have offline fixtures. Those fixtures execute this file’s actual packaging command against runtime and licence files, check its names and hashes, and require failure when each input is missing. On 16 November 2026 the assembled starter’s Release build and Node rules passed locally with Emscripten 6.0.12, and its packaged page quit in Chrome 157.0.8103.78 through the keys above. This recipe has not yet run as its own hosted workflow; local command execution and a future GitHub run remain distinct evidence.
Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.