Deploy JupyterLite Page #4273
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy JupyterLite Page | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the master branch | |
schedule: | |
- cron: '15 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout xDSL | |
uses: actions/checkout@v4 | |
with: | |
path: xdsl | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: 'pip' # caching pip dependencies | |
cache-dependency-path: | | |
setup.py | |
requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install jupyterlite-core==0.2.3 jupyterlite-pyodide-kernel==0.2.1 libarchive-c build pyodide-build==0.24.1 jupyter-server | |
- name: Build xDSL source distribution | |
run: | | |
cd xdsl | |
python setup.py sdist | |
# Pyodide is cached, so cloned only if not present in the cache, otherwise | |
# just checked out to whatever desired version and partially rebuilt. | |
- name: Restore cached Pyodide tree | |
id: cache-pyodide | |
uses: actions/cache@v4 | |
with: | |
path: pyodide | |
key: pyodide | |
- name: Clone pyodide if not cached | |
if: steps.cache-pyodide.outputs.cache-hit != 'true' | |
run: git clone https://github.com/pyodide/pyodide.git | |
# Clean the xDSL package folder, generate the skeletons | |
# and do the necessary updates before building. | |
- name: Build custom Pyodide distribution | |
run: | | |
cd pyodide | |
git fetch --all | |
git checkout 0.24.1 | |
python -m pip install -U -r requirements.txt | |
sudo apt update && sudo apt install f2c | |
pyodide skeleton pypi --update xdsl || pyodide skeleton pypi xdsl | |
../xdsl/.github/workflows/update_xdsl_pyodide_build.py packages/xdsl/meta.yaml ../xdsl | |
PYODIDE_PACKAGES="xdsl,typing-extensions" make | |
- name: Build the JupyterLite site | |
run: | | |
mkdir content | |
cp xdsl/docs/* content -r | |
rm -rf pyodide/pyodide | |
mkdir pyodide/pyodide | |
cp pyodide/dist pyodide/pyodide/pyodide -r | |
python -m jupyter lite build --contents content --pyodide pyodide/pyodide | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./_output | |
deploy: | |
needs: build | |
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@v2 |