Skip to content

Build and Deploy

Build and Deploy #327

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
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: osx26-arm-clang-repl-21-emscripten
os: macos-26
clang-runtime: '21'
micromamba_shell_init: bash
emsdk_ver: "4.0.9"
build_static_library: Off
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- 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: >-
${{ matrix.micromamba_shell_init }}
- name: Setup emsdk
shell: bash -l {0}
run: |
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${{ matrix.emsdk_ver }}
- name: Restore cached LLVM-${{ matrix.clang-runtime }} and ${{ matrix.cling == 'On' && 'Cling' || 'Clang-REPL' }} build
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-clang-${{ matrix.clang-runtime }}.x-emscripten
- name: Build and test CppInterOp
uses: ./.github/actions/Build_and_Test_CppInterOp
- name: Build xeus-cpp
shell: bash -l {0}
run: |
./emsdk/emsdk activate ${{matrix.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