diff --git a/.github/workflows/deploy-github-page.yml b/.github/workflows/deploy-github-page.yml new file mode 100644 index 00000000..25a104c3 --- /dev/null +++ b/.github/workflows/deploy-github-page.yml @@ -0,0 +1,88 @@ +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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c52b02ba..9870f650 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: build_type: [static_build, shared_build] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Install micromamba uses: mamba-org/setup-micromamba@v2 @@ -87,7 +87,7 @@ jobs: build_type: [static_build, shared_build] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Install micromamba uses: mamba-org/setup-micromamba@v2 @@ -144,43 +144,3 @@ jobs: timeout-minutes: 4 working-directory: build\test - test-wasm: - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v4 - - - name: install mamba - uses: mamba-org/setup-micromamba@main - with: - environment-file: environment-wasm-build.yml - init-shell: bash - - - name: Build and pack xeus-python - shell: bash -l {0} - run: | - micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 - - mkdir build - pushd build - - export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host - export CMAKE_PREFIX_PATH=$PREFIX - export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX - - # remove all the fake pythons binaries - rm -f $PREFIX/bin/python* - - 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 \ - .. - - make -j4 diff --git a/README.md b/README.md index 9b9ee799..0d21d6e5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![GitHub Action CI](https://github.com/jupyter-xeus/xeus-python/actions/workflows/main.yml/badge.svg)](https://github.com/jupyter-xeus/xeus-python/actions/workflows/main.yml) [![Documentation Status](http://readthedocs.org/projects/xeus-python/badge/?version=latest)](https://xeus-python.readthedocs.io/en/latest/?badge=latest) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-xeus/xeus-python/stable?urlpath=/lab/tree/notebooks/xeus-python.ipynb) +[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyter-xeus.github.io/xeus-python/) [![Zulip](https://img.shields.io/badge/social_chat-zulip-blue.svg)](https://jupyter.zulipchat.com) `xeus-python` is a Jupyter kernel for Python based on the native implementation of the Jupyter protocol [xeus](https://github.com/jupyter-xeus/xeus). diff --git a/environment-wasm-build.yml b/environment-wasm-build.yml index b6fe6d91..dd85792f 100644 --- a/environment-wasm-build.yml +++ b/environment-wasm-build.yml @@ -9,3 +9,7 @@ dependencies: - python=3.13 - yarn - click + # JupyterLite + - jupyterlite-core + - jupyter_server + - jupyterlite-xeus \ No newline at end of file diff --git a/environment-wasm-host.yml b/environment-wasm-host.yml index 7b08ea8f..1c2fe6f2 100644 --- a/environment-wasm-host.yml +++ b/environment-wasm-host.yml @@ -7,6 +7,7 @@ dependencies: - pybind11 <3 - jedi - nlohmann_json + - nlohmann_json-abi - pybind11_json - numpy - xeus-lite