Skip to content

run notebooks

run notebooks #17

Workflow file for this run

name: run notebooks
on:
workflow_dispatch:
pull_request:
branches:
- dev
schedule:
- cron: "30 2 * * 4" # every thursday on 2:30am UTC
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: pip install jupyter nbconvert
- run: pip install -r requirements.txt
- name: Find notebooks
id: find-notebooks
run: |
find . -name "*.ipynb" > notebooks.txt
cat notebooks.txt
shell: bash
- name: Execute notebooks
run: |
cat notebooks.txt | while read -r notebook; do
jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=python3 --execute --inplace "$notebook"
done
continue-on-error: false
shell: bash
- name: Check for errors
run: |
if grep "raise Exception(" *.ipynb; then
echo "Error found in notebook(s)."
exit 1
else
echo "No errors found in notebooks."
fi
shell: bash