Skip to content

Commit bb49537

Browse files
committed
Split up setting up Jupyter Lite wesbite, and running kernels in it
1 parent 4296251 commit bb49537

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

.github/actions/Emscripten-Notebook-Tests/action.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,10 @@ runs:
1818
shell: bash -l {0}
1919
run: |
2020
set -e
21-
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus -c conda-forge -y
2221
micromamba activate xeus-lite-host
23-
if [[ "${{ matrix.os }}" == "macos"* ]]; then
24-
brew install coreutils
25-
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
26-
fi
27-
export INPUT_TEXT=""
2822
if [[ "${{ inputs.notebook }}" == "xeus-cpp-lite-demo.ipynb"* ]]; then
2923
export INPUT_TEXT="--stdin Test_Name"
3024
fi
31-
timeout 300 jupyter lite serve --settings-overrides=overrides.json --XeusAddon.prefix=${{ env.PREFIX }} \
32-
--XeusAddon.mounts="${{ env.PREFIX }}/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
33-
--XeusAddon.mounts="${{ env.PREFIX }}/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
34-
--contents README.md \
35-
--contents notebooks/xeus-cpp-lite-demo.ipynb \
36-
--contents notebooks/images/marie.png \
37-
--contents notebooks/audio/audio.wav \
38-
--output-dir dist &
39-
export jupyter_lite_process_id=$!
40-
# There is a bug in nbdime after 3.2.0 where it will show the filenames as if there was a diff
41-
# but there is no diff with the options chosen below (the latest doesn't show a diff, just the filenames with +++
42-
# and --- as if it was planning to show a diff. This only happens for xeus-cpp-lite-demo.ipynb.
43-
python -m pip install nbdime==3.2.0
44-
python -m pip install selenium
45-
# This sleep is to force enough time for the jupyter site to build before trying
46-
# to run notebooks in it. If you try to run the notebooks before the website is
47-
# ready the ci python script will crash saying ti cannot access the url
48-
sleep 10
4925
echo "Running xeus-cpp in Jupter Lite in Chrome"
5026
python -u scripts/automated-notebook-run-script.py --driver chrome --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT
5127
nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> chrome_diff.txt
@@ -78,8 +54,3 @@ runs:
7854
cat chrome_diff.txt
7955
exit 1
8056
fi
81-
# Kill the jupyter lite serve process now we are done running xeus-cpp in the
82-
# Jupyter Lite website.
83-
pkill -9 timeout
84-
pkill -9 jupyter-lite
85-
rm -rf ./dist .jupyterlite.doit.db
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'This sets up our Jupyter Lite website, so we can run xeus-cpp in it'
2+
description: 'This action sets up our Jupyter Lite website, so we can run xeus-cpp in it'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Jupyter Lite integration test
8+
shell: bash -l {0}
9+
run: |
10+
set -e
11+
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus -c conda-forge -y
12+
micromamba activate xeus-lite-host
13+
if [[ "${{ matrix.os }}" == "macos"* ]]; then
14+
brew install coreutils
15+
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
16+
fi
17+
export INPUT_TEXT=""
18+
timeout 1080 jupyter lite serve --settings-overrides=overrides.json --XeusAddon.prefix=${{ env.PREFIX }} \
19+
--XeusAddon.mounts="${{ env.PREFIX }}/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
20+
--XeusAddon.mounts="${{ env.PREFIX }}/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
21+
--contents README.md \
22+
--contents notebooks/xeus-cpp-lite-demo.ipynb \
23+
--contents notebooks/images/marie.png \
24+
--contents notebooks/audio/audio.wav \
25+
--output-dir dist &
26+
# There is a bug in nbdime after 3.2.0 where it will show the filenames as if there was a diff
27+
# but there is no diff with the options chosen below (the latest doesn't show a diff, just the filenames with +++
28+
# and --- as if it was planning to show a diff. This only happens for xeus-cpp-lite-demo.ipynb.
29+
python -m pip install nbdime==3.2.0
30+
python -m pip install selenium
31+
# This sleep is to force enough time for the jupyter site to build before trying
32+
# to run notebooks in it. If you try to run the notebooks before the website is
33+
# ready the ci python script will crash saying ti cannot access the url
34+
sleep 10

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ jobs:
329329
fi
330330
timeout-minutes: 4
331331

332+
- name: Serve Jupyter Lite website
333+
uses: ./.github/actions/Jupyter-serve
334+
332335
- name: Test C++17 kernel in xeus-cpp-lite-demo.ipynb
333336
uses: ./.github/actions/Emscripten-Notebook-Tests
334337
with:

0 commit comments

Comments
 (0)