-
Notifications
You must be signed in to change notification settings - Fork 42
Run notebooks in Jupyter Lite as part of ci (Emscripten xeus-cpp automated testing) #415
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
Open
mcbarton
wants to merge
1
commit into
compiler-research:main
Choose a base branch
from
mcbarton:Emscripten-notebook-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: 'Run kernel in notebook within Jupyter Lite' | ||
| description: 'This action runs the chosen kernel in notebook within Jupyter Lite' | ||
|
|
||
| inputs: | ||
| notebook: | ||
| description: "The notebook to run the kernel in" | ||
| required: true | ||
| type: string | ||
| kernel: | ||
| description: "The kernel to use" | ||
| required: true | ||
| type: string | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Jupyter Lite integration test | ||
| shell: bash -l {0} | ||
| run: | | ||
| set -e | ||
| micromamba activate xeus-lite-host | ||
| export INPUT_TEXT="" | ||
| if [[ "${{ inputs.notebook }}" == "xeus-cpp-lite-demo.ipynb"* ]]; then | ||
| export INPUT_TEXT="--stdin Smudge" | ||
| fi | ||
| echo "Running xeus-cpp in Jupter Lite in Chrome" | ||
| python -u scripts/automated-notebook-run-script.py --driver chrome --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT | ||
| nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> chrome_diff.txt | ||
| export CHROME_TESTS_RETURN_VALUE=$( [ -s chrome_diff.txt ] && echo 1 || echo 0 ) | ||
| rm $HOME/Downloads/${{ inputs.notebook }} | ||
| echo "Running xeus-cpp in Jupter Lite in Firefox" | ||
| python -u scripts/automated-notebook-run-script.py --driver firefox --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT | ||
| nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> firefox_diff.txt | ||
| export FIREFOX_TESTS_RETURN_VALUE=$( [ -s firefox_diff.txt ] && echo 1 || echo 0 ) | ||
| rm $HOME/Downloads/${{ inputs.notebook }} | ||
| if [[ $FIREFOX_TESTS_RETURN_VALUE -ne 0 || $CHROME_TESTS_RETURN_VALUE -ne 0 ]]; then | ||
| echo "Diff Firefox (blank means no diff)" | ||
| cat firefox_diff.txt | ||
| echo "Diff Chrome (blank means no diff)" | ||
| cat chrome_diff.txt | ||
| exit 1 | ||
| fi |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: 'This sets up our Jupyter Lite website, so we can run xeus-cpp in it' | ||
| description: 'This action sets up our Jupyter Lite website, so we can run xeus-cpp in it' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Jupyter Lite integration test | ||
| shell: bash -l {0} | ||
| run: | | ||
| set -e | ||
| micromamba create -n xeus-lite-host jupyter_server jupyterlite-xeus -c conda-forge | ||
| micromamba activate xeus-lite-host | ||
| if [[ "${{ matrix.os }}" == "macos"* ]]; then | ||
| brew install coreutils | ||
| export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" | ||
| fi | ||
| timeout 1800 jupyter lite serve --settings-overrides=overrides.json \ | ||
| --XeusAddon.prefix=${{ env.PREFIX }} \ | ||
| --XeusAddon.mounts="${{ env.PREFIX }}/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \ | ||
| --XeusAddon.mounts="${{ env.PREFIX }}/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \ | ||
| --contents README.md \ | ||
| --contents notebooks/xeus-cpp-lite-demo.ipynb \ | ||
| --contents notebooks/tinyraytracer.ipynb \ | ||
| --contents notebooks/images/marie.png \ | ||
| --contents notebooks/audio/audio.wav \ | ||
| --output-dir dist & | ||
| # There is a bug in nbdime after 3.2.0 where it will show the filenames as if there was a diff | ||
| # but there is no diff with the options chosen below (the latest doesn't show a diff, just the filenames with +++ | ||
| # and --- as if it was planning to show a diff. | ||
| python -m pip install nbdime==3.2.0 selenium | ||
| # This sleep is to force enough time for the jupyter site to build before trying | ||
| # to run notebooks in it. If you try to run the notebooks before the website is | ||
| # ready the ci python script will crash saying ti cannot access the url | ||
| sleep 10 |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vgvassilev The only way I can think to reduce the ci in this PR is to reduce this part so that it only runs the
xeus-cpp-lite-demo.ipynbandtinyraytracer.ipynbkernels with the C++23 kernel (this change in main.yml too). Is that what you had in mind?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vgvassilev pinging for review. I've tried to respond to your previous comment here #415 (review) , with my response here #415 (comment) and my comment above.