diff --git a/.github/workflows/test_notebooks.yaml b/.github/workflows/test_notebooks.yaml new file mode 100644 index 000000000..43254993a --- /dev/null +++ b/.github/workflows/test_notebooks.yaml @@ -0,0 +1,25 @@ +name: test_notebooks + +on: [pull_request] + +jobs: + formatting: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install poetry + run: pipx install poetry + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.8" + cache: "poetry" + + - name: Install dependencies + run: poetry install --no-interaction + + - name: Execute all notebooks + run: ./tools/test_notebooks.sh diff --git a/tools/test_notebooks.sh b/tools/test_notebooks.sh new file mode 100755 index 000000000..60e555ea9 --- /dev/null +++ b/tools/test_notebooks.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Execute all notebook files under examples/tutorials to check that they work +# +# Usage example: +# ./tools/test_notebooks.sh + +# Checks that the code in all notebooks run +for path in $(ls examples/tutorials/*.ipynb); do + poetry run jupyter nbconvert --execute $path --to python --stdout +done