Skip to content

Deploy the web page to Cloudflare Pages - #635

Merged
fontanf merged 1 commit into
masterfrom
wasm-deploy
Oct 3, 2026
Merged

fontanf merged 1 commit into
masterfrom
wasm-deploy

Conversation

@fontanf

@fontanf fontanf commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Stacked on #634, then #633 and #632. This PR's diff only shows the last step.

Workflow (.github/workflows/wasm.yml)

  • build job, on pull requests touching wasm/, src/, include/, extern/ or CMakeLists.txt, and before each deployment:
    • installs Emscripten 6.0.11 (mymindstorm/setup-emsdk, cached) and Node.js 22;
    • builds the module (--parallel 4, as the other workflows);
    • runs node --test wasm/tests/;
    • assembles the site: the page, the module, the Web Worker and _headers, without serve.py.
  • deploy job: uploads the site to Cloudflare Pages with cloudflare/wrangler-action.
    • It runs every time the Build workflow succeeds on master, like the Python workflow's publishing, so a broken master is never deployed. It can also be run manually on master.
    • It uses the cloudflare-pages environment, so a protection rule can be added there if wanted.
  • Same conventions as python.yml: no runs for fork pull requests, and outdated pull request runs are cancelled.

wasm/web/_headers sets the two headers enabling SharedArrayBuffer on Cloudflare Pages. wasm/README.md documents the deployment.

Setup required before the first deployment

  1. A Cloudflare account, and a Pages project named packingsolver, created for direct upload: in the dashboard, Workers & Pages → Create → Pages → "Upload assets". Another name can be used by setting the repository variable CLOUDFLARE_PAGES_PROJECT.
  2. A Cloudflare API token with the "Cloudflare Pages: Edit" account permission.
  3. The repository secrets CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID.

Testing

  • The site assembled as in the workflow, served as static files with only the _headers rules applied, as Cloudflare Pages does, in headless Chromium:
    • crossOriginIsolated is true;
    • the six problem types solve and draw their solutions;
    • "Stop" works;
    • no console errors.
  • The workflow itself hasn't run yet: it runs on pull requests to master, so once this stack is retargeted to master.

Base automatically changed from wasm-web-page to master October 3, 2026 19:19
New workflow '.github/workflows/wasm.yml': it builds the WebAssembly
module with Emscripten, runs 'node --test wasm/tests/', and assembles the
site (the page, the module and the Web Worker). Every time the Build
workflow succeeds on master, it deploys the site to Cloudflare Pages.
Pull requests touching the module, the page or the libraries only build and
test it.

Cloudflare Pages serves 'wasm/web/_headers', which sets the headers enabling
'SharedArrayBuffer' (GitHub Pages can't set them).
@fontanf
fontanf merged commit 2dce633 into master Oct 3, 2026
0 of 4 checks passed
@fontanf
fontanf deleted the wasm-deploy branch October 3, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant