Skip to content

Web (wasm32) support: CI check and examples runnable in the browser #29

Closed

Description

@samitbasu

The user expects to run bullseye apps as wasm builds. The reference shell already has a web build (trunk, eframe's WebRunner, WebGL2) that behaves the same as native.

Today

cargo check --lib --target wasm32-unknown-unknown passes on main (the toolchain target is installed locally). The only std::time::Instant use is in a test benchmark (src/measure.rs), which never runs on web. Nothing guards this yet.

Plan

  1. CI guard: add a wasm step to cargo xtask ci that runs cargo check --lib --target wasm32-unknown-unknown, plus the examples once they build for web. The CI workflow installs the target. A dependency or API that breaks the web build then fails CI immediately.
  2. Examples run in the browser: cargo xtask web <example> builds the example for wasm32 and serves it locally (trunk or wasm-bindgen with a small server run by xtask, in a process group xtask ends itself). Each example's native main and its web entry share one app constructor in examples/common, so they never diverge.
  3. Web-specific behaviour:
    • Fonts: no filesystem font scan on web. known_gaps shows its "no weighted faces found" note there.
    • Time: egui's own clock only, never std::time::Instant outside tests. A lint or grep step can guard this.
    • Same-frame layout: a browser repaints only on input, so any one-frame-stale size is visible there (see the M7 same-frame regions note). Try the examples in the browser as part of review.
  4. Snapshots and tests stay native: kittest runs on the host.

Where

A small PR after #28 and before M4c, so M4c's examples changes are web-checked from the start.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions