Skip to content

[wip] read the docs deployment preview #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,48 @@
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if on_rtd:
XEUS_CPP_ROOT = os.path.abspath('../..')
command_emscripten = f'''
cd ../../;
curl -L https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba;
export PATH="$PWD/bin:$PATH";
export MAMBA_EXE="$PWD/bin/micromamba";
export MAMBA_ROOT_PREFIX="/home/docs/checkouts/readthedocs.org/user_builds/xeus-cpp/conda/";
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)";
eval "$__mamba_setup";
alias micromamba="$MAMBA_EXE";
micromamba create -f environment-wasm-build.yml -y;
micromamba activate xeus-cpp-wasm-build;
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32;
mkdir -p build;
cd build;
export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/xeus-cpp-wasm-build;
export PREFIX=$MAMBA_ROOT_PREFIX/xeus-cpp-wasm-host;
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot;
emcmake cmake -DCMAKE_BUILD_TYPE=Release \\
-DCMAKE_PREFIX_PATH=$PREFIX \\
-DCMAKE_INSTALL_PREFIX=$PREFIX \\
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \\
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \\
-DSYSROOT_PATH=$SYSROOT_PATH \\
{XEUS_CPP_ROOT};
emmake make -j $(nproc --all) install;
cd {XEUS_CPP_ROOT};
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyter_server jupyterlite-xeus -c conda-forge -y;
micromamba activate xeus-lite-host;
python -m pip install jupyterlite-xeus jupyter_server;
jupyter lite build --XeusAddon.prefix=$PREFIX \\
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
--contents notebooks/xeus-cpp-lite-demo.ipynb \\
--contents notebooks/smallpt.ipynb \\
--contents notebooks/images/marie.png \\
--contents notebooks/audio/audio.wav \\
--output-dir $READTHEDOCS_OUTPUT/html/xeus-cpp;
'''
subprocess.call('cd ..; doxygen', shell=True)
subprocess.run(['bash', '-c', command_emscripten], check=True)


import sphinx_rtd_theme

Expand All @@ -32,4 +73,4 @@ def setup(app):
highlight_language = 'c++'
pygments_style = 'sphinx'
todo_include_todos = False
htmlhelp_basename = 'xeus-cppdoc'
htmlhelp_basename = 'xeus-cppdoc'