Skip to content

Add JupyterLite deployment (#668) #5

Add JupyterLite deployment (#668)

Add JupyterLite deployment (#668) #5

name: build and deploy
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Github-page
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install mamba
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-wasm-build.yml
init-shell: bash
environment-name: xeus-python-wasm-build
- name: Set ncpus
run: echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
- name: Build xeus-python
shell: bash -l {0}
run: |
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
set -eux
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
emcmake cmake . \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON
emmake make -j${{ env.ncpus }} install
- name: Jupyter Lite integration
shell: bash -l {0}
run: |
jupyter lite build \
--XeusAddon.prefix=${{ env.PREFIX }} \
--contents notebooks/xeus-python.ipynb \
--output-dir dist
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./dist
deploy:
needs: build
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4