Skip to content

fix method related APIs to handle template (#1021) #963

fix method related APIs to handle template (#1021)

fix method related APIs to handle template (#1021) #963

Workflow file for this run

name: Build and Deploy
on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '30 20 * * *' # Warning: Timezone dep - 20:00 is 1:00
permissions:
contents: read
pages: write
id-token: write
env:
EMSDK_VER: "4.0.9"
BUILD_STATIC_LIBRARY: Off
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# arch + wasm shape mirror emscripten.yml's matrix (see comment there).
include:
- { name: osx26-arm-emscr-llvm22, os: macos-26, arch: arm64, clang-runtime: '22', wasm: 'true' }
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Save PR Info
uses: ./.github/actions/Miscellaneous/Save_PR_Info
- name: Setup default Build Type
uses: ./.github/actions/Miscellaneous/Select_Default_Build_Type
- name: install mamba
uses: mamba-org/setup-micromamba@main
with:
init-shell: >-
${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
- name: Setup emsdk
shell: bash -l {0}
run: |
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${{ env.EMSDK_VER }}
# Same wasm-cell consumer step as emscripten.yml.
- name: Setup llvm-wasm cell
uses: compiler-research/ci-workflows/actions/setup-recipe@main
with:
recipe: llvm-wasm
version: ${{ matrix.clang-runtime }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
- name: Build and test CppInterOp
uses: ./.github/actions/Build_and_Test_CppInterOp
with:
clang_runtime: ${{ matrix.clang-runtime }}
wasm: ${{ matrix.wasm }}
- name: Build xeus-cpp
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 }} \
..
EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" emmake make -j ${{ env.ncpus }} install
- name: Test xeus-cpp C++ Emscripten
shell: bash -l {0}
run: |
set -e
micromamba activate CppInterOp-wasm
cd ./xeus-cpp/build/test
node test_xeus_cpp.js
- name: Jupyter Lite integration
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 \
--XeusAddon.mounts="${{ env.PREFIX }}/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
--XeusAddon.mounts="${{ env.PREFIX }}/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" --output-dir dist
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./xeus-cpp/dist/
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4