build(ui): build core.wasm in CI, stop committing the binary (F6)
Tests · UI / test (push) Successful in 3m48s
Tests · UI / test (pull_request) Successful in 2m35s

core.wasm and wasm_exec.js are no longer tracked (untracked + gitignored).
A reusable composite action .gitea/actions/build-wasm installs TinyGo
(actions/cache'd) and runs `make -C ui wasm`; it runs in all three
frontend-building workflows — ui-test (before Playwright; Vitest uses the
fake Core and needs no build), dev-deploy, and prod-build. ui-test gains a
Go setup (TinyGo shells out to Go); the deploy workflows already had one.

Docs: ui/docs/wasm-toolchain.md, ui/README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-22 14:29:33 +02:00
parent 9d3a652b6b
commit b729036778
10 changed files with 78 additions and 572 deletions
+12 -6
View File
@@ -98,11 +98,17 @@ envelope payloads stay below a few hundred bytes.
## Reproducibility
TinyGo builds are not bit-for-bit deterministic (the binary embeds
build-machine identifiers). Treat the committed `core.wasm` as a
snapshot rebuilt by `make wasm` whenever `ui/core/` or
`ui/wasm/main.go` changes. CI rebuilds the artefact from source for
its own asserts; the committed copy keeps Vitest from depending on
TinyGo being installed in every environment.
build-machine identifiers), so `core.wasm` / `wasm_exec.js` are **not
committed**. CI builds them from source: the
[`.gitea/actions/build-wasm`](../../.gitea/actions/build-wasm/action.yml)
composite action installs TinyGo (cached) and runs `make -C ui wasm`
ahead of every step that builds or serves the frontend bundle — the
`ui-test` Playwright run, `dev-deploy`, and `prod-build`.
For local work, run `make -C ui wasm` once after cloning, and again
whenever `ui/core/` or `ui/wasm/main.go` changes. Vitest needs no build
(it uses the fake Core in `tests/fake-core.ts`); only the SvelteKit dev
server and Playwright serve the real artefact from `frontend/static/`.
## Bundle size
@@ -111,4 +117,4 @@ TinyGo being installed in every environment.
| Initial land | 2026-05-07 | 903 KB |
If the artefact ever crosses the 1 MB target, profile via
`tinygo build -size full` and trim before committing.
`tinygo build -size full` and trim it.