Skip to main content

Testing via CI

MNE-CPP provides a GitHub Actions workflow (wasmtest.yml) that builds the project for WebAssembly and deploys the result to your fork's gh-pages branch. This page explains how to set it up.

Prerequisites

Set Up the gh-pages Branch

If your fork does not already have a gh-pages branch, create one:

git checkout --orphan gh-pages
git rm -rf .
touch README.md
git add README.md
git commit -m 'initial gh-pages commit'
git push origin gh-pages

Then enable GitHub Pages in your fork: Settings > Pages > Source > Deploy from a branch and select gh-pages.

Create a Personal Access Token

Create a personal access token with repo scope.

Add the Repository Secret

In your fork go to Settings > Secrets and variables > Actions and create a new secret named GIT_CREDENTIALS_WASM_TEST with the value:

https://<your-github-username>:<your-token>@github.com/

Trigger the Workflow

The wasmtest.yml workflow is triggered by pushes to the wasm branch. Create this branch (or use an existing one) and push:

git checkout -b wasm
# make your changes
git push origin wasm

This will start a GitHub Actions run that:

  1. Sets up Emscripten 4.0.7 and downloads pre-built Qt 6.10.2 static Wasm binaries (or triggers a build of those binaries if they don't yet exist).
  2. Downloads host Qt binaries (Linux) needed for cross-compilation.
  3. Builds MNE-CPP for WebAssembly using ./tools/wasm.sh --emsdk 4.0.7.
  4. Injects a COI service worker (coi-serviceworker.js) into every HTML file to provide the Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers required for SharedArrayBuffer on GitHub Pages.
  5. Pushes the resulting Wasm artifacts to both the gh-pages and main branches of your fork.
Build Times

Building Qt and MNE-CPP for WebAssembly takes significant time on CI runners. Pre-built Qt binaries are cached to speed up subsequent builds.

View the Result

Once the workflow completes, visit:

https://<your-github-username>.github.io/mne-cpp/mne_analyze.html

It may take a few minutes (or a browser refresh) for GitHub Pages to update.

References