Skip to content

Add per-instance state lifecycle to VTableOverlay #4296

Add per-instance state lifecycle to VTableOverlay

Add per-instance state lifecycle to VTableOverlay #4296

Workflow file for this run

name: WASM
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
schedule:
- cron: '30 20 * * *' # Warning: Timezone dep - 20:00 is 1:00
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
# emsdk for the consumer-side xeus-cpp build; the llvm-wasm cell
# bakes its own emsdk version into the recipe.
EMSDK_VER: "4.0.9"
BUILD_STATIC_LIBRARY: ${{ github.event_name == 'schedule' && 'On' || 'Off' }}
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# clang-runtime + arch are per-row: the cell key is the
# (recipe, version, os, arch) tuple cells.yaml indexes by.
# Deriving arch from `runner.arch` matches github-hosted runners
# but picks up the host arch under nektos/act, missing the cell.
# YAML-quote `wasm` / `skip-in-prs` so workflow `if:` checks
# comparing them work uniformly under act and github-hosted.
include:
- { name: ubu24-arm-emscr-llvm22, os: ubuntu-24.04-arm, arch: arm64, clang-runtime: &clang_rt '22', wasm: 'true' }
- { name: osx26-arm-emscr-llvm22, os: macos-26, arch: arm64, clang-runtime: *clang_rt, wasm: 'true' }
- { name: ubu24-x86-emscr-llvm22, os: ubuntu-24.04, arch: x86_64, clang-runtime: *clang_rt, wasm: 'true' }
- { name: win2025-x86-emscr-llvm22, os: windows-2025, arch: x86_64, clang-runtime: *clang_rt, wasm: 'true', skip-in-prs: 'true' }
steps:
- uses: actions/checkout@v6
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
- name: Set up Python
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Save PR Info
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: ./.github/actions/Miscellaneous/Save_PR_Info
- name: Setup emsdk
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
run: |
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${{ env.EMSDK_VER }}
- name: Setup default Build Type
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: ./.github/actions/Miscellaneous/Select_Default_Build_Type
- name: Install deps on Windows
if: ${{ runner.os == 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
run: |
choco install findutils ninja
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
$env:PATH="C:\Program Files (x86)\Ninja\bin;$env:PATH"
- name: Install deps on MacOS
if: ${{ runner.os == 'macOS' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
run: |
brew update
export ARCHITECHURE=$(uname -m)
if [[ "$ARCHITECHURE" != "x86_64" ]]; then
brew remove unxip
fi
# workaround for https://github.com/actions/setup-python/issues/577
for pkg in $(brew list | grep '^python@'); do
brew unlink "$pkg"
brew link --overwrite "$pkg"
done
brew install ninja
- name: Install deps on Linux
if: ${{ runner.os == 'Linux' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
run: |
# cmake is preinstalled on github-hosted ubuntu-24.04 but absent
# from catthehacker/ubuntu:act-24.04; install it so bin/repro works.
sudo apt-get update
sudo apt-get install -y --no-install-recommends cmake ninja-build
sudo apt-get autoremove
sudo apt-get clean
# No build-on-miss: a cache miss hard-fails the row instead of
# silently inline-building (~30 min). Forces recipe-side drift to
# surface immediately. The win2025 row has no cell yet and is
# `skip-in-prs: 'true'` to keep PRs unaffected.
- name: Setup llvm-wasm cell
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: compiler-research/ci-workflows/actions/setup-recipe@main
with:
recipe: llvm-wasm
version: ${{ matrix.clang-runtime }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
- name: install mamba
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: mamba-org/setup-micromamba@main
with:
init-shell: >-
${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
- name: micromamba shell hook
if: ${{ runner.os == 'Windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: powershell
run: |
micromamba shell hook -s cmd.exe --root-prefix C:\Users\runneradmin\micromamba-root
- name: Build and test CppInterOp
if: ${{ !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
uses: ./.github/actions/Build_and_Test_CppInterOp
with:
clang_runtime: ${{ matrix.clang-runtime }}
wasm: ${{ matrix.wasm }}
- name: Build xeus-cpp on Unix Systems
if: ${{ runner.os != 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: bash -l {0}
run: |
./emsdk/emsdk activate ${{ env.EMSDK_VER }}
source ./emsdk/emsdk_env.sh
micromamba activate CppInterOp-wasm
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
cd ./xeus-cpp
mkdir build
pushd build
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
emcmake cmake \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DXEUS_CPP_RESOURCE_DIR=${{ env.LLVM_BUILD_DIR }}/lib/clang/${{ matrix.clang-runtime }} \
-DSYSROOT_PATH=${{ env.SYSROOT_PATH }} \
..
emmake make -j ${{ env.ncpus }} install
- name: Build xeus-cpp on Windows systems
if: ${{ runner.os == 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: powershell
run: |
.\emsdk\emsdk activate ${{ env.EMSDK_VER }}
.\emsdk\emsdk_env.ps1
micromamba activate CppInterOp-wasm
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
cd .\xeus-cpp
mkdir build
pushd build
$env:CMAKE_PREFIX_PATH="${{ env.PREFIX }}"
$env:CMAKE_SYSTEM_PREFIX_PATH="${{ env.PREFIX }}"
emcmake cmake `
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} `
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} `
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
-DXEUS_CPP_RESOURCE_DIR=${{ env.LLVM_BUILD_DIR }}\lib\clang\${{ matrix.clang-runtime }} `
-DSYSROOT_PATH=${{ env.SYSROOT_PATH }} `
..
emmake make -j ${{ env.ncpus }} install
- name: Test xeus-cpp C++ Emscripten on Unix Systems
if: ${{ runner.os != 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: bash -l {0}
run: |
set -e
micromamba activate CppInterOp-wasm
cd ./xeus-cpp/build/test
node test_xeus_cpp.js
- name: Test xeus-cpp C++ Emscripten on Windows Systems
if: ${{ runner.os == 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: powershell
run: |
function Error-OnFailure {
param (
[Parameter(Mandatory)]
[ScriptBlock]$Command
)
& $Command
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
micromamba activate CppInterOp-wasm
cd .\xeus-cpp\build\test
node test_xeus_cpp.js
echo "Running test_xeus_cpp in Firefox"
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" test_xeus_cpp.html }
echo "Running test_xeus_cpp in Chromium"
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html }
- name: Jupyter Lite integration
if: ${{ runner.os != 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true') }}
shell: bash -l {0}
run: |
cd ./xeus-cpp/
micromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/tinyraytracer.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist
- name: Jupyter Lite integration
if: ${{ runner.os == 'windows' && !(github.event_name == 'pull_request' && matrix.skip-in-prs == 'true')}}
shell: powershell
run: |
cd .\xeus-cpp\
micromamba create -n xeus-lite-host jupyterlite-core jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/tinyraytracer.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist