|
| 1 | +name: 'Run kernel in notebook within Jupyter Lite' |
| 2 | +description: 'This action runs the chosen kernel in notebook within Jupyter Lite' |
| 3 | + |
| 4 | +inputs: |
| 5 | + notebook: |
| 6 | + description: "The notebook to run the kernel in" |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + kernel: |
| 10 | + description: "The kernel to use" |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +runs: |
| 15 | + using: composite |
| 16 | + steps: |
| 17 | + - name: Jupyter Lite integration test |
| 18 | + shell: bash -l {0} |
| 19 | + run: | |
| 20 | + set -e |
| 21 | + micromamba activate xeus-lite-host |
| 22 | + export INPUT_TEXT="" |
| 23 | + if [[ "${{ inputs.notebook }}" == "xeus-cpp-lite-demo.ipynb"* ]]; then |
| 24 | + export INPUT_TEXT="--stdin Smudge" |
| 25 | + fi |
| 26 | + echo "Running xeus-cpp in Jupter Lite in Chrome" |
| 27 | + python -u scripts/automated-notebook-run-script.py --driver chrome --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT |
| 28 | + nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> chrome_diff.txt |
| 29 | + export CHROME_TESTS_RETURN_VALUE=$( [ -s chrome_diff.txt ] && echo 1 || echo 0 ) |
| 30 | + rm $HOME/Downloads/${{ inputs.notebook }} |
| 31 | + echo "Running xeus-cpp in Jupter Lite in Firefox" |
| 32 | + python -u scripts/automated-notebook-run-script.py --driver firefox --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT |
| 33 | + nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> firefox_diff.txt |
| 34 | + export FIREFOX_TESTS_RETURN_VALUE=$( [ -s firefox_diff.txt ] && echo 1 || echo 0 ) |
| 35 | + rm $HOME/Downloads/${{ inputs.notebook }} |
| 36 | + export SAFARI_TESTS_RETURN_VALUE=0 |
| 37 | + touch safari_diff.txt |
| 38 | + if [[ "${{ matrix.os }}" == "macos"* ]]; then |
| 39 | + echo "Running xeus-cpp in Jupter Lite in Safari" |
| 40 | + python -u scripts/automated-notebook-run-script.py --driver safari --notebook ${{ inputs.notebook }} --kernel ${{ inputs.kernel }} $INPUT_TEXT |
| 41 | + nbdiff notebooks/${{ inputs.notebook }} $HOME/Downloads/${{ inputs.notebook }} --ignore-id --ignore-metadata >> safari_diff.txt |
| 42 | + export SAFARI_TESTS_RETURN_VALUE=$( [ -s safari_diff.txt ] && echo 1 || echo 0 ) |
| 43 | + rm $HOME/Downloads/${{ inputs.notebook }} |
| 44 | + fi |
| 45 | + if [[ $SAFARI_TESTS_RETURN_VALUE -ne 0 || $FIREFOX_TESTS_RETURN_VALUE -ne 0 || $CHROME_TESTS_RETURN_VALUE -ne 0 ]]; then |
| 46 | + if [[ "${{ matrix.os }}" == "macos"* ]]; then |
| 47 | + echo "Diff Safari (blank means no diff)" |
| 48 | + cat safari_diff.txt |
| 49 | + fi |
| 50 | + echo "Diff Firefox (blank means no diff)" |
| 51 | + cat firefox_diff.txt |
| 52 | + echo "Diff Chrome (blank means no diff)" |
| 53 | + cat chrome_diff.txt |
| 54 | + exit 1 |
| 55 | + fi |
0 commit comments